From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2325DE75424 for ; Tue, 3 Oct 2023 05:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239128AbjJCFZs (ORCPT ); Tue, 3 Oct 2023 01:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbjJCFZp (ORCPT ); Tue, 3 Oct 2023 01:25:45 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2353AAC for ; Mon, 2 Oct 2023 22:25:40 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3935POiB114352; Tue, 3 Oct 2023 00:25:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696310724; bh=DtLhN+uk/e+g9tnn5W0glAsvWoiFmIpmUyCtAJqK+zY=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=Pk1hODw/O+7NvE94Y3Mg/9ewaDjeY+lXBXuSbUJqdqAtFI6MrOMRadF+juHukFJ6W JAcyFYgYR7NWymb9NQeMLR9orpfWdRarKKeDxRXGWuRHxHKRAxB0y+KP2KSB4K+2mb lN5U7mFhMT1XeK2mEJwwgmbiTEWk1PuHxACDgXbQ= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3935PORO080715 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 3 Oct 2023 00:25:24 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 3 Oct 2023 00:25:23 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 3 Oct 2023 00:25:23 -0500 Received: from [172.24.227.252] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3935PKUJ004882; Tue, 3 Oct 2023 00:25:21 -0500 Message-ID: <484f6dd2-ed17-16af-0e1e-0ae6926eec53@ti.com> Date: Tue, 3 Oct 2023 10:55:20 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 2/2] Revert "drm/omapdrm: Annotate dma-fence critical section in commit path" Content-Language: en-US To: Tomi Valkeinen , Daniel Vetter CC: Jyri Sarha , David Airlie , , , Francesco Dolcini References: <20230920-dma-fence-annotation-revert-v1-0-7ebf6f7f5bf6@ideasonboard.com> <20230920-dma-fence-annotation-revert-v1-2-7ebf6f7f5bf6@ideasonboard.com> From: Aradhya Bhatia In-Reply-To: <20230920-dma-fence-annotation-revert-v1-2-7ebf6f7f5bf6@ideasonboard.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-Sep-23 18:27, Tomi Valkeinen wrote: > 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 Regards Aradhya > 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 >