Skip to content

Introduce purpose-specific VRAM pools

Piórkowski, Piotr intel-xe 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest7 patches 7 repliesIn review
  2. v37 patches 0 repliesSuperseded
  3. v27 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v17 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Guard the KUnit test includes with IS_BUILTIN() instead of IS_ENABLED(), so that the test suites are not built into xe.ko when the KUnit tests are built as a module (Sashiko).
- Rebase on current drm-tip

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7drm/xe: Define partitioned VRAM manager typesdrivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h+46 -02 replies
2/7drm/xe: Define VRAM regions and poolsdrivers/gpu/drm/xe/xe_vram_types.h+158 -15 replies
3/7drm/xe/vram: Make VRAM pools the allocation handledrivers/gpu/drm/xe/display/xe_fb_pin.c drivers/gpu/drm/xe/display/xe_initial_plane.c drivers/gpu/drm/xe/display/xe_panic.c +21 more+350 -1010 replies
4/7drm/xe/ttm: Back each VRAM pool with its own buddy allocatordrivers/gpu/drm/xe/xe_query.c drivers/gpu/drm/xe/xe_res_cursor.h drivers/gpu/drm/xe/xe_svm.c +3 more+370 -1310 replies
5/7drm/xe/vram: Allow splitting a region into poolsdrivers/gpu/drm/xe/xe_vram.c drivers/gpu/drm/xe/xe_vram.h+87 -30 replies
6/7drm/xe/kunit: Test partitioned VRAM managerdrivers/gpu/drm/xe/tests/xe_ttm_vram_mgr.c drivers/gpu/drm/xe/xe_ttm_vram_mgr.c+151 -00 replies
7/7drm/xe/kunit: Test VRAM pool allocationdrivers/gpu/drm/xe/tests/xe_vram.c drivers/gpu/drm/xe/xe_vram.c+181 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/7] Introduce purpose-specific VRAM pools

From: Piotr Piórkowski <[email protected]>

This series separates VRAM regions, which own physical resources, from VRAM pools, which represent allocation domains within those regions. A region can then be split into hard partitions for different purposes without requiring each allocation path to manage the physical range directly.

Each pool is backed by its own buddy allocator. BO creation and migration resolve the pool for an allocation consistently, and pool placement narrows caller-provided ranges while rejecting fixed placements that do not intersect the pool. VRAM usage and CPU-visible memory accounting are tracked per partition, and the PF reports free memory from the pool backing VF LMEM.

The series introduces the partition and pool types, routes allocations through pools, adds region splitting, and includes KUnit coverage for manager partitioning, accounting, pool setup, splitting, and TTM placement.

Normal initialization still uses one pool spanning each region’s usable range, so the new abstraction does not yet change allocation policy. The series also makes the VRAM manager handle lpfn == 0 according to TTM’s unbounded-range semantics.

v3 -> v4:
- Guard the KUnit test includes with IS_BUILTIN() instead of IS_ENABLED(), so that the test suites are not built into xe.ko when the KUnit tests are built as a module (Sashiko).
- Rebase on current drm-tip
v2 -> v3:
- Place fixed placements in the pool covering their address instead of the pool serving their purpose, so that e.g. the BIOS framebuffer takeover keeps working once a kernel pool is carved out (Sashiko).
- Assert that a kernel BO with a fixed address does not land outside the kernel pool on a PF without LMTT, where VFs could reach it.
- Add xe_vram_region_addr_to_pool() and KUnit coverage for it.
- Rebase on current drm-tip
v1 -> v2:
- Fix NULL pointer dereferences of the tile VRAM pool on integrated GPUs in the page fault path, tile asserts and debugfs (Sashiko).

Cc Matthew Brost <[email protected]>

Piotr Piórkowski (7):
drm/xe: Define partitioned VRAM manager types drm/xe: Define VRAM regions and pools
drm/xe/vram: Make VRAM pools the allocation handle drm/xe/ttm: Back each VRAM pool with its own buddy allocator drm/xe/vram: Allow splitting a region into pools drm/xe/kunit: Test partitioned VRAM manager drm/xe/kunit: Test VRAM pool allocation

 drivers/gpu/drm/xe/display/xe_fb_pin.c        |   2 +-
 drivers/gpu/drm/xe/display/xe_initial_plane.c |   2 +-
 drivers/gpu/drm/xe/display/xe_panic.c         |   4 +-
 .../xe/tests/xe_gt_sriov_pf_config_kunit.c    |   8 +-
 drivers/gpu/drm/xe/tests/xe_ttm_vram_mgr.c    | 147 +++++++
 drivers/gpu/drm/xe/tests/xe_vram.c            | 177 ++++++++
 drivers/gpu/drm/xe/xe_assert.h                |   3 +-
 drivers/gpu/drm/xe/xe_bo.c                    | 102 +++--
 drivers/gpu/drm/xe/xe_bo.h                    |   2 +-
 drivers/gpu/drm/xe/xe_debugfs.c               |   3 +-
 drivers/gpu/drm/xe/xe_device.c                |   2 +-
 drivers/gpu/drm/xe/xe_device_types.h          |   2 +-
 drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c    |   7 +-
 drivers/gpu/drm/xe/xe_migrate.c               |   2 +-
 drivers/gpu/drm/xe/xe_pagefault.c             |   3 +-
 drivers/gpu/drm/xe/xe_query.c                 |  27 +-
 drivers/gpu/drm/xe/xe_res_cursor.h            |  45 +-
 drivers/gpu/drm/xe/xe_svm.c                   |  18 +-
 drivers/gpu/drm/xe/xe_tile.c                  |  22 +-
 drivers/gpu/drm/xe/xe_tile.h                  |   6 +-
 drivers/gpu/drm/xe/xe_tile_debugfs.c          |   4 +-
 drivers/gpu/drm/xe/xe_tile_types.h            |   8 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c        |   2 +-
 drivers/gpu/drm/xe/xe_ttm_vram_mgr.c          | 398 ++++++++++++++----
 drivers/gpu/drm/xe/xe_ttm_vram_mgr.h          |  54 ++-
 drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h    |  48 ++-
 drivers/gpu/drm/xe/xe_vram.c                  | 296 ++++++++++++-
 drivers/gpu/drm/xe/xe_vram.h                  |  16 +-
 drivers/gpu/drm/xe/xe_vram_types.h            | 159 ++++++-
 29 files changed, 1338 insertions(+), 231 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/tests/xe_ttm_vram_mgr.c
 create mode 100644 drivers/gpu/drm/xe/tests/xe_vram.c
Signature · 1 line
2.34.1