Bug 112114

Summary: [CI][SHARDS] igt@gem_tiled_blits@interruptible - dmesg-warn - WARNING: possible circular locking dependency detected, acquire lock: unmap_mapping_pages, holding lock: i915_gem_shrink
Product: DRI Reporter: Lakshmi <lakshminarayana.vudum>
Component: DRM/IntelAssignee: Intel GFX Bugs mailing list <intel-gfx-bugs>
Status: RESOLVED FIXED 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: KBL i915 features: GEM/Other

Description Lakshmi 2019-10-23 16:34:52 UTC
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7146/shard-kbl2/igt@gem_tiled_blits@interruptible.html
<4> [2071.218877] ======================================================
<4> [2071.218881] WARNING: possible circular locking dependency detected
<4> [2071.218885] 5.4.0-rc3-CI-CI_DRM_7146+ #1 Tainted: G     U           
<4> [2071.218888] ------------------------------------------------------
<4> [2071.218892] kswapd0/153 is trying to acquire lock:
<4> [2071.218895] ffff8882069f7600 (&mapping->i_mmap_rwsem){++++}, at: unmap_mapping_pages+0x48/0x130
<4> [2071.218905] 
but task is already holding lock:
<4> [2071.218908] ffff8881aff089a8 (&obj->mm.lock/1){+.+.}, at: i915_gem_shrink+0x3c2/0x5f0 [i915]
<4> [2071.218966] 
which lock already depends on the new lock.

<4> [2071.218969] 
the existing dependency chain (in reverse order) is:
<4> [2071.218972] 
-> #2 (&obj->mm.lock/1){+.+.}:
<4> [2071.218978]        __mutex_lock+0x9a/0x9d0
<4> [2071.219017]        __i915_gem_object_put_pages+0x3a/0x100 [i915]
<4> [2071.219054]        userptr_mn_invalidate_range_start+0xe9/0x110 [i915]
<4> [2071.219059]        __mmu_notifier_invalidate_range_start+0xa3/0x180
<4> [2071.219063]        unmap_vmas+0x143/0x150
<4> [2071.219066]        unmap_region+0xa3/0x100
<4> [2071.219068]        __do_munmap+0x25d/0x490
<4> [2071.219071]        __vm_munmap+0x6e/0xc0
<4> [2071.219073]        __x64_sys_munmap+0x12/0x20
<4> [2071.219077]        do_syscall_64+0x4f/0x210
<4> [2071.219080]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
<4> [2071.219082] 
-> #1 (mmu_notifier_invalidate_range_start){+.+.}:
<4> [2071.219087]        page_mkclean_one+0xda/0x210
<4> [2071.219090]        rmap_walk_file+0xff/0x260
<4> [2071.219093]        page_mkclean+0x9f/0xb0
<4> [2071.219096]        clear_page_dirty_for_io+0xa2/0x300
<4> [2071.219100]        mpage_submit_page+0x1a/0x70
<4> [2071.219103]        mpage_process_page_bufs+0xe7/0x110
<4> [2071.219106]        mpage_prepare_extent_to_map+0x1d2/0x2b0
<4> [2071.219109]        ext4_writepages+0x592/0x1230
<4> [2071.219111]        do_writepages+0x46/0xe0
<4> [2071.219115]        __filemap_fdatawrite_range+0xc6/0x100
<4> [2071.219118]        file_write_and_wait_range+0x3c/0x90
<4> [2071.219121]        ext4_sync_file+0x154/0x500
<4> [2071.219124]        do_fsync+0x33/0x60
<4> [2071.219127]        __x64_sys_fsync+0xb/0x10
<4> [2071.219129]        do_syscall_64+0x4f/0x210
<4> [2071.219132]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
<4> [2071.219135] 
-> #0 (&mapping->i_mmap_rwsem){++++}:
<4> [2071.219140]        __lock_acquire+0x1328/0x15d0
<4> [2071.219143]        lock_acquire+0xa7/0x1c0
<4> [2071.219146]        down_write+0x33/0x70
<4> [2071.219149]        unmap_mapping_pages+0x48/0x130
<4> [2071.219152]        truncate_cleanup_page+0xa1/0xd0
<4> [2071.219154]        truncate_inode_page+0x15/0x30
<4> [2071.219157]        shmem_undo_range+0x1d5/0x890
<4> [2071.219160]        shmem_truncate_range+0x11/0x30
<4> [2071.219196]        shmem_truncate+0x1a/0x40 [i915]
<4> [2071.219231]        i915_gem_shrink+0x57a/0x5f0 [i915]
<4> [2071.219266]        i915_gem_shrinker_scan+0x37/0xc0 [i915]
<4> [2071.219269]        do_shrink_slab+0x131/0x3f0
<4> [2071.219272]        shrink_slab+0xfd/0x2c0
<4> [2071.219275]        shrink_node+0xc7/0x420
<4> [2071.219278]        balance_pgdat+0x241/0x570
<4> [2071.219281]        kswapd+0x167/0x530
<4> [2071.219284]        kthread+0x119/0x130
<4> [2071.219287]        ret_from_fork+0x3a/0x50
<4> [2071.219289] 
other info that might help us debug this:

<4> [2071.219292] Chain exists of:
  &mapping->i_mmap_rwsem --> mmu_notifier_invalidate_range_start --> &obj->mm.lock/1

<4> [2071.219299]  Possible unsafe locking scenario:

<4> [2071.219301]        CPU0                    CPU1
<4> [2071.219303]        ----                    ----
<4> [2071.219305]   lock(&obj->mm.lock/1);
<4> [2071.219308]                                lock(mmu_notifier_invalidate_range_start);
<4> [2071.219311]                                lock(&obj->mm.lock/1);
<4> [2071.219314]   lock(&mapping->i_mmap_rwsem);
<4> [2071.219316]
Comment 1 CI Bug Log 2019-10-23 16:35:36 UTC
The CI Bug Log issue associated to this bug has been updated.

### New filters associated

* KBL: igt@gem_tiled_blits@interruptible - dmesg-warn - WARNING: possible circular locking dependency detected, acquire lock: unmap_mapping_pages, holding lock: i915_gem_shrink
  - https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_5206/shard-kbl4/igt@gem_tiled_blits@interruptible.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7146/shard-kbl2/igt@gem_tiled_blits@interruptible.html
  - https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7151/shard-kbl3/igt@gem_tiled_blits@interruptible.html
Comment 2 Chris Wilson 2019-10-23 16:39:36 UTC
commit 7867d709959927e5df04a34f98880e5e394b411d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Oct 22 15:45:01 2019 +0100

    drm/i915/gem: Distinguish each object type
    
    Separate each object class into a separate lock type to avoid lockdep
    cross-contamination between paths (i.e. userptr!).
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Matthew Auld <matthew.auld@intel.com>
    Reviewed-by: Matthew Auld <matthew.auld@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191022144501.26486-1-chris@chris-wilson.co.uk

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.