From: Matthew Brost <matthew.brost@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
intel-xe@lists.freedesktop.org, matthew.d.roper@intel.com
Subject: Re: [PATCH v6 06/17] drm/xe/multi_queue: Add exec_queue set_property ioctl support
Date: Tue, 20 Jan 2026 14:30:01 -0800 [thread overview]
Message-ID: <aXAB6XdbDu+jsNtZ@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <aW//pmK8UIGNxfps@lstrano-desk.jf.intel.com>
On Tue, Jan 20, 2026 at 02:20:22PM -0800, Matthew Brost wrote:
> On Tue, Jan 20, 2026 at 01:06:07PM -0800, Niranjana Vishwanathapura wrote:
> > On Mon, Jan 19, 2026 at 05:57:29PM +0100, Thomas Hellström wrote:
> > > Hi,
> > >
> > > On Wed, 2025-12-10 at 17:02 -0800, Niranjana Vishwanathapura wrote:
> > > > This patch adds support for exec_queue set_property ioctl.
> > > > It is derived from the original work which is part of
> > > > https://patchwork.freedesktop.org/series/112188/
> > > >
> > > > Currently only DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_QUEUE_PRIORITY
> > > > property can be dynamically set.
> > > >
> > > > v2: Check for and update kernel-doc which property this ioctl
> > > > supports (Matt Brost)
> > > >
> > > > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> > > > Signed-off-by: Pallavi Mishra <pallavi.mishra@intel.com>
> > > > Signed-off-by: Niranjana Vishwanathapura
> > > > <niranjana.vishwanathapura@intel.com>
> > > > Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> > >
> > > Two questions on this patch:
> > >
> > > 1) I don't see any locking to protect the exec-queue / lrc state.
> > > Perhaps I missed it, but couldn't this blow up if someone runs two
> > > set_property ioctls in parallel on the same exec-queue? Looks like at
> > > least the set_priority is doing non-atomic RMW assignments?
> > >
>
> I don't think we'd blow up. At worst q->multi_queue.priority would race
> between a set in guc_exec_queue_set_priority (parallel across queues)
> and read of that value in __guc_exec_queue_process_msg_set_sched_props
> (serialize across queues). Eventually we'd stablize on the most recently
> set value in __guc_exec_queue_process_msg_set_sched_props.
>
> >
> > Hmm...I think only checking and setting of 'q->multi_queue.priority'
> > in guc_exec_queue_set_multi_queue_priority() is a potential issue
> > (as the rest is handled by message handling queue and guc ct backend).
> > I think we can fix it with a simple spicklock in this function.
> >
>
> Hmm, I'm not sure what a lock here buys us as if two user threads try to
> set q->multi_queue.priority we'd never really knows who should win the
> race of saying of setting.
>
> > > 2) Do we really need this to be mutable? In i915 assuming that lrc /
> > > context configuration could change created horrendous locking
> > > constructs that were later fixed by making it immutable at first
> > > command sumbission. I don't exactly remember the details but do we need
> > > to change properties after first submission? If not I suggest blocking
> > > that.
>
> I don't think this is overly complicated here given the actual queue
> interaction with the GuC is serialized by the DRM scheduler.
>
> My thinking is this patch is probably fine as is, albiet a little
> harmlessly racey.
Actually maybe we need WRITE_ONCE / READ_ONCE semantics here to prevent
data tearing.
Matt
>
> Matt
>
> >
> > Yah, ability to dynamically change multi-queue priority is a requirement
> > from the Compute UMD team.
> >
> > Niranjana
> >
> > >
> > > Thanks,
> > > Thomas
> > >
> > >
> > >
> > >
> > > > ---
> > > > drivers/gpu/drm/xe/xe_device.c | 2 ++
> > > > drivers/gpu/drm/xe/xe_exec_queue.c | 35
> > > > ++++++++++++++++++++++++++++++
> > > > drivers/gpu/drm/xe/xe_exec_queue.h | 2 ++
> > > > include/uapi/drm/xe_drm.h | 26 ++++++++++++++++++++++
> > > > 4 files changed, 65 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/xe/xe_device.c
> > > > b/drivers/gpu/drm/xe/xe_device.c
> > > > index 1197f914ef77..7a498c8db7b1 100644
> > > > --- a/drivers/gpu/drm/xe/xe_device.c
> > > > +++ b/drivers/gpu/drm/xe/xe_device.c
> > > > @@ -207,6 +207,8 @@ static const struct drm_ioctl_desc xe_ioctls[] =
> > > > {
> > > > DRM_IOCTL_DEF_DRV(XE_MADVISE, xe_vm_madvise_ioctl,
> > > > DRM_RENDER_ALLOW),
> > > > DRM_IOCTL_DEF_DRV(XE_VM_QUERY_MEM_RANGE_ATTRS,
> > > > xe_vm_query_vmas_attrs_ioctl,
> > > > DRM_RENDER_ALLOW),
> > > > + DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_SET_PROPERTY,
> > > > xe_exec_queue_set_property_ioctl,
> > > > + DRM_RENDER_ALLOW),
> > > > };
> > > >
> > > > static long xe_drm_ioctl(struct file *file, unsigned int cmd,
> > > > unsigned long arg)
> > > > diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c
> > > > b/drivers/gpu/drm/xe/xe_exec_queue.c
> > > > index d0082eb45a4a..d738a9fea1e1 100644
> > > > --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> > > > +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> > > > @@ -790,6 +790,41 @@ static const xe_exec_queue_set_property_fn
> > > > exec_queue_set_property_funcs[] = {
> > > > exec_queue_s
> > > > et_multi_queue_priority,
> > > > };
> > > >
> > > > +int xe_exec_queue_set_property_ioctl(struct drm_device *dev, void
> > > > *data,
> > > > + struct drm_file *file)
> > > > +{
> > > > + struct xe_device *xe = to_xe_device(dev);
> > > > + struct xe_file *xef = to_xe_file(file);
> > > > + struct drm_xe_exec_queue_set_property *args = data;
> > > > + struct xe_exec_queue *q;
> > > > + int ret;
> > > > + u32 idx;
> > > > +
> > > > + if (XE_IOCTL_DBG(xe, args->reserved[0] || args-
> > > > >reserved[1]))
> > > > + return -EINVAL;
> > > > +
> > > > + if (XE_IOCTL_DBG(xe, args->property !=
> > > > +
> > > > DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_QUEUE_PRIORITY))
> > > > + return -EINVAL;
> > > > +
> > > > + q = xe_exec_queue_lookup(xef, args->exec_queue_id);
> > > > + if (XE_IOCTL_DBG(xe, !q))
> > > > + return -ENOENT;
> > > > +
> > > > + idx = array_index_nospec(args->property,
> > > > +
> > > > ARRAY_SIZE(exec_queue_set_property_funcs));
> > > > + ret = exec_queue_set_property_funcs[idx](xe, q, args-
> > > > >value);
> > > > + if (XE_IOCTL_DBG(xe, ret))
> > > > + goto err_post_lookup;
> > > > +
> > > > + xe_exec_queue_put(q);
> > > > + return 0;
> > > > +
> > > > + err_post_lookup:
> > > > + xe_exec_queue_put(q);
> > > > + return ret;
> > > > +}
> > > > +
> > > > static int exec_queue_user_ext_check(struct xe_exec_queue *q, u64
> > > > properties)
> > > > {
> > > > u64 secondary_queue_valid_props =
> > > > BIT_ULL(DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_GROUP) |
> > > > diff --git a/drivers/gpu/drm/xe/xe_exec_queue.h
> > > > b/drivers/gpu/drm/xe/xe_exec_queue.h
> > > > index e6daa40003f2..ffcc1feb879e 100644
> > > > --- a/drivers/gpu/drm/xe/xe_exec_queue.h
> > > > +++ b/drivers/gpu/drm/xe/xe_exec_queue.h
> > > > @@ -125,6 +125,8 @@ int xe_exec_queue_destroy_ioctl(struct drm_device
> > > > *dev, void *data,
> > > > struct drm_file *file);
> > > > int xe_exec_queue_get_property_ioctl(struct drm_device *dev, void
> > > > *data,
> > > > struct drm_file *file);
> > > > +int xe_exec_queue_set_property_ioctl(struct drm_device *dev, void
> > > > *data,
> > > > + struct drm_file *file);
> > > > enum xe_exec_queue_priority
> > > > xe_exec_queue_device_get_max_priority(struct xe_device *xe);
> > > >
> > > > void xe_exec_queue_last_fence_put(struct xe_exec_queue *e, struct
> > > > xe_vm *vm);
> > > > diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> > > > index fd79d78de2e9..705081bf0d81 100644
> > > > --- a/include/uapi/drm/xe_drm.h
> > > > +++ b/include/uapi/drm/xe_drm.h
> > > > @@ -106,6 +106,7 @@ extern "C" {
> > > > #define DRM_XE_OBSERVATION 0x0b
> > > > #define DRM_XE_MADVISE 0x0c
> > > > #define DRM_XE_VM_QUERY_MEM_RANGE_ATTRS 0x0d
> > > > +#define DRM_XE_EXEC_QUEUE_SET_PROPERTY 0x0e
> > > >
> > > > /* Must be kept compact -- no holes */
> > > >
> > > > @@ -123,6 +124,7 @@ extern "C" {
> > > > #define
> > > > DRM_IOCTL_XE_OBSERVATION DRM_IOW(DRM_COMMAND_BASE + DRM_XE_OBSERVATION,structdrm_xe_observation_param)
> > > > #define
> > > > DRM_IOCTL_XE_MADVISE DRM_IOW(DRM_COMMAND_BASE + DRM_XE_MADVISE, structdrm_xe_madvise)
> > > > #define
> > > > DRM_IOCTL_XE_VM_QUERY_MEM_RANGE_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_QUERY_MEM_RANGE_ATTRS,structdrm_xe_vm_query_mem_range_attr)
> > > > +#define
> > > > DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY,structdrm_xe_exec_queue_set_property)
> > > >
> > > > /**
> > > > * DOC: Xe IOCTL Extensions
> > > > @@ -2315,6 +2317,30 @@ struct drm_xe_vm_query_mem_range_attr {
> > > >
> > > > };
> > > >
> > > > +/**
> > > > + * struct drm_xe_exec_queue_set_property - exec queue set property
> > > > + *
> > > > + * Sets execution queue properties dynamically.
> > > > + * Currently only
> > > > %DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_QUEUE_PRIORITY
> > > > + * property can be dynamically set.
> > > > + */
> > > > +struct drm_xe_exec_queue_set_property {
> > > > + /** @extensions: Pointer to the first extension struct, if
> > > > any */
> > > > + __u64 extensions;
> > > > +
> > > > + /** @exec_queue_id: Exec queue ID */
> > > > + __u32 exec_queue_id;
> > > > +
> > > > + /** @property: property to set */
> > > > + __u32 property;
> > > > +
> > > > + /** @value: property value */
> > > > + __u64 value;
> > > > +
> > > > + /** @reserved: Reserved */
> > > > + __u64 reserved[2];
> > > > +};
> > > > +
> > > > #if defined(__cplusplus)
> > > > }
> > > > #endif
> > >
next prev parent reply other threads:[~2026-01-20 22:30 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 1:02 [PATCH v6 00/17] drm/xe: Multi Queue feature support Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 01/17] drm/xe/multi_queue: Add multi_queue_enable_mask to gt information Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 02/17] drm/xe/multi_queue: Add user interface for multi queue support Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 03/17] drm/xe/multi_queue: Add GuC " Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 04/17] drm/xe/multi_queue: Add multi queue priority property Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 05/17] drm/xe/multi_queue: Handle invalid exec queue property setting Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 06/17] drm/xe/multi_queue: Add exec_queue set_property ioctl support Niranjana Vishwanathapura
2026-01-19 16:57 ` Thomas Hellström
2026-01-20 21:06 ` Niranjana Vishwanathapura
2026-01-20 22:20 ` Matthew Brost
2026-01-20 22:30 ` Matthew Brost [this message]
2026-01-21 15:29 ` Thomas Hellström
2026-01-21 21:23 ` Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 07/17] drm/xe/multi_queue: Add support for multi queue dynamic priority change Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 08/17] drm/xe/multi_queue: Add multi queue information to guc_info dump Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 09/17] drm/xe/multi_queue: Handle tearing down of a multi queue Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 10/17] drm/xe/multi_queue: Set QUEUE_DRAIN_MODE for Multi Queue batches Niranjana Vishwanathapura
2025-12-11 1:02 ` [PATCH v6 11/17] drm/xe/multi_queue: Handle CGP context error Niranjana Vishwanathapura
2025-12-11 1:03 ` [PATCH v6 12/17] drm/xe/multi_queue: Reset GT upon CGP_SYNC failure Niranjana Vishwanathapura
2025-12-11 1:03 ` [PATCH v6 13/17] drm/xe/multi_queue: Teardown group upon job timeout Niranjana Vishwanathapura
2025-12-11 1:03 ` [PATCH v6 14/17] drm/xe/multi_queue: Tracepoint support Niranjana Vishwanathapura
2025-12-11 1:03 ` [PATCH v6 15/17] drm/xe/multi_queue: Support active group after primary is destroyed Niranjana Vishwanathapura
2025-12-19 21:06 ` Rodrigo Vivi
2025-12-19 22:35 ` Niranjana Vishwanathapura
2025-12-19 22:53 ` Matt Roper
2025-12-31 1:51 ` Niranjana Vishwanathapura
2025-12-11 1:03 ` [PATCH v6 16/17] drm/xe/doc: Add documentation for Multi Queue Group Niranjana Vishwanathapura
2025-12-11 1:03 ` [PATCH v6 17/17] drm/xe/doc: Add documentation for Multi Queue Group GuC interface Niranjana Vishwanathapura
2025-12-11 1:11 ` ✗ CI.checkpatch: warning for drm/xe: Multi Queue feature support (rev6) Patchwork
2025-12-11 1:12 ` ✓ CI.KUnit: success " Patchwork
2025-12-11 2:25 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-11 10:04 ` ✗ Xe.CI.Full: failure " 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=aXAB6XdbDu+jsNtZ@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
--cc=niranjana.vishwanathapura@intel.com \
--cc=thomas.hellstrom@linux.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