All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] drm/ttm, drm/xe: Support partially backed-up ttm_tts
@ 2026-11-04 20:13 Thomas Hellström
  2026-11-04 20:13 ` [PATCH 1/4] drm/ttm: Don't mark backed-up shmem folios accessed Thomas Hellström
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Thomas Hellström @ 2026-11-04 20:13 UTC (permalink / raw)
  To: intel-xe
  Cc: Thomas Hellström, Natalie Vock, Arun Pravin, Matthew Auld,
	Matthew Brost, Niranjana Vishwanathapura, dri-devel

The TTM shrinker backs up a ttm_tt page by page, and can stop part way
through, for example on an allocation failure. A failed restore can
likewise leave some pages resident and some backed up. The ttm_tt has no
way to represent such a partially backed-up state, so its status and the
driver's shrinker accounting can become inconsistent.

This series introduces TTM_TT_FLAG_PARTIAL, which allows a tt to be
partially backed up, keeping track of the pages that were already backed
up and the pages that are still resident. Xe shrinker accounting is
converted to track the number of remaining resident pages so that
partial tts are accounted correctly.

Patch 1 stops marking backed-up shmem folios accessed.
Patch 2 is a pure refactor of the Xe shrinker account helpers.
Patch 3 introduces TTM_TT_FLAG_PARTIAL and the matching Xe accounting.
Patch 4 gates reserve-dipping backup retries on may_writeback.

Note that patch 4 may increase the number of partially backed-up
ttm_tts, since a backup that would need to dip into the kernel reserves
is now aborted when writeback isn't allowed, keeping the progress made
so far. This makes the partial tt handling of patch 3 more important.

Testing:
- W=1 build, checkpatch and kernel-doc are clean.
- TTM and Xe KUnit tests pass.
- The partial backup and restore paths are exercised by the
  shrink-fault-inject* subtests of the xe_bo_shrink IGT test, posted
  separately, using the TTM backup_fault_inject debugfs attribute. They
  need CONFIG_FAULT_INJECTION and CONFIG_FAULT_INJECTION_DEBUG_FS. The
  may_writeback retry in patch 4 is only hit statistically by that test.

IGT test: https://patchwork.freedesktop.org/series/176563/

Test-with: 20261021123315.10033-1-thomas.hellstrom@linux.intel.com

AI tool use: an AI coding assistant was used for review and for
drafting parts of the implementation and commit messages. The author has
reviewed and takes responsibility for all of the changes.

Thomas Hellström (4):
  drm/ttm: Don't mark backed-up shmem folios accessed
  drm/xe/bo: Pass page and tt counts to the shrinker account helpers
  drm/ttm, drm/xe: Introduce TTM_TT_FLAG_PARTIAL for partially backed-up
    tts
  drm/ttm, drm/xe: Gate reserve-dipping backup retries on may_writeback

 drivers/gpu/drm/ttm/ttm_backup.c        |   1 -
 drivers/gpu/drm/ttm/ttm_bo.c            |   5 +-
 drivers/gpu/drm/ttm/ttm_bo_util.c       |   9 +-
 drivers/gpu/drm/ttm/ttm_pool.c          | 175 +++++++++++++++++++++---
 drivers/gpu/drm/ttm/ttm_pool_internal.h |   2 +
 drivers/gpu/drm/ttm/ttm_tt.c            |  36 ++++-
 drivers/gpu/drm/xe/tests/xe_bo.c        |   6 +-
 drivers/gpu/drm/xe/xe_bo.c              | 110 ++++++++++-----
 drivers/gpu/drm/xe/xe_bo.h              |   9 +-
 drivers/gpu/drm/xe/xe_shrinker.c        |  39 +++++-
 include/drm/ttm/ttm_bo.h                |   9 +-
 include/drm/ttm/ttm_tt.h                |  58 ++++++--
 12 files changed, 371 insertions(+), 88 deletions(-)

-- 
2.56.0


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

end of thread, other threads:[~2026-11-05  5:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 20:13 [PATCH 0/4] drm/ttm, drm/xe: Support partially backed-up ttm_tts Thomas Hellström
2026-11-04 20:13 ` [PATCH 1/4] drm/ttm: Don't mark backed-up shmem folios accessed Thomas Hellström
2026-11-04 20:13 ` [PATCH 2/4] drm/xe/bo: Pass page and tt counts to the shrinker account helpers Thomas Hellström
2026-11-04 20:13 ` [PATCH 3/4] drm/ttm, drm/xe: Introduce TTM_TT_FLAG_PARTIAL for partially backed-up tts Thomas Hellström
2026-11-04 20:47   ` sashiko-bot
2026-11-05  4:50   ` kernel test robot
2026-11-04 20:13 ` [PATCH 4/4] drm/ttm, drm/xe: Gate reserve-dipping backup retries on may_writeback Thomas Hellström
2026-11-04 20:41   ` sashiko-bot
2026-11-04 20:23 ` ✓ CI.KUnit: success for drm/ttm, drm/xe: Support partially backed-up ttm_tts Patchwork
2026-11-04 20:57 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-05  4:36 ` ✓ CI.KUnit: success for drm/ttm, drm/xe: Support partially backed-up ttm_tts (rev2) Patchwork
2026-11-05  5:13 ` ✓ Xe.CI.BAT: " Patchwork

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.