Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix fs_reclaim deadlock caused by CCS save/restore
@ 2026-02-04 16:46 Satyanarayana K V P
  2026-02-04 16:46 ` [PATCH v2 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; 17+ messages in thread
From: Satyanarayana K V P @ 2026-02-04 16:46 UTC (permalink / raw)
  To: intel-xe; +Cc: Satyanarayana K V P

CCS save/restore batch buffers are currently attached during BO allocation
and detached during BO teardown. The shrinker also 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 allocation is separated from xe_bb_ccs_new(),
used drm_suballoc_alloc() for SA allocation and drm_suballoc_init() for BB
allocation preventing reclaim from being invoked in this context.

---
V1 -> V2:
- Splitted 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/sa: Add lockdep annotations for SA manager swap_guard
  drm/xe/vf: Fix fs_reclaim warning with CCS save/restore BB allocation

 drivers/gpu/drm/drm_suballoc.c  | 135 ++++++++++++++++++++++++--------
 drivers/gpu/drm/xe/xe_bb.c      |  22 ++----
 drivers/gpu/drm/xe/xe_bb.h      |   4 +-
 drivers/gpu/drm/xe/xe_migrate.c |  29 ++++++-
 drivers/gpu/drm/xe/xe_sa.c      |  30 +++++++
 drivers/gpu/drm/xe/xe_sa.h      |  19 +++++
 include/drm/drm_suballoc.h      |   8 ++
 7 files changed, 196 insertions(+), 51 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-02-09 17:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 16:46 [PATCH v2 0/3] Fix fs_reclaim deadlock caused by CCS save/restore Satyanarayana K V P
2026-02-04 16:46 ` [PATCH v2 1/3] drm/sa: Split drm_suballoc_new() into SA alloc and init helpers Satyanarayana K V P
2026-02-04 19:45   ` Matthew Brost
2026-02-06 12:34   ` Thomas Hellström
2026-02-06 15:27     ` Christian König
2026-02-04 16:46 ` [PATCH v2 2/3] drm/xe/sa: Add lockdep annotations for SA manager swap_guard Satyanarayana K V P
2026-02-04 19:11   ` Matthew Brost
2026-02-06 16:17   ` Thomas Hellström
2026-02-06 18:28     ` Matthew Brost
2026-02-09  9:09       ` Thomas Hellström
2026-02-09 17:07         ` Matthew Brost
2026-02-04 16:46 ` [PATCH v2 3/3] drm/xe/vf: Fix fs_reclaim warning with CCS save/restore BB allocation Satyanarayana K V P
2026-02-04 19:18   ` Matthew Brost
2026-02-06 12:49   ` Thomas Hellström
2026-02-05  2:49 ` ✓ CI.KUnit: success for Fix fs_reclaim deadlock caused by CCS save/restore (rev2) Patchwork
2026-02-05  3:24 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-05 18:34 ` ✓ Xe.CI.FULL: " Patchwork

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