igt@gen3_render_mixed_blits - dmesg-warn - WARNING: possible circular locking dependency detected, is trying to acquire lock at: unmap_mapping_pages but task is already holding lock at: i915_vma_pin
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_506/fi-gdg-551/igt@gen3_render_mixed_blits.html
4> [194.734880] ======================================================
<4> [194.734886] WARNING: possible circular locking dependency detected
<4> [194.734893] 5.7.0-rc7-gcd4a9b47339259-drmtip_506+ #1 Not tainted
<4> [194.734899] ------------------------------------------------------
<4> [194.734905] gen3_render_mix/1071 is trying to acquire lock:
<4> [194.734912] ffff8880249feff8 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: unmap_mapping_pages+0x48/0x130
<4> [194.734929]
but task is already holding lock:
<4> [194.734935] ffff88802b4c9dc0 (&vm->mutex/1){+.+.}-{3:3}, at: i915_vma_pin+0x11a/0x10f0 [i915]
<4> [194.735113]
which lock already depends on the new lock.
<4> [194.735120]
the existing dependency chain (in reverse order) is:
<4> [194.735127]
-> #2 (&vm->mutex/1){+.+.}-{3:3}:
<4> [194.735138] __mutex_lock+0x9a/0x9c0
<4> [194.735255] i915_vma_unbind+0x64/0x120 [i915]
<4> [194.735368] i915_gem_object_unbind+0x1d0/0x410 [i915]
<4> [194.735483] userptr_mn_invalidate_range_start+0xdd/0x190 [i915]
<4> [194.735494] __mmu_notifier_invalidate_range_start+0x13d/0x250
<4> [194.735502] unmap_vmas+0x13e/0x150
<4> [194.735508] unmap_region+0xa3/0x100
<4> [194.735514] __do_munmap+0x26d/0x490
<4> [194.735519] __vm_munmap+0x66/0xc0
<4> [194.735525] __x64_sys_munmap+0x12/0x20
<4> [194.735532] do_syscall_64+0x4f/0x220
<4> [194.735539] entry_SYSCALL_64_after_hwframe+0x49/0xb3
<4> [194.735545]
-> #1 (mmu_notifier_invalidate_range_start){+.+.}-{0:0}:
<4> [194.735557] page_mkclean_one+0xe4/0x220
<4> [194.735564] rmap_walk_file+0x18e/0x3a0
<4> [194.735570] page_mkclean+0xb4/0xe0
<4> [194.735578] clear_page_dirty_for_io+0xd4/0x3a0
<4> [194.735586] mpage_submit_page+0x1a/0x70
<4> [194.735592] mpage_process_page_bufs+0xe7/0x110
<4> [194.735599] mpage_prepare_extent_to_map+0x223/0x370
<4> [194.735606] ext4_writepages+0x516/0x11c0
<4> [194.735612] do_writepages+0x46/0xe0
<4> [194.735618] __filemap_fdatawrite_range+0xc6/0x100
<4> [194.735625] file_write_and_wait_range+0x3c/0x90
<4> [194.735633] ext4_sync_file+0x1a4/0x4e0
<4> [194.735640] do_fsync+0x33/0x60
<4> [194.735646] __x64_sys_fsync+0xb/0x10
<4> [194.735652] do_syscall_64+0x4f/0x220
<4> [194.735659] entry_SYSCALL_64_after_hwframe+0x49/0xb3
<4> [194.735665]
-> #0 (&mapping->i_mmap_rwsem){++++}-{3:3}:
<4> [194.735676] __lock_acquire+0x196f/0x1f50
<4> [194.735682] lock_acquire+0xb5/0x3b0
<4> [194.735688] down_write+0x33/0x70
<4> [194.735694] unmap_mapping_pages+0x48/0x130
<4> [194.735811] i915_vma_revoke_mmap.part.37+0x59/0x120 [i915]
<4> [194.735929] __i915_vma_evict+0x160/0x3e0 [i915]
<4> [194.736046] __i915_vma_unbind+0x59/0x110 [i915]
<4> [194.736161] i915_gem_evict_for_node+0x4dd/0x5e0 [i915]
<4> [194.736276] i915_gem_gtt_reserve+0xfb/0x2f0 [i915]
<4> [194.736390] i915_gem_gtt_insert+0x28c/0x6a0 [i915]
<4> [194.736508] i915_vma_pin+0xb05/0x10f0 [i915]
<4> [194.736617] i915_gem_do_execbuffer+0xb4f/0x2eb0 [i915]
<4> [194.736727] i915_gem_execbuffer2_ioctl+0x116/0x4e0 [i915]
<4> [194.736736] drm_ioctl_kernel+0xb0/0xf0
<4> [194.736743] drm_ioctl+0x305/0x3c0
<4> [194.736749] ksys_ioctl+0x7b/0x90
<4> [194.736755] __x64_sys_ioctl+0x11/0x20
<4> [194.736761] do_syscall_64+0x4f/0x220
<4> [194.736768] entry_SYSCALL_64_after_hwframe+0x49/0xb3
<4> [194.736774]
other info that might help us debug this:
<4> [194.736784] Chain exists of:
&mapping->i_mmap_rwsem --> mmu_notifier_invalidate_range_start --> &vm->mutex/1
<4> [194.736799] Possible unsafe locking scenario:
<4> [194.736806] CPU0 CPU1
<4> [194.736811] ---- ----
<4> [194.736816] lock(&vm->mutex/1);
<4> [194.736821] lock(mmu_notifier_invalidate_range_start);
<4> [194.736830] lock(&vm->mutex/1);
<4> [194.736836] lock(&mapping->i_mmap_rwsem);
<4> [194.736842]
*** DEADLOCK **
Edited by LAKSHMINARAYANA VUDUM