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>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	stable@vger.kernel.org, "Natalie Vock" <nat@pixelcluster.dev>,
	"Arun Pravin" <arunpravin.paneerselvam@amd.com>,
	"Matthew Auld" <matthew.auld@intel.com>,
	DRI-devel <dri-devel@lists.freedesktop.org>
Subject: [PATCH v3 2/3] drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM
Date: Thu,  3 Dec 2026 11:47:14 +0100	[thread overview]
Message-ID: <20261203104715.270111-3-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20261203104715.270111-1-thomas.hellstrom@linux.intel.com>

If evicting VRAM to system memory fails with -ENOMEM during runtime
suspend to D3cold, the error is returned to the runtime PM core.
Runtime PM treats any error other than -EAGAIN or -EBUSY from the
->runtime_suspend() callback as fatal, records it in
dev->power.runtime_error, and refuses further runtime PM operations
on the device until the error is cleared.

Memory shortage is a transient condition. Backup objects for pinned
BOs are already allocated with __GFP_RETRY_MAYFAIL, and a following
patch makes eviction of non-pinned BOs use it as well, which makes
-ENOMEM more likely to occur. Convert -ENOMEM from the eviction to
-EAGAIN so that the device stays active and runtime suspend is retried
at a later idle transition.

v2:
- Reword the commit message for the new patch order

v3:
- Rebase onto latest drm-tip

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.8+
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_pm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index 00d321a7d646..a7571cdc04dc 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -582,8 +582,16 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 
 	if (xe->d3cold.allowed) {
 		err = xe_bo_evict_all(xe);
-		if (err)
+		if (err) {
+			/*
+			 * Runtime PM treats errors other than -EAGAIN and
+			 * -EBUSY as fatal, so report memory shortage as
+			 * transient to allow a later retry.
+			 */
+			if (err == -ENOMEM)
+				err = -EAGAIN;
 			goto out_resume;
+		}
 	}
 
 	for_each_gt(gt, xe, id) {
-- 
2.56.1


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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Thomas Hellström [this message]
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-3-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 \
    --cc=stable@vger.kernel.org \
    /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