From patchwork Wed Sep 20 12:57:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 142499 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4244703vqi; Wed, 20 Sep 2023 09:02:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGD7cNAS/dZwiAG8gUaaMQmUI9d7KNSINmI4lNTXCfBtP51yAhfEyjlku4UxIzFL7/WEWjX X-Received: by 2002:a05:6a21:4985:b0:151:991c:84b6 with SMTP id ax5-20020a056a21498500b00151991c84b6mr3069677pzc.59.1695225727714; Wed, 20 Sep 2023 09:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695225727; cv=none; d=google.com; s=arc-20160816; b=zCb5dEix23+P7MedH2yr4oaRKWk93CgwLTa35MFX2UZaM7R21JYghLQV5vhkD0ZSo2 HSMUhkaqudAA6BPUPYl0vMQ4mdH7+M0lFqK78Vt7FiT2s9MFaKyFE68A1tDQpxznyMXK bYjT44RTy5ifgvRbQzn0DY6jmpJBwRKtN3j2I8wf7VYX9zkQphmWuQU6RzQBkJY/oLY6 IaW90rVxB/XjJr2McVhT4nrdQV3nxbTLyIvPhTJPoYbW21elSgEjXVZzfUCOn+mAX+l7 uHwBxW/h4jQwc2YT8VnMYdOlPv5MtiwVVcwhYWgIGiPjqLhtTyxvcmZvSNh5j/b/EIlv g0MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=TP+R9YuyvkdMR0JPGeT2sCkwGKBUuPYE1EEiFJcry1M=; fh=TqpoHLAFbloQC5AcWAfLNmB7dsfdfrc+PKhB5PoJGI0=; b=MKsjDgQbW1sH++DVE85FK9coxwoxFOD3rw0EZLuPPi4hfNiLOTZ2auoA2LLtNtDkCC NTTm9mkwTAnRDZhvuF3t3CwMck3r+gtg2tdWxzNhiuy/oICcpySBwf0OUmWYsjFosv9l ZEKCcNHBo52mMDZ81eo+a1rsOxE0KXC3RL3e0BY6rbD2aFVhWKqNx4e85GvLyPmDaxtt eH9Vh+lPSVuLwmscmkU1640UWcZvRzUDrXMjO1h19sZvCKaxSKC/4JhqcKftZV4GUB7o nV3mKhY1GyIaGfn7aCN0slnmv7FSQ8mc2lqsQU3cZCWyq5+tAXNe7ANW4u+A3vtn7yqB 7w4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=SpmwnSn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bc22-20020a656d96000000b00578b952e954si3280645pgb.112.2023.09.20.09.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 09:02:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=SpmwnSn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6BD1E801CFDE; Wed, 20 Sep 2023 05:58:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235712AbjITM60 (ORCPT + 26 others); Wed, 20 Sep 2023 08:58:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234811AbjITM6X (ORCPT ); Wed, 20 Sep 2023 08:58:23 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2446AE4 for ; Wed, 20 Sep 2023 05:58:15 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C2D4B75; Wed, 20 Sep 2023 14:56:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695214596; bh=IW7T3Hmhw5PD2Ji9iO/gJ84F73CLdNZ+VKCKWdPttok=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SpmwnSn7r04dCymj8vXOLL/zcn1pT/hmUcV4QnAh2+AGRxDfASWhHZ+QayzP06YYs NTT5agQ8AAiAfjnyVWwG55ahNDIXT3DJyIykE5NV9EvPuXY0vVSkTS7wKPeMcOtsCo VHnbfhQFzX0ICYwB54UkFjhorZGR0Sg75DV6jMVY= From: Tomi Valkeinen Date: Wed, 20 Sep 2023 15:57:16 +0300 Subject: [PATCH 1/2] Revert "drm/tidss: Annotate dma-fence critical section in commit path" MIME-Version: 1.0 Message-Id: <20230920-dma-fence-annotation-revert-v1-1-7ebf6f7f5bf6@ideasonboard.com> References: <20230920-dma-fence-annotation-revert-v1-0-7ebf6f7f5bf6@ideasonboard.com> In-Reply-To: <20230920-dma-fence-annotation-revert-v1-0-7ebf6f7f5bf6@ideasonboard.com> To: Daniel Vetter Cc: Jyri Sarha , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Francesco Dolcini , Aradhya Bhatia , Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6043; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=IW7T3Hmhw5PD2Ji9iO/gJ84F73CLdNZ+VKCKWdPttok=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlCuxirH8Wtxss+l4PKmHRWB9GMdTUTcFF93ADN +jTgdQUYzqJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZQrsYgAKCRD6PaqMvJYe 9edXD/9Ubku3IOaE5I0e0VSUEefvkGeX6Q2UBaZokvlsfZYhYJV/Hsehb00zES/Im/GIhWZEwWl FdrFAI2YAkL9dMvumEuWyK186knJB/haCGtn21OuammLxLodkkcgx/Ajh6+jri5kmsyQ7It8IDd RDBpHoJJbZW4jvVnJCAKH+IHuC4eiMZz1e/tfLdEyxfxVbnwrQFF5tPuBOXrke5qGxhHvZz1mVE nR/kwhgJ8sAy10BFbDtvyn5p60JVv9BbvVlx8ri2HhCCnU8kvdUWLHfNO0l2qxfvYuPYy6H4q07 wuW6NOqSOdBO/Mrgh3KX69xYrLFFE72FAlXpCVHMFPn7sFIH2LKTfQQKtiDJkEIugx/8FKupC8v HQBS6jY76l5BOSusp5x7ELvRMICsHgJu8dzzhygwmWcVWYGps7viAK8Rwd41WNmhtw38LLTwv5k Uvrbtw5Oix1lh9EkJroT8+Tdp8oIwf1zpgWn/Tagy7ISggKtT2+8wq7AAUfICBjyrOHoA9mayss Sas+RkL9tj4NpYG1LVZOt9RgQII7po1c7qTj3LwpehSC3rW8D0DedGL24fvczRLrZJA1oP+/4+7 GAn0cuJD0wtynfFDZNc1D4CYFiVmJvN6QRIlLrBaszt+7cF6ZQqQ/w+Ulzr1tM/qXSrhG6prooA y8lZ8vTvePa4Y1w== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 05:58:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777573012734621030 X-GMAIL-MSGID: 1777573012734621030 This reverts commit 4d56a4f08391857ba93465de489707b66adad114. The DMA-fence annotations cause a lockdep warning (see below). As per https://patchwork.freedesktop.org/patch/462170/ it sounds like the annotations don't work correctly. ====================================================== WARNING: possible circular locking dependency detected 6.6.0-rc2+ #1 Not tainted ------------------------------------------------------ kmstest/733 is trying to acquire lock: ffff8000819377f0 (fs_reclaim){+.+.}-{0:0}, at: __kmem_cache_alloc_node+0x58/0x2d4 but task is already holding lock: ffff800081a06aa0 (dma_fence_map){++++}-{0:0}, at: tidss_atomic_commit_tail+0x20/0xc0 [tidss] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (dma_fence_map){++++}-{0:0}: __dma_fence_might_wait+0x5c/0xd0 dma_resv_lockdep+0x1a4/0x32c do_one_initcall+0x84/0x2fc kernel_init_freeable+0x28c/0x4c4 kernel_init+0x24/0x1dc ret_from_fork+0x10/0x20 -> #1 (mmu_notifier_invalidate_range_start){+.+.}-{0:0}: fs_reclaim_acquire+0x70/0xe4 __kmem_cache_alloc_node+0x58/0x2d4 kmalloc_trace+0x38/0x78 __kthread_create_worker+0x3c/0x150 kthread_create_worker+0x64/0x8c workqueue_init+0x1e8/0x2f0 kernel_init_freeable+0x11c/0x4c4 kernel_init+0x24/0x1dc ret_from_fork+0x10/0x20 -> #0 (fs_reclaim){+.+.}-{0:0}: __lock_acquire+0x1370/0x20d8 lock_acquire+0x1e8/0x308 fs_reclaim_acquire+0xd0/0xe4 __kmem_cache_alloc_node+0x58/0x2d4 __kmalloc_node_track_caller+0x58/0xf0 kmemdup+0x34/0x60 regmap_bulk_write+0x64/0x2c0 tc358768_bridge_pre_enable+0x8c/0x12d0 [tc358768] drm_atomic_bridge_call_pre_enable+0x68/0x80 [drm] drm_atomic_bridge_chain_pre_enable+0x50/0x158 [drm] drm_atomic_helper_commit_modeset_enables+0x164/0x264 [drm_kms_helper] tidss_atomic_commit_tail+0x58/0xc0 [tidss] commit_tail+0xa0/0x188 [drm_kms_helper] drm_atomic_helper_commit+0x1a8/0x1c0 [drm_kms_helper] drm_atomic_commit+0xa8/0xe0 [drm] drm_mode_atomic_ioctl+0x9ec/0xc80 [drm] drm_ioctl_kernel+0xc4/0x170 [drm] drm_ioctl+0x234/0x4b0 [drm] drm_compat_ioctl+0x110/0x12c [drm] __arm64_compat_sys_ioctl+0x128/0x150 invoke_syscall+0x48/0x110 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc_compat+0x1c/0x38 el0_svc_compat+0x48/0xb4 el0t_32_sync_handler+0xb0/0x138 el0t_32_sync+0x194/0x198 other info that might help us debug this: Chain exists of: fs_reclaim --> mmu_notifier_invalidate_range_start --> dma_fence_map Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(dma_fence_map); lock(mmu_notifier_invalidate_range_start); lock(dma_fence_map); lock(fs_reclaim); *** DEADLOCK *** 3 locks held by kmstest/733: #0: ffff800082e5bba0 (crtc_ww_class_acquire){+.+.}-{0:0}, at: drm_mode_atomic_ioctl+0x118/0xc80 [drm] #1: ffff000004224c88 (crtc_ww_class_mutex){+.+.}-{3:3}, at: modeset_lock+0xdc/0x1a0 [drm] #2: ffff800081a06aa0 (dma_fence_map){++++}-{0:0}, at: tidss_atomic_commit_tail+0x20/0xc0 [tidss] stack backtrace: CPU: 0 PID: 733 Comm: kmstest Not tainted 6.6.0-rc2+ #1 Hardware name: Toradex Verdin AM62 on Verdin Development Board (DT) Call trace: dump_backtrace+0x98/0x118 show_stack+0x18/0x24 dump_stack_lvl+0x60/0xac dump_stack+0x18/0x24 print_circular_bug+0x288/0x368 check_noncircular+0x168/0x17c __lock_acquire+0x1370/0x20d8 lock_acquire+0x1e8/0x308 fs_reclaim_acquire+0xd0/0xe4 __kmem_cache_alloc_node+0x58/0x2d4 __kmalloc_node_track_caller+0x58/0xf0 kmemdup+0x34/0x60 regmap_bulk_write+0x64/0x2c0 tc358768_bridge_pre_enable+0x8c/0x12d0 [tc358768] drm_atomic_bridge_call_pre_enable+0x68/0x80 [drm] drm_atomic_bridge_chain_pre_enable+0x50/0x158 [drm] drm_atomic_helper_commit_modeset_enables+0x164/0x264 [drm_kms_helper] tidss_atomic_commit_tail+0x58/0xc0 [tidss] commit_tail+0xa0/0x188 [drm_kms_helper] drm_atomic_helper_commit+0x1a8/0x1c0 [drm_kms_helper] drm_atomic_commit+0xa8/0xe0 [drm] drm_mode_atomic_ioctl+0x9ec/0xc80 [drm] drm_ioctl_kernel+0xc4/0x170 [drm] drm_ioctl+0x234/0x4b0 [drm] drm_compat_ioctl+0x110/0x12c [drm] __arm64_compat_sys_ioctl+0x128/0x150 invoke_syscall+0x48/0x110 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc_compat+0x1c/0x38 el0_svc_compat+0x48/0xb4 el0t_32_sync_handler+0xb0/0x138 el0t_32_sync+0x194/0x198 Fixes: 4d56a4f08391 ("drm/tidss: Annotate dma-fence critical section in commit path") Signed-off-by: Tomi Valkeinen Reviewed-by: Aradhya Bhatia --- drivers/gpu/drm/tidss/tidss_kms.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c index c979ad1af236..d096d8d2bc8f 100644 --- a/drivers/gpu/drm/tidss/tidss_kms.c +++ b/drivers/gpu/drm/tidss/tidss_kms.c @@ -4,8 +4,6 @@ * Author: Tomi Valkeinen */ -#include - #include #include #include @@ -25,7 +23,6 @@ static void tidss_atomic_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *ddev = old_state->dev; struct tidss_device *tidss = to_tidss(ddev); - bool fence_cookie = dma_fence_begin_signalling(); dev_dbg(ddev->dev, "%s\n", __func__); @@ -36,7 +33,6 @@ static void tidss_atomic_commit_tail(struct drm_atomic_state *old_state) drm_atomic_helper_commit_modeset_enables(ddev, old_state); drm_atomic_helper_commit_hw_done(old_state); - dma_fence_end_signalling(fence_cookie); drm_atomic_helper_wait_for_flip_done(ddev, old_state); drm_atomic_helper_cleanup_planes(ddev, old_state); From patchwork Wed Sep 20 12:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 142520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4276097vqi; Wed, 20 Sep 2023 09:47:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcbDLjy0uBFh6ZyF1r6pKRzPy7tFx7+G9B+K8ZykRJWdzh3RXrihrySmtyN6kR+eI7Ptqs X-Received: by 2002:a05:6a00:851:b0:68b:eb3d:8030 with SMTP id q17-20020a056a00085100b0068beb3d8030mr3306673pfk.1.1695228428354; Wed, 20 Sep 2023 09:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695228428; cv=none; d=google.com; s=arc-20160816; b=luska3T+OtyqOqviyLkwlqweZj/fxUFjNgrKKa92mNOXgw9y4GbfmSZJp4C2Ii1Xgr /ipD2NvFpLOhamqdm2gHs5lIIjh6AGx8rLj2xnmjCPwXzhq5Z9ARQX1s8ToqA5btdu/y TqDgcq7HM4QobB9bppuAh+1JBoJt55m/Dlt4UrcE01fHtGlqsU98AqizPNOHG71Sfxcl 4tmgUizg6wfDu/bQ9+AKp+Yq4NddTUMZs+Sa/rcf6X8PGx/ULpm1afHJzaienE6VHw+d umLbEyzjb71bg0xpDibKHwr92TR6jKkGtQufKNffj17Yz7hc8DkeFrVfNAyeVg1DmZ3l qvHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=dcQZidrBcNyJkH7Pp8tzGPj1llaQcUuUTCAxj7BldIE=; fh=TqpoHLAFbloQC5AcWAfLNmB7dsfdfrc+PKhB5PoJGI0=; b=DOjlJIHdCTsnjkCbTeN1FE8gLTZvqCJvxBHoAvAgc8+aeFOVnfARYQS0YCqAdhRN1u byCI0D31s6JrPtqnYEy1c1Ftwas+9pTkPcsVXZTnozW3BJIDB+JPjrdDESqtiHXjBRry BsAoFWY76YGIe4aQr9s5IGWxXN4CR9ww7U78Lff46HbxT7cNMVJIIaLSnZUA3KHV8CVc /ID7j26335idSKh9JpPBgs2EqwQG2cFt2glfyhDM63qOsA1X2m6LY6p4VXpE1MxZMBQw 4+uXA9lRTyni+tdi6iJtlmZqj5hlJmqh6Ky2GGXFp4PkSqnGXMM76fmnR77j65I7O17S T7dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nHY8EOSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id d15-20020a056a0024cf00b0068fa57d2486si12623828pfv.125.2023.09.20.09.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 09:47:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nHY8EOSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 67BDA82E2971; Wed, 20 Sep 2023 05:58:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235952AbjITM6c (ORCPT + 26 others); Wed, 20 Sep 2023 08:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235699AbjITM6Z (ORCPT ); Wed, 20 Sep 2023 08:58:25 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C589CE for ; Wed, 20 Sep 2023 05:58:19 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E8820162B; Wed, 20 Sep 2023 14:56:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695214597; bh=tPGq1Ihckle4eJAoNTTym1ACYmHu0ImqZWFhxyXuBpw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nHY8EOSI8r84Kw0vTU0uoWNCW13o3ZzivVpGYIRZqIKsR/XBJoWNbCKUDUGnVhmhs uNWuM+7JlWzaahk3Xe0V413tTFy40h6an48RrYuPxHxWVlm4xKAGwpDtoVcku8sRME qyZ8Y6+Jafu0UAy2Euw7+UOwZMMyV13s9Kxq/s5c= From: Tomi Valkeinen Date: Wed, 20 Sep 2023 15:57:17 +0300 Subject: [PATCH 2/2] Revert "drm/omapdrm: Annotate dma-fence critical section in commit path" MIME-Version: 1.0 Message-Id: <20230920-dma-fence-annotation-revert-v1-2-7ebf6f7f5bf6@ideasonboard.com> References: <20230920-dma-fence-annotation-revert-v1-0-7ebf6f7f5bf6@ideasonboard.com> In-Reply-To: <20230920-dma-fence-annotation-revert-v1-0-7ebf6f7f5bf6@ideasonboard.com> To: Daniel Vetter Cc: Jyri Sarha , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Francesco Dolcini , Aradhya Bhatia , Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6751; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=tPGq1Ihckle4eJAoNTTym1ACYmHu0ImqZWFhxyXuBpw=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlCuxjmVJFjx5D0ZxLclHlaNda4s3KGW641XEhu c9/Xl4cbYuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZQrsYwAKCRD6PaqMvJYe 9dI7D/42qk/uP0i7iq62L0LqWMu02oG8QGJHRUEsPmnB8/xJ0QkfCHQGhub/ia+me5g9SZYL1CQ sgZtpYXXWDlHt8JWgKi9+gsZb1U3Z5IR4aS4pJNMNEylEpyyP5ZeaXnRwfynTPPyvUF37HsiC8Y UKjR+LK+3Gx2IRBokdJ289wrIzUHoT0dXsPH1XXZrVcQ1aIM1Ix9eMvItookQopir/bophT05ec CMc+eWoky6dfi2AaoPAzEoNDCkSg1iujGO6wZGboF6eShxbPN52naCzOw9MUqeY81lp6WNHvmC/ v70NZyn+2XQjhUeBnv2Qc7aSR58FTcGqy17MaS1Jg8nOyFj9D3iGhyLhatTeNtIh98L/vCl28NR gDCQ3SXjgupHkn+fBbjADEbGA1li7lYxW7pl7Sv6u+Oy9X5fr93Bepu0k8MdR0NMH/whsitCaXj 3EE1NV1LK0vfjSaCs4HuK/BiLUhRhfG7XPpU3o/b8X+m6Mi82L8Rdz3/vy45fhIOdTU+xm7coZh IefcefM2dBqcjLN3wzp8gsSn2BESQSmbY7glA1aGpUMEkpgL6nTdPfg8qLR391+58r2aWYT+Rkb BVJtDsFifzpglyXQDztfUqbWIG3CwCylOGI45oRX2beCMdzkfLvCkZ7Fagjb0lkz9HiCu6h3TjH wOmI3lkOs1eJeRA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 20 Sep 2023 05:58:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777575844513008417 X-GMAIL-MSGID: 1777575844513008417 This reverts commit 250aa22920cd5d956a5d3e9c6a43d671c2bae217. The DMA-fence annotations cause a lockdep warning (see below). As per https://patchwork.freedesktop.org/patch/462170/ it sounds like the annotations don't work correctly. ====================================================== WARNING: possible circular locking dependency detected 6.5.0-rc2+ #2 Not tainted ------------------------------------------------------ kmstest/219 is trying to acquire lock: c4705838 (&hdmi->lock){+.+.}-{3:3}, at: hdmi5_bridge_mode_set+0x1c/0x50 but task is already holding lock: c11e1128 (dma_fence_map){++++}-{0:0}, at: omap_atomic_commit_tail+0x14/0xbc which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (dma_fence_map){++++}-{0:0}: __dma_fence_might_wait+0x48/0xb4 dma_resv_lockdep+0x1b8/0x2bc do_one_initcall+0x68/0x3b0 kernel_init_freeable+0x260/0x34c kernel_init+0x14/0x140 ret_from_fork+0x14/0x28 -> #1 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire+0x70/0xa8 __kmem_cache_alloc_node+0x3c/0x368 kmalloc_trace+0x28/0x58 _drm_do_get_edid+0x7c/0x35c hdmi5_bridge_get_edid+0xc8/0x1ac drm_bridge_connector_get_modes+0x64/0xc0 drm_helper_probe_single_connector_modes+0x170/0x528 drm_client_modeset_probe+0x208/0x1334 __drm_fb_helper_initial_config_and_unlock+0x30/0x548 omap_fbdev_client_hotplug+0x3c/0x6c drm_client_register+0x58/0x94 pdev_probe+0x544/0x6b0 platform_probe+0x58/0xbc really_probe+0xd8/0x3fc __driver_probe_device+0x94/0x1f4 driver_probe_device+0x2c/0xc4 __device_attach_driver+0xa4/0x11c bus_for_each_drv+0x84/0xdc __device_attach+0xac/0x20c bus_probe_device+0x8c/0x90 device_add+0x588/0x7e0 platform_device_add+0x110/0x24c platform_device_register_full+0x108/0x15c dss_bind+0x90/0xc0 try_to_bring_up_aggregate_device+0x1e0/0x2c8 __component_add+0xa4/0x174 hdmi5_probe+0x1c8/0x270 platform_probe+0x58/0xbc really_probe+0xd8/0x3fc __driver_probe_device+0x94/0x1f4 driver_probe_device+0x2c/0xc4 __device_attach_driver+0xa4/0x11c bus_for_each_drv+0x84/0xdc __device_attach+0xac/0x20c bus_probe_device+0x8c/0x90 deferred_probe_work_func+0x8c/0xd8 process_one_work+0x2ac/0x6e4 worker_thread+0x30/0x4ec kthread+0x100/0x124 ret_from_fork+0x14/0x28 -> #0 (&hdmi->lock){+.+.}-{3:3}: __lock_acquire+0x145c/0x29cc lock_acquire.part.0+0xb4/0x258 __mutex_lock+0x90/0x950 mutex_lock_nested+0x1c/0x24 hdmi5_bridge_mode_set+0x1c/0x50 drm_bridge_chain_mode_set+0x48/0x5c crtc_set_mode+0x188/0x1d0 omap_atomic_commit_tail+0x2c/0xbc commit_tail+0x9c/0x188 drm_atomic_helper_commit+0x158/0x18c drm_atomic_commit+0xa4/0xe8 drm_mode_atomic_ioctl+0x9a4/0xc38 drm_ioctl+0x210/0x4a8 sys_ioctl+0x138/0xf00 ret_fast_syscall+0x0/0x1c other info that might help us debug this: Chain exists of: &hdmi->lock --> fs_reclaim --> dma_fence_map Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(dma_fence_map); lock(fs_reclaim); lock(dma_fence_map); lock(&hdmi->lock); *** DEADLOCK *** 3 locks held by kmstest/219: #0: f1011de4 (crtc_ww_class_acquire){+.+.}-{0:0}, at: drm_mode_atomic_ioctl+0xf0/0xc38 #1: c47059c8 (crtc_ww_class_mutex){+.+.}-{3:3}, at: modeset_lock+0xf8/0x230 #2: c11e1128 (dma_fence_map){++++}-{0:0}, at: omap_atomic_commit_tail+0x14/0xbc stack backtrace: CPU: 1 PID: 219 Comm: kmstest Not tainted 6.5.0-rc2+ #2 Hardware name: Generic DRA74X (Flattened Device Tree) unwind_backtrace from show_stack+0x10/0x14 show_stack from dump_stack_lvl+0x58/0x70 dump_stack_lvl from check_noncircular+0x164/0x198 check_noncircular from __lock_acquire+0x145c/0x29cc __lock_acquire from lock_acquire.part.0+0xb4/0x258 lock_acquire.part.0 from __mutex_lock+0x90/0x950 __mutex_lock from mutex_lock_nested+0x1c/0x24 mutex_lock_nested from hdmi5_bridge_mode_set+0x1c/0x50 hdmi5_bridge_mode_set from drm_bridge_chain_mode_set+0x48/0x5c drm_bridge_chain_mode_set from crtc_set_mode+0x188/0x1d0 crtc_set_mode from omap_atomic_commit_tail+0x2c/0xbc omap_atomic_commit_tail from commit_tail+0x9c/0x188 commit_tail from drm_atomic_helper_commit+0x158/0x18c drm_atomic_helper_commit from drm_atomic_commit+0xa4/0xe8 drm_atomic_commit from drm_mode_atomic_ioctl+0x9a4/0xc38 drm_mode_atomic_ioctl from drm_ioctl+0x210/0x4a8 drm_ioctl from sys_ioctl+0x138/0xf00 sys_ioctl from ret_fast_syscall+0x0/0x1c Exception stack(0xf1011fa8 to 0xf1011ff0) 1fa0: 00466d58 be9ab510 00000003 c03864bc be9ab510 be9ab4e0 1fc0: 00466d58 be9ab510 c03864bc 00000036 00466ef0 00466fc0 00467020 00466f20 1fe0: b6bc7ef4 be9ab4d0 b6bbbb00 b6cb2cc0 Fixes: 250aa22920cd ("drm/omapdrm: Annotate dma-fence critical section in commit path") Signed-off-by: Tomi Valkeinen Reviewed-by: Aradhya Bhatia --- drivers/gpu/drm/omapdrm/omap_drv.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index afeeb7737552..e000577a95dd 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -69,7 +69,6 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; struct omap_drm_private *priv = dev->dev_private; - bool fence_cookie = dma_fence_begin_signalling(); dispc_runtime_get(priv->dispc); @@ -92,6 +91,8 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) omap_atomic_wait_for_completion(dev, old_state); drm_atomic_helper_commit_planes(dev, old_state, 0); + + drm_atomic_helper_commit_hw_done(old_state); } else { /* * OMAP3 DSS seems to have issues with the work-around above, @@ -101,11 +102,9 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) drm_atomic_helper_commit_planes(dev, old_state, 0); drm_atomic_helper_commit_modeset_enables(dev, old_state); - } - drm_atomic_helper_commit_hw_done(old_state); - - dma_fence_end_signalling(fence_cookie); + drm_atomic_helper_commit_hw_done(old_state); + } /* * Wait for completion of the page flips to ensure that old buffers