From: Matthew Auld <matthew.auld@intel.com>
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>,
intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH v4 1/7] drm/xe: Define partitioned VRAM manager types
Date: Wed, 25 Nov 2026 14:30:17 +0000 [thread overview]
Message-ID: <cd218231-993f-4661-adf6-38d771f58d90@intel.com> (raw)
In-Reply-To: <20261116094523.2484301-2-piotr.piorkowski@intel.com>
On 16/11/2026 09:45, Piórkowski, Piotr wrote:
> From: Piotr Piórkowski <piotr.piorkowski@intel.com>
>
> A VRAM region may need to be split into hard partitions, e.g. to keep
> kernel allocations in a dedicated low range of VRAM. Expressing such a
> split purely as a placement range would turn every VRAM allocation into
> a %GPU_BUDDY_RANGE_ALLOCATION, which constrains the buddy algorithm for
> what is really a hard, statically known split.
>
> Describe the types needed to manage each partition with a buddy
> allocator of its own instead. struct xe_ttm_vram_mgr_part ties a buddy
> allocator to the VRAM pool it backs, the manager holds up to
> XE_TTM_VRAM_MGR_MAX_PARTS of them, and resources and offlined pages
> record the partition their blocks were allocated from, as buddy offsets
> become partition relative.
>
> Each partition also tracks the CPU visible memory allocated from it, so
> that usage can be reported per pool purpose, and the alignment a
> partition base must honour is defined next to the partition itself.
What about calling it "zone/zones" ? That feels more natural IMO and
would then match what core kernel names this IIRC.
struct xe_ttm_vram_mgr_zone {
}
struct xe_ttm_vram_mgr_zone zones[XE_TTM_VRAM_MGR_MAX_ZONES];
I explored something very similar to this in the past for visible vs
non-visible VRAM, where you model it by having an array of zones in the
mgr. So zone-0 is the visible part and zone-1 is the non-visible. From
allocator pov you then also don't need to mess with bias range stuff,
and rather just have two separate allocators, but there are ofc other
complications with that.
>
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> ---
> drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h | 46 ++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h b/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
> index 4a2cd27a5b617..1da3c82b28585 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
> @@ -7,8 +7,46 @@
> #define _XE_TTM_VRAM_MGR_TYPES_H_
>
> #include <linux/gpu_buddy.h>
> +#include <linux/sizes.h>
> #include <drm/ttm/ttm_device.h>
>
> +struct xe_vram_pool;
> +
> +/**
> + * struct xe_ttm_vram_mgr_part - Partition of a VRAM region
> + *
> + * A VRAM region may be split into disjoint partitions, each managed by its
> + * own buddy allocator. An allocation belongs to exactly one partition and
> + * cannot span partition boundaries. This lets the manager allocate directly
> + * from the requested partition without resorting to
> + * %GPU_BUDDY_RANGE_ALLOCATION, which constrains the buddy allocation
> + * algorithm.
> + */
> +struct xe_ttm_vram_mgr_part {
> + /**
> + * @pool: VRAM pool backed by this partition
> + *
> + * Once the manager is initialized, pool->part points back here.
> + */
> + struct xe_vram_pool *pool;
> + /** @mm: DRM buddy allocator which manages this partition */
> + struct gpu_buddy mm;
> + /** @used_visible: CPU visible bytes allocated from this partition */
> + u64 used_visible;
> +};
> +
> +/** XE_TTM_VRAM_MGR_MAX_PARTS - Max partitions of a single VRAM region */
> +#define XE_TTM_VRAM_MGR_MAX_PARTS 2
> +
> +/**
> + * XE_TTM_VRAM_MGR_PART_ALIGN - Required alignment of a partition base
> + *
> + * Buddy offsets are partition relative, so a partition base has to be
> + * aligned to the largest VRAM page size in regular use, otherwise an aligned
> + * buddy allocation is not aligned in the region.
> + */
> +#define XE_TTM_VRAM_MGR_PART_ALIGN SZ_2M
> +
> /**
> * struct xe_ttm_vram_mgr - Xe TTM VRAM manager
> *
> @@ -19,6 +57,10 @@ struct xe_ttm_vram_mgr {
> struct ttm_resource_manager manager;
> /** @mm: DRM buddy allocator which manages the VRAM */
> struct gpu_buddy mm;
> + /** @parts: Partitions this VRAM region is split into */
> + struct xe_ttm_vram_mgr_part parts[XE_TTM_VRAM_MGR_MAX_PARTS];
> + /** @num_parts: Number of initialized entries in @parts */
> + unsigned int num_parts;
> /** @offlined_pages: List of offlined pages */
> struct list_head offlined_pages;
> /** @n_offlined_pages: Number of offlined pages */
> @@ -47,6 +89,8 @@ struct xe_ttm_vram_mgr_resource {
> struct ttm_resource base;
> /** @blocks: list of DRM buddy blocks */
> struct list_head blocks;
> + /** @part: Partition owning @blocks, set on successful allocation */
> + struct xe_ttm_vram_mgr_part *part;
> /** @used_visible_size: How many CPU visible bytes this resource is using */
> u64 used_visible_size;
> /** @flags: flags associated with the resource */
> @@ -73,6 +117,8 @@ struct xe_ttm_vram_offline_resource {
> struct list_head queued_link;
> /** @blocks: Buddy blocks reserved for this page */
> struct list_head blocks;
> + /** @part: Partition owning @blocks, set on successful reservation */
> + struct xe_ttm_vram_mgr_part *part;
> /** @used_visible_size: CPU-visible bytes consumed */
> u64 used_visible_size;
> /** @addr: Faulty DPA reported by HW */
next prev parent reply other threads:[~2026-11-25 14:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 9:45 [PATCH v4 0/7] Introduce purpose-specific VRAM pools Piórkowski, Piotr
2026-11-16 9:45 ` [PATCH v4 1/7] drm/xe: Define partitioned VRAM manager types Piórkowski, Piotr
2026-11-25 14:30 ` Matthew Auld [this message]
2026-11-26 9:01 ` Piotr Piórkowski
2026-11-16 9:45 ` [PATCH v4 2/7] drm/xe: Define VRAM regions and pools Piórkowski, Piotr
2026-11-25 17:38 ` Matthew Auld
2026-11-26 9:41 ` Piotr Piórkowski
2026-11-26 11:14 ` Matthew Auld
2026-11-26 11:36 ` Matthew Auld
2026-11-16 9:45 ` [PATCH v4 3/7] drm/xe/vram: Make VRAM pools the allocation handle Piórkowski, Piotr
2026-11-16 9:45 ` [PATCH v4 4/7] drm/xe/ttm: Back each VRAM pool with its own buddy allocator Piórkowski, Piotr
2026-11-16 9:45 ` [PATCH v4 5/7] drm/xe/vram: Allow splitting a region into pools Piórkowski, Piotr
2026-11-16 9:45 ` [PATCH v4 6/7] drm/xe/kunit: Test partitioned VRAM manager Piórkowski, Piotr
2026-11-16 9:45 ` [PATCH v4 7/7] drm/xe/kunit: Test VRAM pool allocation Piórkowski, Piotr
2026-11-16 11:17 ` ✗ CI.checkpatch: warning for Introduce purpose-specific VRAM pools (rev4) Patchwork
2026-11-16 11:20 ` ✓ CI.KUnit: success " Patchwork
2026-11-16 12:07 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 17:24 ` ✓ 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=cd218231-993f-4661-adf6-38d771f58d90@intel.com \
--to=matthew.auld@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=piotr.piorkowski@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