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
Subject: Re: [PATCH v4 1/4] drm/xe: Don't abort the shrinker walk on -EBUSY
Date: Fri, 16 Oct 2026 13:44:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-174395@kernel.org> (raw)
In-Reply-To: <20261016133523.3622-2-thomas.hellstrom@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] xe: loop termination check bypassed on -EBUSY causing unbounded shrinker scan
--

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

drm/xe: Don't abort the shrinker walk on -EBUSY

xe_bo_shrink() returns -EBUSY for bos that can't currently be shrunk.
The shrinker LRU walk treated any negative return value as fatal and
aborted. This commit changes it to skip bos for which xe_bo_shrink()
returns -EBUSY and continues the walk.

> diff --git a/drivers/gpu/drm/xe/xe_shrinker.c b/drivers/gpu/drm/xe/xe_shrinker.c
> index deb4378c1ec15..4e4da76936f49 100644
> --- a/drivers/gpu/drm/xe/xe_shrinker.c
> +++ b/drivers/gpu/drm/xe/xe_shrinker.c
> @@ -113,6 +113,9 @@ static int __xe_shrinker_walk(struct xe_shrinker *shrinker,
>  				continue;
>  
>  			lret = xe_bo_shrink(ctx, ttm_bo, flags, scanned);
> +			/* Like the TTM LRU walk, skip bos we can't shrink now. */
> +			if (lret == -EBUSY)
> +				continue;

[Severity: Medium]
Does this continue statement inadvertently bypass the loop termination check?

In xe_bo_shrink(), the scanned counter is incremented before potentially
returning -EBUSY:

xe_bo_shrink() {
	...
	*scanned += tt->num_pages;
	lret = ttm_bo_shrink(ctx, bo, ...);
	...
	return lret;
}

If a sequence of buffer objects return -EBUSY from ttm_bo_shrink(), could
this introduce a regression where the shrinker performs an unbounded scan
over the list because the *scanned >= to_scan check at the bottom of the
loop body is bypassed?

>  			if (lret < 0) {
>  				ret = lret;
>  				goto out;

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

  reply	other threads:[~2026-10-16 13:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 13:35 [PATCH v4 0/4] drm/xe: Adjust the bo shrinker batch size Thomas Hellström
2026-10-16 13:35 ` [PATCH v4 1/4] drm/xe: Don't abort the shrinker walk on -EBUSY Thomas Hellström
2026-10-16 13:44   ` sashiko-bot [this message]
2026-10-16 13:55   ` Matthew Brost
2026-10-16 13:35 ` [PATCH v4 2/4] drm/xe: Track number of populated ttm_tts in the shrinker Thomas Hellström
2026-10-16 14:26   ` Matthew Brost
2026-10-16 13:35 ` [PATCH v4 3/4] drm/xe: Split the bo shrinker into purgeable and non-purgeable shrinkers Thomas Hellström
2026-10-16 13:53   ` sashiko-bot
2026-10-16 14:09     ` Thomas Hellström
2026-10-16 18:41       ` Matthew Brost
2026-10-16 18:16   ` Matthew Brost
2026-10-16 13:35 ` [PATCH v4 4/4] drm/xe: Update non-purgeable shrinker batch size based on average BO size Thomas Hellström
2026-10-16 13:45   ` sashiko-bot
2026-10-16 14:06     ` Thomas Hellström
2026-10-16 18:42       ` Matthew Brost
2026-10-16 18:44   ` Matthew Brost
2026-10-16 13:45 ` ✓ CI.KUnit: success for drm/xe: Adjust the bo shrinker batch size (rev4) Patchwork
2026-10-16 14:37 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-16 22:14 ` ✓ Xe.CI.FULL: " 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=sashiko-outbox-174395@kernel.org \
    --to=sashiko-bot@kernel.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