Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shuicheng Lin" <shuicheng.lin@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v5 2/2] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory
Date: Tue, 01 Sep 2026 17:41:01 +0000	[thread overview]
Message-ID: <20260901174102.5C2111F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901173059.455469-3-shuicheng.lin@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Shrinker walk aborts entirely on a single unshrinkable BO, permanently wedging reclaim.
--

commit 42955bdd48d36fa90e0e98c5b4e8c6cdb3166430
Author: Shuicheng Lin <shuicheng.lin@intel.com>

drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory

This commit modifies the shrinker to take a runtime PM reference before
scanning TT memory, as shrinking non-system memory invalidates GPU mappings
which requires the device to be active. It queues a PM worker and halts the
walk if the device is suspended, and ensures the walk stops once the scan
target is met.

> diff --git a/drivers/gpu/drm/xe/xe_shrinker.c b/drivers/gpu/drm/xe/xe_shrinker.c
> index 7f40153911ffa..1bcbe764796e4 100644
> --- a/drivers/gpu/drm/xe/xe_shrinker.c
> +++ b/drivers/gpu/drm/xe/xe_shrinker.c
[ ... ]
> @@ -71,16 +73,32 @@ static s64 __xe_shrinker_walk(struct xe_device *xe,
[ ... ]
>  		ttm_bo_lru_for_each_reserved_guarded(&curs, man, &arg, ttm_bo) {
>  			if (!ttm_bo_shrink_suitable(ttm_bo, ctx))
>  				continue;
>  
>  			lret = xe_bo_shrink(ctx, ttm_bo, flags, scanned);
> -			if (lret < 0)
> -				return freed ? freed : lret;
> +			if (lret < 0) {
> +				if (!freed)
> +					freed = lret;
> +				goto out;
> +			}

[Severity: High]
This is a pre-existing issue, but does this error handling permanently wedge
memory reclaim?

If the first BO on the LRU is not purgeable during a purge pass, or is not
eviction valuable, xe_bo_shrink() returns -EBUSY. __xe_shrinker_walk() then
immediately aborts the LRU walk via this 'goto out' path (and previously via
the direct return) instead of skipping the BO and continuing the walk.

Since the unshrinkable BO is not moved to the LRU tail, subsequent shrinker
invocations will repeatedly encounter the exact same BO, abort, and return
SHRINK_STOP without making any progress. Should this continue the loop on
-EBUSY rather than aborting the entire walk?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901173059.455469-1-shuicheng.lin@intel.com?part=2

  reply	other threads:[~2026-09-01 17:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 17:30 [PATCH v5 0/2] drm/xe/shrinker: Runtime PM and freed page accounting fixes Shuicheng Lin
2026-09-01 17:30 ` [PATCH v5 1/2] drm/xe/shrinker: Do not discard freed pages on error Shuicheng Lin
2026-09-01 17:42   ` sashiko-bot
2026-09-01 17:30 ` [PATCH v5 2/2] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory Shuicheng Lin
2026-09-01 17:41   ` sashiko-bot [this message]
2026-09-01 17:37 ` ✗ CI.checkpatch: warning for drm/xe/shrinker: Runtime PM and freed page accounting fixes Patchwork
2026-09-01 17:39 ` ✓ CI.KUnit: success " Patchwork
2026-09-01 18:21 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-01 20:12 ` ✗ Xe.CI.FULL: failure " Patchwork

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=20260901174102.5C2111F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shuicheng.lin@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