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>,
	"Matthew Auld" <matthew.auld@intel.com>
Subject: [PATCH v3 0/2] drm/xe: Fix two bo pin/unpin accounting bugs
Date: Fri,  2 Oct 2026 12:08:28 +0200	[thread overview]
Message-ID: <20261002100830.12297-1-thomas.hellstrom@linux.intel.com> (raw)

Two independent fixes uncovered while auditing the bo pin/unpin and
shrinker accounting paths:

1/2 fixes a double-subtraction of the shrinker's page/object
accounting on nested xe_bo_pin_external()/xe_bo_unpin_external()
calls, which can desynchronize the shrinker's counts from reality and,
due to a signed-to-unsigned interpretation in xe_shrinker_count(),
turn into a huge bogus shrinkable/purgeable page count that causes the
shrinker to be invoked excessively under memory pressure.

2/2 fixes a stale xe->pinned.late.external list entry left behind when
a bo pinned both externally and as an fb has its final unpin performed
via the fb-pin path, which bypasses pinned_link maintenance and can
lead to list corruption or a use-after-free once the bo is freed.

Both are tagged for stable.

v2:
- Added 2/2, fixing a stale pinned_link entry found by Sashiko AI
  review.
- Minor cleanup in 1/2.

v3:
- Fixed an additional shrinker accounting underflow in 1/2, affecting
  imported dma-bufs, found by Sashiko AI review.
- Rebased 2/2 on top of 1/2's changes.

Thomas Hellström (2):
  drm/xe: Fix shrinker accounting double-subtraction on nested external
    pins
  drm/xe: Fix stale pinned_link entry when fb-pin performs the final
    unpin

 drivers/gpu/drm/xe/display/xe_fb_pin.c |   6 +-
 drivers/gpu/drm/xe/xe_bo.c             | 139 +++++++++++++++++++------
 drivers/gpu/drm/xe/xe_bo.h             |   2 +
 3 files changed, 110 insertions(+), 37 deletions(-)

-- 
2.55.0


             reply	other threads:[~2026-10-02 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 10:08 Thomas Hellström [this message]
2026-10-02 10:08 ` [PATCH v3 1/2] drm/xe: Fix shrinker accounting double-subtraction on nested external pins Thomas Hellström
2026-10-05  9:24   ` Ghimiray, Himal Prasad
2026-10-02 10:08 ` [PATCH v3 2/2] drm/xe: Fix stale pinned_link entry when fb-pin performs the final unpin Thomas Hellström
2026-10-05  9:29   ` Ghimiray, Himal Prasad
2026-10-02 10:16 ` ✓ CI.KUnit: success for drm/xe: Fix two bo pin/unpin accounting bugs (rev2) Patchwork
2026-10-05  7:51 ` ✓ CI.KUnit: success for drm/xe: Fix two bo pin/unpin accounting bugs (rev3) Patchwork
2026-10-05  8:55 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-05 10:41 ` ✓ 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=20261002100830.12297-1-thomas.hellstrom@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@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