Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] drm/xe: Fix two bo pin/unpin accounting bugs
@ 2026-10-02 10:08 Thomas Hellström
  2026-10-02 10:08 ` [PATCH v3 1/2] drm/xe: Fix shrinker accounting double-subtraction on nested external pins Thomas Hellström
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Thomas Hellström @ 2026-10-02 10:08 UTC (permalink / raw)
  To: intel-xe; +Cc: Thomas Hellström, Matthew Brost, Matthew Auld

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-10-05 10:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02 10:08 [PATCH v3 0/2] drm/xe: Fix two bo pin/unpin accounting bugs Thomas Hellström
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox