From: sashiko-bot@kernel.org
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v9 3/5] drm/xe/ggtt: Split GGTT into usable and shareable pools
Date: Mon, 16 Nov 2026 09:25:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-216610@kernel.org> (raw)
In-Reply-To: <20261116090053.2466938-4-piotr.piorkowski@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/ggtt: u32 size truncation in
xe_ggtt_insert_node_shareable()
--
commit 77f9ae0aec9ac84bb1acae228f0f6fa5525c45d5
Author: Piotr Piórkowski <piotr.piorkowski@intel.com>
drm/xe/ggtt: Split GGTT into usable and shareable pools
This commit splits the GGTT into a usable pool for driver-owned allocations
and a shareable pool for SR-IOV VF provisioning, adding
xe_ggtt_insert_node_shareable() for the shareable range.
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 73c45eecae2be..8bc888f6274cc 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
[ ... ]
> @@ -652,24 +687,65 @@ static void xe_ggtt_invalidate_engine(struct xe_ggtt *ggtt)
[ ... ]
> -static int xe_ggtt_insert_node_locked(struct xe_ggtt_node *node,
> - u32 size, u32 align, u32 mm_flags)
> +static int ggtt_insert_node_in_range_locked(struct xe_ggtt_node *node, u32 size,
> + u32 align, u64 range_start,
> + u64 range_size, u32 mm_flags)
> {
> - return drm_mm_insert_node_generic(&node->ggtt->mm, &node->base, size, align, 0,
> - mm_flags);
> + struct xe_ggtt *ggtt = node->ggtt;
> + u64 range_end = range_start + range_size;
> +
> + lockdep_assert_held(&ggtt->lock);
> +
> + if (!range_size || range_end <= range_start)
> + return -EINVAL;
> +
> + if (range_end > ggtt->full_size)
> + return -ERANGE;
> +
> + if (size > range_size)
> + return -ENOSPC;
> +
> + return drm_mm_insert_node_in_range(&ggtt->mm, &node->base, size, align, 0,
> + range_start, range_end, mm_flags);
> +}
[ ... ]
> @@ -703,8 +779,45 @@ struct xe_ggtt_node *xe_ggtt_insert_node(struct xe_ggtt *ggtt, u32 size, u32 ali
[ ... ]
> +#ifdef CONFIG_PCI_IOV
> +/**
> + * xe_ggtt_insert_node_shareable() - Insert a new node in the shareable GGTT range
> + * @ggtt: the &xe_ggtt into which the node should be inserted.
> + * @size: size of the node
> + * @align: alignment constrain of the node
> + *
> + * Allocations always start from the top (DRM_MM_INSERT_HIGH).
> + *
> + * Return: &xe_ggtt_node on success or an ERR_PTR on failure.
> + */
> +struct xe_ggtt_node *xe_ggtt_insert_node_shareable(struct xe_ggtt *ggtt, u32 size, u32 align)
> +{
> + struct xe_ggtt_node *node;
> + int ret;
> +
> + if (!ggtt->shareable_size)
> + return ERR_PTR(-ENOSPC);
> +
> + node = ggtt_node_init(ggtt);
> + if (IS_ERR(node))
> + return node;
> +
> + guard(mutex)(&ggtt->lock);
> +
> + ret = ggtt_insert_node_in_range_locked(node, size, align,
> + ggtt_shareable_offset(ggtt),
> + ggtt->shareable_size,
> + DRM_MM_INSERT_HIGH);
> if (ret) {
> ggtt_node_fini(node);
> return ERR_PTR(ret);
> }
>
> return node;
> }
> +#endif
[Severity: Medium]
Should size and align in xe_ggtt_insert_node_shareable(),
xe_ggtt_insert_node_locked() and ggtt_insert_node_in_range_locked() be u64
instead of u32?
pf_provision_vf_ggtt() takes a u64 size (for example from the u64
ggtt_quota debugfs attribute) and passes it to
xe_ggtt_insert_node_shareable(). A 64-bit size >= 4 GiB with non-zero
lower 32 bits (such as SZ_4G + SZ_64M) is truncated to u32 before the
size > range_size check in ggtt_insert_node_in_range_locked(), so instead
of returning -ENOSPC, pf_provision_vf_ggtt() allocates a node for the
truncated 32-bit size and then passes the untruncated 64-bit size to GuC
via pf_distribute_config_ggtt(). Similarly, xe_ggtt_insert_node_transform()
accepts a u64 size and passes it to xe_ggtt_insert_node_locked().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116090053.2466938-1-piotr.piorkowski@intel.com?part=3
next prev parent reply other threads:[~2026-11-16 9:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 9:00 [PATCH v9 0/5] Separate GGTT pools for submissions and VFs provisioning Piórkowski, Piotr
2026-11-16 9:00 ` [PATCH v9 1/5] drm/xe/ggtt: Assert lower bound of GGTT PTE address Piórkowski, Piotr
2026-11-16 9:00 ` [PATCH v9 2/5] drm/xe/ggtt: Introduce full GGTT range size Piórkowski, Piotr
2026-11-16 9:00 ` [PATCH v9 3/5] drm/xe/ggtt: Split GGTT into usable and shareable pools Piórkowski, Piotr
2026-11-16 9:25 ` sashiko-bot [this message]
2026-11-16 9:00 ` [PATCH v9 4/5] drm/xe/ggtt: Initialize GGTT pools by SR-IOV mode Piórkowski, Piotr
2026-11-16 9:00 ` [PATCH v9 5/5] drm/xe/ggtt: Add KUnit tests for usable and shareable pools Piórkowski, Piotr
2026-11-16 10:02 ` ✗ CI.checkpatch: warning for Separate GGTT pools for submissions and VFs provisioning (rev9) Patchwork
2026-11-16 10:04 ` ✓ CI.KUnit: success " Patchwork
2026-11-16 10:37 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 14:35 ` ✓ 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=sashiko-outbox-216610@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=piotr.piorkowski@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 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.