From: sashiko-bot@kernel.org
To: "Himal Prasad Ghimiray" <himal.prasad.ghimiray@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [RFC 7/7] drm/xe/uapi: Wire up GEM_CREATE NUMA node placement handler
Date: Mon, 02 Nov 2026 10:29:23 +0000 [thread overview]
Message-ID: <sashiko-outbox-193260@kernel.org> (raw)
In-Reply-To: <20261102101803.455921-16-himal.prasad.ghimiray@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/xe: UAPI mismatch for VRAM-only BOs in gem_create_parse_numa_node()
- [Low] drm/xe: missing numa_node kernel-doc in xe_bo_init_locked()
--
commit 4dfdcc93fc9d778a45958834231a36c288d379fc
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
drm/xe/uapi: Wire up GEM_CREATE NUMA node placement handler
This commit parses the DRM_XE_GEM_CREATE_SET_PROPERTY_NUMA_NODE user
extension prior to BO creation in xe_gem_create_ioctl() and passes the
requested NUMA node ID down through the BO creation helpers to store on
the xe_bo.
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index fc9bfb436b8e7..bbbc337372641 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
[ ... ]
> @@ -2480,7 +2480,7 @@ struct xe_bo *xe_bo_init_locked(struct xe_device *xe, struct xe_bo *bo,
> struct ttm_lru_bulk_move *bulk, size_t size,
> u16 cpu_caching, enum ttm_bo_type type,
> u32 flags, struct dma_buf *dma_buf,
> - struct drm_exec *exec)
> + int numa_node, struct drm_exec *exec)
> {
[ ... ]
> @@ -2966,7 +2967,8 @@ static void xe_bo_debug_mixed_mode_cur_index_advance(struct xe_device *xe,
> struct xe_bo *xe_bo_create_user(struct xe_device *xe,
> struct xe_vm *vm, size_t size,
> u16 cpu_caching,
> - u32 flags, struct drm_exec *exec)
> + u32 flags, int numa_node,
> + struct drm_exec *exec)
> {
[Severity: Low]
This isn't a bug, but both xe_bo_init_locked() and xe_bo_create_user() have
kernel-doc comment blocks immediately above their definitions. Should
@numa_node be added to both kernel-doc blocks to avoid W=1 kernel-doc
warnings for undescribed function parameters?
[ ... ]
> @@ -3658,6 +3666,56 @@ static int gem_create_user_extensions(struct xe_device *xe, struct xe_bo *bo,
> return 0;
> }
>
> +/*
> + * Parse a host NUMA node request from the extension chain. The node must be
> + * known before the BO is created, because the backing pages are allocated
> + * during creation. Returns the requested node in @numa_node (NUMA_NO_NODE if
> + * none or a negative value is given) or a negative errno on an invalid request.
> + */
> +static int gem_create_parse_numa_node(struct xe_device *xe, u64 extensions,
> + u32 bo_flags, int *numa_node)
> +{
> + struct drm_xe_user_extension base;
> + struct drm_xe_ext_set_property ext;
> + unsigned int i = 0;
> +
> + *numa_node = NUMA_NO_NODE;
> +
> + while (extensions && i++ < MAX_USER_EXTENSIONS) {
> + u64 __user *address = u64_to_user_ptr(extensions);
> + s64 nid;
> +
> + if (XE_IOCTL_DBG(xe, copy_from_user(&base, address, sizeof(base))))
> + return -EFAULT;
> +
> + if (base.name != DRM_XE_GEM_CREATE_EXTENSION_SET_PROPERTY)
> + goto next;
> +
> + if (XE_IOCTL_DBG(xe, copy_from_user(&ext, address, sizeof(ext))))
> + return -EFAULT;
> +
> + if (ext.property != DRM_XE_GEM_CREATE_SET_PROPERTY_NUMA_NODE)
> + goto next;
> +
> + nid = (s64)ext.value;
> + *numa_node = NUMA_NO_NODE;
> + if (nid < 0)
> + goto next;
> +
> + if (XE_IOCTL_DBG(xe, nid >= MAX_NUMNODES || !node_online(nid)))
> + return -EINVAL;
> +
> + if (XE_IOCTL_DBG(xe, !(bo_flags & XE_BO_FLAG_SYSTEM)))
> + return -EINVAL;
> +
> + *numa_node = nid;
> +next:
> + extensions = base.next_extension;
> + }
> +
> + return 0;
> +}
[Severity: Medium]
Does rejecting !(bo_flags & XE_BO_FLAG_SYSTEM) with -EINVAL in
xe_gem_create_ioctl() -> gem_create_parse_numa_node() match the UAPI
contract in include/uapi/drm/xe_drm.h?
In struct drm_xe_gem_create, the comment for
DRM_XE_GEM_CREATE_SET_PROPERTY_NUMA_NODE states:
/*
* Host NUMA node (as a signed value) to allocate system-memory
* backing pages from. Only honored for objects with a system-memory
* placement; ignored for VRAM-only objects. Use a value < 0 to keep
* the default device-local placement.
*/
#define DRM_XE_GEM_CREATE_SET_PROPERTY_NUMA_NODE 1
However, gem_create_parse_numa_node() returns -EINVAL when nid >= 0 and
!(bo_flags & XE_BO_FLAG_SYSTEM) instead of ignoring the property on
VRAM-only objects.
In addition, because nid < 0 jumps to next before reaching the
!(bo_flags & XE_BO_FLAG_SYSTEM) check, a VRAM-only BO with nid < 0 is
accepted while nid >= 0 fails with -EINVAL, and an extension chain on a
VRAM-only BO that sets nid >= 0 followed by a later extension resetting
nid = -1 will fail on the first extension.
Should the UAPI comment and gem_create_parse_numa_node() be aligned on
whether VRAM-only BOs ignore DRM_XE_GEM_CREATE_SET_PROPERTY_NUMA_NODE or
reject it with -EINVAL?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102101803.455921-9-himal.prasad.ghimiray@intel.com?part=7
next prev parent reply other threads:[~2026-11-02 10:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 10:18 [RFC 0/7] drm/ttm, drm/xe: Per-BO host NUMA node placement Himal Prasad Ghimiray
2026-11-02 10:18 ` [RFC 1/7] drm/ttm/pool: Add ttm_pool_alloc_node() for caller-selected NUMA node Himal Prasad Ghimiray
2026-11-02 10:26 ` sashiko-bot
2026-11-02 10:50 ` Christian König
2026-11-02 12:46 ` Thomas Hellström
2026-11-02 10:18 ` [RFC 2/7] drm/ttm: Add NUMA node aware restore helpers Himal Prasad Ghimiray
2026-11-02 10:26 ` sashiko-bot
2026-11-02 10:18 ` [RFC 3/7] drm/ttm/pool: enforce per-node cache limits on free Himal Prasad Ghimiray
2026-11-02 10:18 ` [RFC 4/7] drm/xe/bo: Plumb a per-BO host NUMA node hint into tt populate Himal Prasad Ghimiray
2026-11-02 10:18 ` [RFC 5/7] drm/xe/bo: Preserve the host NUMA node across backup / restore Himal Prasad Ghimiray
2026-11-02 10:18 ` [RFC 6/7] drm/xe/uapi: Add GEM_CREATE NUMA node placement property Himal Prasad Ghimiray
2026-11-02 10:27 ` sashiko-bot
2026-11-02 10:18 ` [RFC 7/7] drm/xe/uapi: Wire up GEM_CREATE NUMA node placement handler Himal Prasad Ghimiray
2026-11-02 10:29 ` sashiko-bot [this message]
2026-11-02 11:12 ` Matthew Auld
2026-11-02 18:24 ` Himal prasad Ghimiray
2026-11-02 12:44 ` ✓ CI.KUnit: success for drm/ttm, drm/xe: Per-BO host NUMA node placement Patchwork
2026-11-02 13:22 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-02 14:55 ` ✓ 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-193260@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--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.