lockdep splat: recursive locking in get_pages() vs shrinker
This is one I've not seen before.. showed up w/ WIP igt gem-shrinker test.
[ 583.133138] ============================================
[ 583.138619] WARNING: possible recursive locking detected
[ 583.144098] 5.18.0-rc2-debug+ #312 Not tainted
[ 583.148685] --------------------------------------------
[ 583.154163] msm_gem_shrink/1371 is trying to acquire lock:
[ 583.159821] ffffff80826dc1a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: msm_gem_lock.isra.0+0x14/0x20 [msm]
[ 583.170479]
[ 583.170479] but task is already holding lock:
[ 583.176496] ffffff8104fb65a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: msm_gem_fault+0x54/0x170 [msm]
[ 583.186708]
[ 583.186708] other info that might help us debug this:
[ 583.193498] Possible unsafe locking scenario:
[ 583.193498]
[ 583.199608] CPU0
[ 583.202143] ----
[ 583.204676] lock(reservation_ww_class_mutex);
[ 583.209362] lock(reservation_ww_class_mutex);
[ 583.214040]
[ 583.214040] *** DEADLOCK ***
[ 583.214040]
[ 583.220147] May be due to missing lock nesting notation
[ 583.220147]
[ 583.227154] 4 locks held by msm_gem_shrink/1371:
[ 583.231921] #0: ffffff80f836aed8 (&mm->mmap_lock){++++}-{3:3}, at: do_page_fault+0x3c4/0x4dc
[ 583.240732] #1: ffffff8104fb65a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: msm_gem_fault+0x54/0x170 [msm]
[ 583.251379] #2: ffffffed8d1795a0 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages+0x54c/0xeb8
[ 583.259839] #3: ffffffed8d153bf0 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab.constprop.0+0xa0/0x598
[ 583.269469]
[ 583.269469] stack backtrace:
[ 583.273977] CPU: 7 PID: 1371 Comm: msm_gem_shrink Not tainted 5.18.0-rc2-debug+ #312
[ 583.281965] Hardware name: Google Lazor (rev1 - 2) with LTE (DT)
[ 583.288162] Call trace:
[ 583.290696] dump_backtrace.part.0+0x164/0x1b0
[ 583.295292] show_stack+0x24/0x3c
[ 583.298726] dump_stack_lvl+0xb4/0xe8
[ 583.302519] dump_stack+0x1c/0x38
[ 583.305952] __lock_acquire+0x950/0x1720
[ 583.310007] lock_acquire+0x2b8/0x3ec
[ 583.313797] __ww_mutex_lock.constprop.0+0x174/0xb7c
[ 583.318925] ww_mutex_lock+0x7c/0x124
[ 583.322721] msm_gem_lock.isra.0+0x14/0x20 [msm]
[ 583.327804] msm_gem_free_object+0x104/0x22c [msm]
[ 583.333076] drm_gem_object_free+0x58/0x5c
[ 583.337329] scan+0x314/0x35c [msm]
[ 583.341271] msm_gem_shrinker_scan+0x5c/0x2b4 [msm]
[ 583.346626] shrink_slab.constprop.0+0x330/0x598
[ 583.351404] shrink_node+0x33c/0x684
[ 583.355097] try_to_free_pages+0x50c/0x77c
[ 583.359335] __alloc_pages+0x588/0xeb8
[ 583.363223] shmem_alloc_page+0x94/0xcc
[ 583.367207] shmem_alloc_and_acct_page+0xc0/0xe0
[ 583.371974] shmem_getpage_gfp+0x300/0x694
[ 583.376214] shmem_read_mapping_page_gfp+0xdc/0x138
[ 583.381253] drm_gem_get_pages+0x144/0x290
[ 583.385483] get_pages+0xc4/0x304 [msm]
[ 583.389769] msm_gem_fault+0x12c/0x170 [msm]
[ 583.394498] __do_fault+0x64/0xd0
[ 583.397937] __handle_mm_fault+0x8fc/0xa48
[ 583.402175] handle_mm_fault+0xa0/0x168
[ 583.406145] do_page_fault+0x214/0x4dc
[ 583.410025] do_translation_fault+0x50/0x70
[ 583.414366] do_mem_abort+0x64/0xf0
[ 583.417978] el0_da+0x8c/0x130
[ 583.421142] el0t_64_sync_handler+0xd4/0x158
[ 583.425553] el0t_64_sync+0x18c/0x190