Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-xe@lists.freedesktop.org
Cc: DRI-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/3] drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM
Date: Thu, 03 Dec 2026 09:43:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-247491@kernel.org> (raw)
In-Reply-To: <20261203085321.235694-3-thomas.hellstrom@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe: -EAGAIN in xe_pm_runtime_suspend() self-retriggers
  OOM retry storm
--

commit 432d67d7cb644bed2d1d62b6cc14bc747772f450
Author: Thomas Hellström <thomas.hellstrom@linux.intel.com>

drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM

This commit converts -ENOMEM returned by xe_bo_evict_all() during D3cold
runtime suspend into -EAGAIN so the runtime PM core does not record a
permanent runtime error on the device.

> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index 103290fd6445c..f1dc97afb72a2 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -581,8 +581,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;
> +		}
>  	}

[Severity: Medium]
Can returning -EAGAIN here trigger an unbounded runtime suspend retry loop
while the GPU is idle under persistent memory pressure?

During xe_bo_evict_all(), evicting a BO on xe->pinned.late.external or
xe->pinned.late.kernel_bo_present submits a migration job via
xe_sched_job_create(), which calls xe_pm_runtime_get_noresume().  If a later
pinned BO hits -ENOMEM, xe_bo_evict_all_undo() discards all new backups.

When that migration job finishes, drm_sched_free_job_work() runs on the
scheduler submit_wq worker and calls xe_sched_job_destroy() ->
xe_pm_runtime_put().  Because current is not xe->pm_callback_task, it calls
pm_runtime_mark_last_busy() and pm_runtime_put() instead of the noidle path.

Because -EAGAIN leaves dev->power.runtime_error clear, that off-thread put
either refreshes last_busy before rpm_suspend() checks autosuspend expiration
or drops usage_count to zero after RPM_ACTIVE is restored and queues
RPM_REQ_IDLE.  Either way, autosuspend re-arms every autosuspend_delay_ms.

Each retry drives repeated __GFP_RETRY_MAYFAIL reclaim on a memory-starved
host, submits GPU copies whose backups are immediately undone, and runs full
display D3cold teardown and re-init via xe_display_disable_d3cold().  Falling
back to D3hot on -ENOMEM would avoid this self-retriggering loop.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203085321.235694-1-thomas.hellstrom@linux.intel.com?part=2

  reply	other threads:[~2026-12-03  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  8:53 [PATCH v2 0/3] drm/ttm, drm/xe: Handle VRAM eviction failure at suspend Thomas Hellström
2026-12-03  8:53 ` [PATCH v2 1/3] drm/xe: Undo pinned BO eviction on suspend failure Thomas Hellström
2026-12-03  8:53 ` [PATCH v2 2/3] drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM Thomas Hellström
2026-12-03  9:43   ` sashiko-bot [this message]
2026-12-03  8:53 ` [PATCH v2 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=sashiko-outbox-247491@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.hellstrom@linux.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