Quoting Daniel Vetter (2019-08-22 07:54:57) > +#if IS_ENABLED(CONFIG_LOCKDEP) > +static void dma_resv_lockdep(void) > +{ > + struct mm_struct *mm = mm_alloc(); > + struct dma_resv obj; > + > + if (!mm) > + return; > + > + dma_resv_init(&obj); > + > + down_read(&mm->mmap_sem); > + ww_mutex_lock(&obj.lock, NULL); > + fs_reclaim_acquire(GFP_KERNEL); > + fs_reclaim_release(GFP_KERNEL); > + ww_mutex_unlock(&obj.lock); > + up_read(&mm->mmap_sem); > + > + mmput(mm); > +} > +subsys_initcall(dma_resv_lockdep); > +#endif Adding a dma_resv_lock(); might_lock(&i915->drm.struct_mutex); dma_resv_unlock(); yielded [ 18.513633] ====================================================== [ 18.513636] WARNING: possible circular locking dependency detected [ 18.513639] 5.3.0-rc5+ #76 Not tainted [ 18.513640] ------------------------------------------------------ [ 18.513643] insmod/655 is trying to acquire lock: [ 18.513645] 00000000877909e7 (&dev->struct_mutex){+.+.}, at: i915_driver_probe+0x89c/0x1470 [i915] [ 18.513671] [ 18.513671] but task is already holding lock: [ 18.513673] 00000000a85ba8ec (reservation_ww_class_mutex){+.+.}, at: i915_driver_probe+0x8e1/0x1470 [i915] [ 18.513698] [ 18.513698] which lock already depends on the new lock. [ 18.513698] [ 18.513701] [ 18.513701] the existing dependency chain (in reverse order) is: [ 18.513703] [ 18.513703] -> #1 (reservation_ww_class_mutex){+.+.}: [ 18.513708] __ww_mutex_lock.constprop.17+0xbc/0xf90 [ 18.513739] i915_gem_init+0x518/0x750 [i915] [ 18.513762] i915_driver_probe+0x891/0x1470 [i915] [ 18.513785] i915_pci_probe+0x2f/0x110 [i915] [ 18.513789] pci_device_probe+0x99/0x110 [ 18.513792] really_probe+0xd1/0x360 [ 18.513794] driver_probe_device+0xaf/0xf0 [ 18.513796] device_driver_attach+0x4a/0x50 [ 18.513799] __driver_attach+0x80/0x140 [ 18.513801] bus_for_each_dev+0x5e/0x90 [ 18.513804] bus_add_driver+0x148/0x1e0 [ 18.513806] driver_register+0x66/0xb0 [ 18.513809] do_one_initcall+0x45/0x29f [ 18.513812] do_init_module+0x55/0x200 [ 18.513814] load_module+0x2519/0x2690 [ 18.513816] __do_sys_finit_module+0x8f/0xd0 [ 18.513818] do_syscall_64+0x4f/0x220 [ 18.513822] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 18.513824] [ 18.513824] -> #0 (&dev->struct_mutex){+.+.}: [ 18.513828] __lock_acquire+0xcb9/0x1520 [ 18.513831] lock_acquire+0x90/0x170 [ 18.513853] i915_driver_probe+0x8fd/0x1470 [i915] [ 18.513876] i915_pci_probe+0x2f/0x110 [i915] [ 18.513879] pci_device_probe+0x99/0x110 [ 18.513881] really_probe+0xd1/0x360 [ 18.513883] driver_probe_device+0xaf/0xf0 [ 18.513886] device_driver_attach+0x4a/0x50 [ 18.513888] __driver_attach+0x80/0x140 [ 18.513891] bus_for_each_dev+0x5e/0x90 [ 18.513893] bus_add_driver+0x148/0x1e0 [ 18.513895] driver_register+0x66/0xb0 [ 18.513897] do_one_initcall+0x45/0x29f [ 18.513899] do_init_module+0x55/0x200 [ 18.513902] load_module+0x2519/0x2690 [ 18.513904] __do_sys_finit_module+0x8f/0xd0 [ 18.513906] do_syscall_64+0x4f/0x220 [ 18.513909] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 18.513911] [ 18.513911] other info that might help us debug this: [ 18.513911] [ 18.513914] Possible unsafe locking scenario: [ 18.513914] [ 18.513916] CPU0 CPU1 [ 18.513918] ---- ---- [ 18.513920] lock(reservation_ww_class_mutex); [ 18.513922] lock(&dev->struct_mutex); [ 18.513924] lock(reservation_ww_class_mutex); [ 18.513927] lock(&dev->struct_mutex); [ 18.513929] [ 18.513929] *** DEADLOCK *** [ 18.513929] [ 18.513932] 3 locks held by insmod/655: [ 18.513933] #0: 000000004dccb591 (&dev->mutex){....}, at: device_driver_attach+0x18/0x50 [ 18.513938] #1: 000000009118ecae (&mm->mmap_sem#2){++++}, at: i915_driver_probe+0x8c8/0x1470 [i915] [ 18.513962] #2: 00000000a85ba8ec (reservation_ww_class_mutex){+.+.}, at: i915_driver_probe+0x8e1/0x1470 [i915] so Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Tested-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> -Chris _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel