From: Vitaly Prosyak <[email protected]>

This series fixes a lockdep false positive warning that occurs when memory
reclaim triggers MMU notifiers with amdgpu userptr buffers.

The root cause is that amdgpu_lockdep_init() was teaching lockdep the
incorrect lock ordering by calling fs_reclaim_acquire() while holding
notifier_lock. At runtime, memory reclaim establishes the opposite ordering,
creating a false circular dependency.

Patch 1 adds filelist_mutex to the lockdep hierarchy (preparation).
Patch 2 moves fs_reclaim registration before all locks to fix the false 
positive.

This is a 7.2-cycle regression fix suitable for stable backport.

Testing: Mikhail Gavrilov's reproducer (IGT amd_lockdep test) runs 8 reclaim
cycles with no warnings after the fix. Before fix: warning on first cycle.

v3 changes (addressing Mikhail Gavrilov's technical review):
  - Clarified that fs_reclaim_acquire/release pair only REGISTERS the
    fs_reclaim lock class when called with no locks held (doesn't create
    a static lockdep edge)
  - Explained that the actual fs_reclaim -> notifier_lock dependency is
    established at runtime when memory reclaim invokes MMU notifiers
  - Added Cc: Arunpravin PaneerSelvam

v2 changes:
  - Fixed author name: Michael -> Mikhail Gavrilov in all trailers
  - Added Fixes: tag linking to original commit
  - Added Tested-by: Mikhail Gavrilov
  - Rewrote fs_reclaim comment to be technically accurate
  - Noted this is a 7.2-cycle regression for stable routing

Vitaly Prosyak (2):
  drm/amdgpu: add filelist_mutex to lockdep lock ordering annotations
  drm/amdgpu: Fix lockdep false positive in amdgpu_lockdep_init

 drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c | 48 +++++++++++++++------
 1 file changed, 35 insertions(+), 13 deletions(-)

--
2.54.0

Reply via email to