[linux-next-20170523] possible circular locking dependency detected
From: Sergey Senozhatsky
Date: Tue May 23 2017 - 10:15:09 EST
Hello,
[ 9.610781] ======================================================
[ 9.610784] WARNING: possible circular locking dependency detected
[ 9.610789] 4.12.0-rc2-next-20170523-dbg-dirty #231 Not tainted
[ 9.610791] ------------------------------------------------------
[ 9.610795] Xorg/341 is trying to acquire lock:
[ 9.610798] (cpu_hotplug_lock.rw_sem){++++++}, at: [<ffffffff8104c4ba>] apply_wqattrs_lock+0x9/0x19
[ 9.610816]
but task is already holding lock:
[ 9.610818] (&dev_priv->mm_lock){+.+.+.}, at: [<ffffffff81312e75>] i915_gem_userptr_init__mmu_notifier+0x85/0x213
[ 9.610834]
which lock already depends on the new lock.
[ 9.610837]
the existing dependency chain (in reverse order) is:
[ 9.610839]
-> #5 (&dev_priv->mm_lock){+.+.+.}:
[ 9.610854] lock_acquire+0x46/0x60
[ 9.610861] __mutex_lock+0x90/0x7b5
[ 9.610867] mutex_lock_nested+0x16/0x18
[ 9.610872] i915_gem_userptr_init__mmu_notifier+0x85/0x213
[ 9.610878] i915_gem_userptr_ioctl+0x1cd/0x2b6
[ 9.610884] drm_ioctl+0x258/0x373
[ 9.610893] vfs_ioctl+0x13/0x2f
[ 9.610899] do_vfs_ioctl+0x5eb/0x5fe
[ 9.610905] SyS_ioctl+0x3e/0x5c
[ 9.610913] entry_SYSCALL_64_fastpath+0x18/0xad
[ 9.610915]
-> #4 (&mm->mmap_sem){++++++}:
[ 9.610926] lock_acquire+0x46/0x60
[ 9.610933] __might_fault+0x5c/0x7f
[ 9.610939] filldir+0xb3/0x125
[ 9.610947] call_filldir+0xb9/0xde
[ 9.610952] ext4_readdir+0x1ff/0x676
[ 9.610958] iterate_dir+0x93/0x13d
[ 9.610964] SyS_getdents+0xa4/0x117
[ 9.610971] entry_SYSCALL_64_fastpath+0x18/0xad
[ 9.610973]
-> #3 (&type->i_mutex_dir_key#2){++++++}:
[ 9.610986] lock_acquire+0x46/0x60
[ 9.610992] down_read+0x39/0x5d
[ 9.610997] lookup_slow+0x7c/0x17f
[ 9.611002] walk_component+0xcd/0x214
[ 9.611007] link_path_walk+0xfa/0x44a
[ 9.611013] path_openat+0x213/0x6f9
[ 9.611018] do_filp_open+0x48/0x9e
[ 9.611024] file_open_name+0xe7/0xe9
[ 9.611028] filp_open+0x2d/0x44
[ 9.611032] kernel_read_file_from_path+0x33/0x6c
[ 9.611039] _request_firmware+0x39d/0x629
[ 9.611044] request_firmware_work_func+0x23/0x55
[ 9.611049] process_one_work+0x1c3/0x323
[ 9.611055] worker_thread+0x1ee/0x2c0
[ 9.611060] kthread+0x127/0x12f
[ 9.611064] ret_from_fork+0x2e/0x40
[ 9.611066]
-> #2 (umhelper_sem){++++.+}:
[ 9.611077] lock_acquire+0x46/0x60
[ 9.611083] down_read+0x39/0x5d
[ 9.611088] usermodehelper_read_trylock+0x51/0x100
[ 9.611092] _request_firmware+0x2dc/0x629
[ 9.611097] request_firmware_direct+0x36/0x48
[ 9.611103] request_microcode_fw+0x54/0x88
[ 9.611107] reload_store+0xaa/0x114
[ 9.611114] dev_attr_store+0x14/0x1e
[ 9.611121] sysfs_kf_write+0x44/0x4b
[ 9.611127] kernfs_fop_write+0x117/0x161
[ 9.611132] __vfs_write+0x21/0xe7
[ 9.611137] vfs_write+0xdc/0x165
[ 9.611142] SyS_write+0x4c/0x89
[ 9.611149] entry_SYSCALL_64_fastpath+0x18/0xad
[ 9.611151]
-> #1 (microcode_mutex){+.+.+.}:
[ 9.611162] lock_acquire+0x46/0x60
[ 9.611167] __mutex_lock+0x90/0x7b5
[ 9.611173] mutex_lock_nested+0x16/0x18
[ 9.611181] microcode_init+0xb8/0x1d7
[ 9.611187] do_one_initcall+0x8b/0x121
[ 9.611192] kernel_init_freeable+0x139/0x1c2
[ 9.611197] kernel_init+0x9/0xe6
[ 9.611201] ret_from_fork+0x2e/0x40
[ 9.611203]
-> #0 (cpu_hotplug_lock.rw_sem){++++++}:
[ 9.611214] __lock_acquire+0xec4/0x1444
[ 9.611219] lock_acquire+0x46/0x60
[ 9.611226] get_online_cpus+0x38/0x98
[ 9.611231] apply_wqattrs_lock+0x9/0x19
[ 9.611237] apply_workqueue_attrs+0x15/0x2f
[ 9.611244] __alloc_workqueue_key+0x2b2/0x457
[ 9.611250] i915_gem_userptr_init__mmu_notifier+0xfb/0x213
[ 9.611255] i915_gem_userptr_ioctl+0x1cd/0x2b6
[ 9.611260] drm_ioctl+0x258/0x373
[ 9.611266] vfs_ioctl+0x13/0x2f
[ 9.611272] do_vfs_ioctl+0x5eb/0x5fe
[ 9.611278] SyS_ioctl+0x3e/0x5c
[ 9.611284] entry_SYSCALL_64_fastpath+0x18/0xad
[ 9.611287]
other info that might help us debug this:
[ 9.611290] Chain exists of:
cpu_hotplug_lock.rw_sem --> &mm->mmap_sem --> &dev_priv->mm_lock
[ 9.611301] Possible unsafe locking scenario:
[ 9.611304] CPU0 CPU1
[ 9.611306] ---- ----
[ 9.611308] lock(&dev_priv->mm_lock);
[ 9.611314] lock(&mm->mmap_sem);
[ 9.611319] lock(&dev_priv->mm_lock);
[ 9.611324] lock(cpu_hotplug_lock.rw_sem);
[ 9.611329]
*** DEADLOCK ***
[ 9.611333] 2 locks held by Xorg/341:
[ 9.611336] #0: (&mm->mmap_sem){++++++}, at: [<ffffffff81312e62>] i915_gem_userptr_init__mmu_notifier+0x72/0x213
[ 9.611348] #1: (&dev_priv->mm_lock){+.+.+.}, at: [<ffffffff81312e75>] i915_gem_userptr_init__mmu_notifier+0x85/0x213
[ 9.611359]
stack backtrace:
[ 9.611365] CPU: 1 PID: 341 Comm: Xorg Not tainted 4.12.0-rc2-next-20170523-dbg-dirty #231
[ 9.611369] Call Trace:
[ 9.611377] dump_stack+0x70/0x9a
[ 9.611384] print_circular_bug+0x272/0x280
[ 9.611389] __lock_acquire+0xec4/0x1444
[ 9.611396] ? __lock_is_held+0x47/0x7a
[ 9.611402] lock_acquire+0x46/0x60
[ 9.611408] ? lock_acquire+0x46/0x60
[ 9.611413] ? apply_wqattrs_lock+0x9/0x19
[ 9.611420] get_online_cpus+0x38/0x98
[ 9.611425] ? apply_wqattrs_lock+0x9/0x19
[ 9.611430] apply_wqattrs_lock+0x9/0x19
[ 9.611436] apply_workqueue_attrs+0x15/0x2f
[ 9.611443] __alloc_workqueue_key+0x2b2/0x457
[ 9.611449] ? lockdep_init_map+0xb4/0x1a2
[ 9.611456] i915_gem_userptr_init__mmu_notifier+0xfb/0x213
[ 9.611462] i915_gem_userptr_ioctl+0x1cd/0x2b6
[ 9.611467] drm_ioctl+0x258/0x373
[ 9.611473] ? i915_gem_userptr_dmabuf_export+0x1a/0x1a
[ 9.611480] ? _raw_spin_unlock+0x2c/0x3f
[ 9.611486] ? find_held_lock+0x31/0x77
[ 9.611493] ? __fget+0x157/0x186
[ 9.611500] vfs_ioctl+0x13/0x2f
[ 9.611506] do_vfs_ioctl+0x5eb/0x5fe
[ 9.611512] ? __fget+0x174/0x186
[ 9.611519] SyS_ioctl+0x3e/0x5c
[ 9.611527] entry_SYSCALL_64_fastpath+0x18/0xad
[ 9.611531] RIP: 0033:0x7f3398207cb7
[ 9.611535] RSP: 002b:00007fff8f086f88 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 9.611542] RAX: ffffffffffffffda RBX: 00007f339a2f6460 RCX: 00007f3398207cb7
[ 9.611545] RDX: 00007fff8f087030 RSI: 00000000c0186473 RDI: 000000000000000b
[ 9.611549] RBP: 00007fff8f087030 R08: 0000000001672010 R09: 000000000000007c
[ 9.611552] R10: 000000000000009f R11: 0000000000000246 R12: 0000000001671000
[ 9.611556] R13: 000000000000000b R14: 00007f339a2f6460 R15: 00007f339a2f6000
-ss