Bug 111915

Summary: [CI][DRMTIP] ggtt vs userptr - dmesg-warn - WARNING: possible circular locking dependency detected
Product: DRI Reporter: Lakshmi <lakshminarayana.vudum>
Component: DRM/IntelAssignee: Intel GFX Bugs mailing list <intel-gfx-bugs>
Status: RESOLVED WORKSFORME QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: not set    
Priority: not set CC: intel-gfx-bugs
Version: DRI git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: ALL i915 features: GEM/Other

Description Lakshmi 2019-10-07 08:37:59 UTC
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-elk-e7500/igt@gem_mmap_gtt@basic-small-copy.html
<4> [42.467859] ======================================================
<4> [42.467863] WARNING: possible circular locking dependency detected
<4> [42.467869] 5.4.0-rc1-g78b99839aed8-drmtip_382+ #1 Tainted: G     U           
<4> [42.467874] ------------------------------------------------------
<4> [42.467878] kworker/u8:5/155 is trying to acquire lock:
<4> [42.467882] ffff8d348559dbb8 (&mapping->i_mmap_rwsem){++++}, at: unmap_mapping_pages+0x48/0x130
<4> [42.467893] 
but task is already holding lock:
<4> [42.467897] ffff8d34856093a0 (&vm->mutex){+.+.}, at: i915_vma_unbind+0xe6/0x4a0 [i915]
<4> [42.468015] 
which lock already depends on the new lock.

<4> [42.468019] 
the existing dependency chain (in reverse order) is:
<4> [42.468024] 
-> #2 (&vm->mutex){+.+.}:
<4> [42.468031]        __mutex_lock+0x9a/0x9d0
<4> [42.468089]        i915_vma_unbind+0xa4/0x4a0 [i915]
<4> [42.468146]        i915_gem_object_unbind+0x153/0x1c0 [i915]
<4> [42.468202]        userptr_mn_invalidate_range_start+0x9f/0x200 [i915]
<4> [42.468207]        __mmu_notifier_invalidate_range_start+0xa3/0x180
<4> [42.468212]        unmap_vmas+0x143/0x150
<4> [42.468216]        unmap_region+0xa3/0x100
<4> [42.468220]        __do_munmap+0x25d/0x490
<4> [42.468223]        __vm_munmap+0x6e/0xc0
<4> [42.468227]        __x64_sys_munmap+0x12/0x20
<4> [42.468231]        do_syscall_64+0x4f/0x210
<4> [42.468236]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
<4> [42.468240] 
-> #1 (mmu_notifier_invalidate_range_start){+.+.}:
<4> [42.468247]        page_mkclean_one+0xda/0x210
<4> [42.468251]        rmap_walk_file+0xff/0x260
<4> [42.468255]        page_mkclean+0x9f/0xb0
<4> [42.468259]        clear_page_dirty_for_io+0xa2/0x300
<4> [42.468264]        mpage_submit_page+0x1a/0x70
<4> [42.468268]        mpage_process_page_bufs+0xe7/0x110
<4> [42.468272]        mpage_prepare_extent_to_map+0x1d2/0x2b0
<4> [42.468277]        ext4_writepages+0x592/0x1230
<4> [42.468280]        do_writepages+0x46/0xe0
<4> [42.468285]        __filemap_fdatawrite_range+0xc6/0x100
<4> [42.468289]        file_write_and_wait_range+0x3c/0x90
<4> [42.468293]        ext4_sync_file+0x154/0x500
<4> [42.468298]        do_fsync+0x33/0x60
<4> [42.468302]        __x64_sys_fsync+0xb/0x10
<4> [42.468306]        do_syscall_64+0x4f/0x210
<4> [42.468309]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
<4> [42.468313] 
-> #0 (&mapping->i_mmap_rwsem){++++}:
<4> [42.468320]        __lock_acquire+0x1328/0x15d0
<4> [42.468324]        lock_acquire+0xa7/0x1c0
<4> [42.468328]        down_write+0x33/0x70
<4> [42.468332]        unmap_mapping_pages+0x48/0x130
<4> [42.468390]        i915_vma_revoke_mmap+0x81/0x1b0 [i915]
<4> [42.468448]        i915_vma_unbind+0xee/0x4a0 [i915]
<4> [42.468506]        i915_vma_destroy+0x31/0x2f0 [i915]
<4> [42.468561]        __i915_gem_free_objects+0xb8/0x4b0 [i915]
<4> [42.468567]        process_one_work+0x26a/0x620
<4> [42.468571]        worker_thread+0x37/0x380
<4> [42.468575]        kthread+0x119/0x130
<4> [42.468579]        ret_from_fork+0x3a/0x50
<4> [42.468582] 
other info that might help us debug this:

<4> [42.468587] Chain exists of:
  &mapping->i_mmap_rwsem --> mmu_notifier_invalidate_range_start --> &vm->mutex

<4> [42.468596]  Possible unsafe locking scenario:

<4> [42.468601]        CPU0                    CPU1
<4> [42.468604]        ----                    ----
<4> [42.468607]   lock(&vm->mutex);
<4> [42.468610]                                lock(mmu_notifier_invalidate_range_start);
<4> [42.468616]                                lock(&vm->mutex);
<4> [42.468620]   lock(&mapping->i_mmap_rwsem);
<4> [42.468624] 
 *** DEADLOCK ***
Comment 1 CI Bug Log 2019-10-07 08:38:32 UTC
The CI Bug Log issue associated to this bug has been updated.

### New filters associated

* All machines: igt@gem_mmap_gtt@basic-small-copy - dmesg-warn - WARNING: possible circular locking dependency detected
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-bdw-5557u/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-blb-e6850/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-byt-j1900/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-byt-n2820/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-cfl-8109u/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-cfl-8700k/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-cfl-guc/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-elk-e7500/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-gdg-551/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-glk-dsi/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-icl-dsi/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-ilk-650/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-ivb-3770/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-pnv-d510/igt@gem_mmap_gtt@basic-small-copy.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_382/fi-snb-2520m/igt@gem_mmap_gtt@basic-small-copy.html
Comment 2 Chris Wilson 2019-10-07 08:42:42 UTC
Same as bug 111891, except we have no recourse to aliasing-ppgtt, here only ggtt.
Comment 3 Francesco Balestrieri 2019-10-10 06:06:55 UTC
Duplicate then?
Comment 4 Chris Wilson 2019-10-10 13:24:09 UTC
(In reply to Francesco Balestrieri from comment #3)
> Duplicate then?

Possibly. I was keeping them separate just in case I could solve one but not the other. All solutions so far can be counted on the fingers of the Black Knight after a duel.
Comment 5 Francesco Balestrieri 2019-11-11 10:39:19 UTC
Happened once more than a month ago (though on all platforms at once?), closing.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.