Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Fix fs_reclaim deadlock caused by CCS save/restore
@ 2026-02-10 10:59 Satyanarayana K V P
  2026-02-10 10:59 ` [PATCH v3 1/3] drm/sa: Split drm_suballoc_new() into SA alloc and init helpers Satyanarayana K V P
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Satyanarayana K V P @ 2026-02-10 10:59 UTC (permalink / raw)
  To: intel-xe; +Cc: Satyanarayana K V P

CCS save/restore batch buffers are attached during BO allocation and
detached during BO teardown. The shrinker triggers xe_bo_move(), which is
used for both allocation and deletion paths.

When BO allocation and shrinking occur concurrently, a circular locking
dependency involving fs_reclaim and swap_guard can occur, leading to a
deadlock such as:

======================================================
WARNING: possible circular locking dependency detected
------------------------------------------------------

     CPU0                    CPU1
     ----                    ----
     lock(fs_reclaim);
                                  lock(&sa_manager->swap_guard);
                                  lock(fs_reclaim);
     lock(&sa_manager->swap_guard);

     *** DEADLOCK ***
=====================================================

To avoid this, the BB pointer and SA are allocated using xe_bb_alloc()
before taking lock and SA is initialized using xe_bb_init() preventing
reclaim from being invoked in this context.

V2 -> V3:
- Created new functions xe_sa_bo_alloc(), xe_sa_bo_release() and
xe_sa_bo_init(). (Thomas)
- Created new functions xe_bb_alloc(), xe_bb_release and
xe_bb_init(). (Thomas)
- Updated guard() to scoped_guard() in xe_migrate_ccs_rw_copy(). (Thomas)
- Removed timeout logic from drm_suballoc_init(). (Thomas & Christian).

V1 -> V2:
- Split drm_suballoc_new() into drm_suballoc_alloc() and
drm_suballoc_init() (Thomas).
- Used drm_suballoc_alloc() and drm_suballoc_init() for BB allocation
(Thomas).

Satyanarayana K V P (3):
  drm/sa: Split drm_suballoc_new() into SA alloc and init helpers
  drm/xe/vf: Fix fs_reclaim warning with CCS save/restore BB allocation
  drm/xe/sa: Add lockdep annotations for SA manager swap_guard

 drivers/gpu/drm/drm_suballoc.c  | 110 ++++++++++++++++++++++++++------
 drivers/gpu/drm/xe/xe_bb.c      |  49 +++++++++-----
 drivers/gpu/drm/xe/xe_bb.h      |   7 +-
 drivers/gpu/drm/xe/xe_migrate.c |  96 +++++++++++++++-------------
 drivers/gpu/drm/xe/xe_sa.c      |  46 +++++++++++++
 drivers/gpu/drm/xe/xe_sa.h      |   3 +
 include/drm/drm_suballoc.h      |   8 +++
 7 files changed, 238 insertions(+), 81 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-02-11 13:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 10:59 [PATCH v3 0/3] Fix fs_reclaim deadlock caused by CCS save/restore Satyanarayana K V P
2026-02-10 10:59 ` [PATCH v3 1/3] drm/sa: Split drm_suballoc_new() into SA alloc and init helpers Satyanarayana K V P
2026-02-10 12:09   ` Thomas Hellström
2026-02-11 13:32     ` Christian König
2026-02-11  0:20   ` Matthew Brost
2026-02-10 10:59 ` [PATCH v3 2/3] drm/xe/vf: Fix fs_reclaim warning with CCS save/restore BB allocation Satyanarayana K V P
2026-02-10 13:02   ` Michal Wajdeczko
2026-02-10 14:01     ` Thomas Hellström
2026-02-10 10:59 ` [PATCH v3 3/3] drm/xe/sa: Add lockdep annotations for SA manager swap_guard Satyanarayana K V P
2026-02-10 11:06 ` ✓ CI.KUnit: success for Fix fs_reclaim deadlock caused by CCS save/restore (rev3) Patchwork
2026-02-10 11:59 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-10 14:29 ` ✗ Xe.CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox