Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] drm/ttm, drm/xe: Handle VRAM eviction failure at suspend
@ 2026-12-03 10:47 Thomas Hellström
  2026-12-03 10:47 ` [PATCH v3 1/3] drm/xe: Undo pinned BO eviction on suspend failure Thomas Hellström
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Hellström @ 2026-12-03 10:47 UTC (permalink / raw)
  To: intel-xe
  Cc: Thomas Hellström, Natalie Vock, Arun Pravin, Rodrigo Vivi,
	Matthew Auld, Matthew Brost, DRI-devel

When the amount of VRAM in use exceeds the free system memory, evicting
VRAM at suspend may invoke the OOM killer, and under heavy memory
pressure the system may hang [1].

Patch 3 avoids invoking the OOM killer by having the user BO eviction
use __GFP_RETRY_MAYFAIL, so that suspend is aborted with -ENOMEM
instead. That makes eviction failures more likely, which exposes two
pre-existing issues in the failure paths, fixed by patches 1 and 2:

Patch 1 undoes the eviction of pinned BOs if suspend fails partway.
Otherwise the device continues operating with stale backups, which a
later resume restores over the live VRAM contents. This was reported
by Sashiko on v1 of patch 2.

Patch 2 converts -ENOMEM from the eviction at runtime suspend to
-EAGAIN, since runtime PM otherwise treats the error as fatal and
stops runtime-suspending the device.

The patches are ordered so that no intermediate state makes the
failure paths more likely to be hit before they are fixed. Patch 2
depends on patch 1, since retrying runtime suspend would otherwise
restore stale pinned BO backups.

v2:
- Patches 2 and 3 were previously posted separately. Combined them
  into a series.
- Patch 1: New patch. Undo pinned BO eviction on suspend failure, a
  prerequisite for patch 2. Reported by Sashiko.
- Patch 2: Reworded the commit message for the new patch order.
- Patch 3: Rebased.

v3:
- Rebase onto latest drm-tip.

Testing:
- W=1 build and checkpatch are clean.

[1] https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9615

AI tool use: an AI coding assistant was used for review and for
drafting parts of the implementation and commit messages.

Thomas Hellström (3):
  drm/xe: Undo pinned BO eviction on suspend failure
  drm/xe: Don't fail runtime suspend permanently on VRAM eviction
    -ENOMEM
  drm/ttm, drm/xe: Don't invoke the OOM killer when evicting VRAM at
    suspend

 drivers/gpu/drm/ttm/ttm_resource.c | 37 +++++++++++++++++++------
 drivers/gpu/drm/xe/xe_bo.c         | 26 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_bo.h         |  1 +
 drivers/gpu/drm/xe/xe_bo_evict.c   | 44 ++++++++++++++++++++++++++----
 drivers/gpu/drm/xe/xe_bo_evict.h   |  1 +
 drivers/gpu/drm/xe/xe_device.c     |  5 +++-
 drivers/gpu/drm/xe/xe_pm.c         | 15 ++++++++--
 include/drm/ttm/ttm_resource.h     |  5 ++++
 8 files changed, 118 insertions(+), 16 deletions(-)

-- 
2.56.1


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

end of thread, other threads:[~2026-12-03 10:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 10:47 [PATCH v3 0/3] drm/ttm, drm/xe: Handle VRAM eviction failure at suspend Thomas Hellström
2026-12-03 10:47 ` [PATCH v3 1/3] drm/xe: Undo pinned BO eviction on suspend failure Thomas Hellström
2026-12-03 10:47 ` [PATCH v3 2/3] drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM Thomas Hellström
2026-12-03 10:47 ` [PATCH v3 3/3] drm/ttm, drm/xe: Don't invoke the OOM killer when evicting VRAM at suspend Thomas Hellström

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