Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Natalie Vock" <nat@pixelcluster.dev>,
	"Arun Pravin" <arunpravin.paneerselvam@amd.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	DRI-devel <dri-devel@lists.freedesktop.org>
Subject: [PATCH v3 0/3] drm/ttm, drm/xe: Handle VRAM eviction failure at suspend
Date: Thu,  3 Dec 2026 11:47:12 +0100	[thread overview]
Message-ID: <20261203104715.270111-1-thomas.hellstrom@linux.intel.com> (raw)

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


             reply	other threads:[~2026-12-03 10:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 10:47 Thomas Hellström [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203104715.270111-1-thomas.hellstrom@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=nat@pixelcluster.dev \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox