From: sashiko-bot@kernel.org
To: "Shuicheng Lin" <shuicheng.lin@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v5] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory
Date: Tue, 01 Sep 2026 21:41:39 +0000 [thread overview]
Message-ID: <20260901214139.A06E61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901213331.458982-1-shuicheng.lin@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unbounded spinlock-held scan in LRU list iteration due to skipping entries without advancing the scan counter.
--
commit 63284e08ce6cb6db797af1075279023e72aafb0e
Author: Shuicheng Lin <shuicheng.lin@intel.com>
Subject: drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory
This commit updates the shrinker to take a runtime PM reference before walking
non-system memory LRU lists. This prevents invalidating GPU mappings while the
device is suspended, and also stops the walk once the scan target is met.
> diff --git a/drivers/gpu/drm/xe/xe_shrinker.c b/drivers/gpu/drm/xe/xe_shrinker.c
> --- a/drivers/gpu/drm/xe/xe_shrinker.c
> +++ b/drivers/gpu/drm/xe/xe_shrinker.c
[ ... ]
> @@ -71,16 +73,31 @@ 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;
[Severity: High]
This isn't a bug introduced by this patch, but is there a risk of an
unbounded spinlock-held scan here?
During memory reclaim, __xe_shrinker_walk() iterates over the GPU LRU lists
using ttm_bo_lru_for_each_reserved_guarded(), which acquires the lru_lock
spinlock. If an item is not suitable for shrinking (e.g., pinned or busy),
the loop skips it using continue without incrementing the *scanned counter.
Since *scanned is only incremented inside xe_bo_shrink(), skipping entries
bypasses the bound check entirely. Under high memory pressure with many
pinned or busy buffer objects, could this create an unbounded loop that
leads to soft lockups or CPU stalls?
>
> lret = xe_bo_shrink(ctx, ttm_bo, flags, scanned);
> - if (lret < 0)
> - return lret;
> + if (lret < 0) {
> + freed = lret;
> + goto out;
> + }
>
> freed += lret;
> if (*scanned >= to_scan)
> break;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901213331.458982-1-shuicheng.lin@intel.com?part=1
next prev parent reply other threads:[~2026-09-01 21:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 21:33 [PATCH v5] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory Shuicheng Lin
2026-09-01 21:41 ` sashiko-bot [this message]
2026-09-02 8:33 ` ✓ CI.KUnit: success for drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory (rev2) Patchwork
2026-09-02 9:45 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-02 18:15 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-04 15:03 ` [PATCH v5] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory Thomas Hellström
2026-09-04 20:36 ` Lin, Shuicheng
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=20260901214139.A06E61F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.