* [PATCH v2 0/3] drm/xe/oa: Add NO_PREEMPT property
@ 2024-06-25 20:05 Ashutosh Dixit
2024-06-25 20:05 ` [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error Ashutosh Dixit
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Ashutosh Dixit @ 2024-06-25 20:05 UTC (permalink / raw)
To: intel-xe
Add DRM_XE_OA_PROPERTY_NO_PREEMPT property. This is intended to be Xe GuC
equivalent of i915 property DRM_I915_PERF_PROP_HOLD_PREEMPTION.
v2: Introduce no_preempt exec queue op
Ashutosh Dixit (3):
drm/xe/oa: Allow stream enable/disable functions to return error
drm/xe: Introduce no_preempt exec queue op
drm/xe/oa: Allow preemption to be disabled on the stream exec queue
drivers/gpu/drm/xe/xe_exec_queue_types.h | 2 +
drivers/gpu/drm/xe/xe_execlist.c | 7 +++
drivers/gpu/drm/xe/xe_guc_submit.c | 36 +++++++++++++
drivers/gpu/drm/xe/xe_oa.c | 67 ++++++++++++++++++------
drivers/gpu/drm/xe/xe_oa_types.h | 3 ++
include/uapi/drm/xe_drm.h | 6 +++
6 files changed, 106 insertions(+), 15 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error 2024-06-25 20:05 [PATCH v2 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit @ 2024-06-25 20:05 ` Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 2/3] drm/xe: Introduce no_preempt exec queue op Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit 2 siblings, 0 replies; 9+ messages in thread From: Ashutosh Dixit @ 2024-06-25 20:05 UTC (permalink / raw) To: intel-xe Stream enable/disable functions previously had void return because failure during function execution was not possible. This will change when we introduce functionality to disable preemption on the stream exec queue. Therefore, in preparation for this functionality, prepare this code to be able to handle error returns. Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> --- drivers/gpu/drm/xe/xe_oa.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index 9263ae9a864e..a68659fd5386 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -1013,24 +1013,26 @@ static void xe_oa_stream_disable(struct xe_oa_stream *stream) hrtimer_cancel(&stream->poll_check_timer); } -static void xe_oa_enable_locked(struct xe_oa_stream *stream) +static int xe_oa_enable_locked(struct xe_oa_stream *stream) { if (stream->enabled) - return; - - stream->enabled = true; + return 0; xe_oa_stream_enable(stream); + + stream->enabled = true; + return 0; } -static void xe_oa_disable_locked(struct xe_oa_stream *stream) +static int xe_oa_disable_locked(struct xe_oa_stream *stream) { if (!stream->enabled) - return; - - stream->enabled = false; + return 0; xe_oa_stream_disable(stream); + + stream->enabled = false; + return 0; } static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) @@ -1105,11 +1107,9 @@ static long xe_oa_ioctl_locked(struct xe_oa_stream *stream, { switch (cmd) { case DRM_XE_PERF_IOCTL_ENABLE: - xe_oa_enable_locked(stream); - return 0; + return xe_oa_enable_locked(stream); case DRM_XE_PERF_IOCTL_DISABLE: - xe_oa_disable_locked(stream); - return 0; + return xe_oa_disable_locked(stream); case DRM_XE_PERF_IOCTL_CONFIG: return xe_oa_config_locked(stream, arg); case DRM_XE_PERF_IOCTL_STATUS: @@ -1432,19 +1432,25 @@ static int xe_oa_stream_open_ioctl_locked(struct xe_oa *oa, if (ret) goto err_free; + if (!param->disabled) { + ret = xe_oa_enable_locked(stream); + if (ret) + goto err_destroy; + } + stream_fd = anon_inode_getfd("[xe_oa]", &xe_oa_fops, stream, 0); if (stream_fd < 0) { ret = stream_fd; - goto err_destroy; + goto err_disable; } - if (!param->disabled) - xe_oa_enable_locked(stream); - /* Hold a reference on the drm device till stream_fd is released */ drm_dev_get(&stream->oa->xe->drm); return stream_fd; +err_disable: + if (!param->disabled) + xe_oa_disable_locked(stream); err_destroy: xe_oa_stream_destroy(stream); err_free: -- 2.41.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] drm/xe: Introduce no_preempt exec queue op 2024-06-25 20:05 [PATCH v2 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error Ashutosh Dixit @ 2024-06-25 20:05 ` Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit 2 siblings, 0 replies; 9+ messages in thread From: Ashutosh Dixit @ 2024-06-25 20:05 UTC (permalink / raw) To: intel-xe Introduce no_preempt exec queue op to allow an exec queue to run uninterrupted (without preemption or timeslicing). The functionality is used in OA in the next patch. Cc: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> --- drivers/gpu/drm/xe/xe_exec_queue_types.h | 2 ++ drivers/gpu/drm/xe/xe_execlist.c | 7 +++++ drivers/gpu/drm/xe/xe_guc_submit.c | 36 ++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_exec_queue_types.h b/drivers/gpu/drm/xe/xe_exec_queue_types.h index 201588ec33c3..52e281158b15 100644 --- a/drivers/gpu/drm/xe/xe_exec_queue_types.h +++ b/drivers/gpu/drm/xe/xe_exec_queue_types.h @@ -164,6 +164,8 @@ struct xe_exec_queue_ops { int (*set_timeslice)(struct xe_exec_queue *q, u32 timeslice_us); /** @set_preempt_timeout: Set preemption timeout for exec queue */ int (*set_preempt_timeout)(struct xe_exec_queue *q, u32 preempt_timeout_us); + /** @no_preempt: Disable preemption and timeslicing for exec queue */ + int (*no_preempt)(struct xe_exec_queue *q, bool enable); /** * @suspend: Suspend exec queue from executing, allowed to be called * multiple times in a row before resume with the caveat that diff --git a/drivers/gpu/drm/xe/xe_execlist.c b/drivers/gpu/drm/xe/xe_execlist.c index db906117db6d..15392c1d7005 100644 --- a/drivers/gpu/drm/xe/xe_execlist.c +++ b/drivers/gpu/drm/xe/xe_execlist.c @@ -416,6 +416,12 @@ static int execlist_exec_queue_set_preempt_timeout(struct xe_exec_queue *q, return 0; } +static int execlist_exec_queue_no_preempt(struct xe_exec_queue *q, bool enable) +{ + /* NIY */ + return 0; +} + static int execlist_exec_queue_suspend(struct xe_exec_queue *q) { /* NIY */ @@ -446,6 +452,7 @@ static const struct xe_exec_queue_ops execlist_exec_queue_ops = { .set_priority = execlist_exec_queue_set_priority, .set_timeslice = execlist_exec_queue_set_timeslice, .set_preempt_timeout = execlist_exec_queue_set_preempt_timeout, + .no_preempt = execlist_exec_queue_no_preempt, .suspend = execlist_exec_queue_suspend, .suspend_wait = execlist_exec_queue_suspend_wait, .resume = execlist_exec_queue_resume, diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c index 373447758a60..db424133bc14 100644 --- a/drivers/gpu/drm/xe/xe_guc_submit.c +++ b/drivers/gpu/drm/xe/xe_guc_submit.c @@ -1548,6 +1548,41 @@ static int guc_exec_queue_set_preempt_timeout(struct xe_exec_queue *q, return 0; } +static int guc_exec_queue_no_preempt(struct xe_exec_queue *q, bool enable) +{ + struct xe_sched_msg *msg; + + if (exec_queue_killed_or_banned_or_wedged(q)) + return 0; + + if (enable) { + if (!q->sched_props.preempt_timeout_us && !q->sched_props.timeslice_us) + return 0; + } else { + if (q->sched_props.preempt_timeout_us == + q->hwe->eclass->sched_props.preempt_timeout_us && + q->sched_props.timeslice_us == q->hwe->eclass->sched_props.timeslice_us) + return 0; + } + + msg = kmalloc(sizeof(*msg), GFP_KERNEL); + if (!msg) + return -ENOMEM; + + if (enable) { + /* Setting values to 0 will disable preemption and timeslicing */ + q->sched_props.preempt_timeout_us = 0; + q->sched_props.timeslice_us = 0; + } else { + q->sched_props.preempt_timeout_us = q->hwe->eclass->sched_props.preempt_timeout_us; + q->sched_props.timeslice_us = q->hwe->eclass->sched_props.timeslice_us; + } + + guc_exec_queue_add_msg(q, msg, SET_SCHED_PROPS); + + return 0; +} + static int guc_exec_queue_suspend(struct xe_exec_queue *q) { struct xe_sched_msg *msg = q->guc->static_msgs + STATIC_MSG_SUSPEND; @@ -1598,6 +1633,7 @@ static const struct xe_exec_queue_ops guc_exec_queue_ops = { .set_priority = guc_exec_queue_set_priority, .set_timeslice = guc_exec_queue_set_timeslice, .set_preempt_timeout = guc_exec_queue_set_preempt_timeout, + .no_preempt = guc_exec_queue_no_preempt, .suspend = guc_exec_queue_suspend, .suspend_wait = guc_exec_queue_suspend_wait, .resume = guc_exec_queue_resume, -- 2.41.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue 2024-06-25 20:05 [PATCH v2 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 2/3] drm/xe: Introduce no_preempt exec queue op Ashutosh Dixit @ 2024-06-25 20:05 ` Ashutosh Dixit 2 siblings, 0 replies; 9+ messages in thread From: Ashutosh Dixit @ 2024-06-25 20:05 UTC (permalink / raw) To: intel-xe Mesa VK_KHR_performance_query use case requires preemption to be disabled for the stream exec queue. Implement this functionality here. Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> --- drivers/gpu/drm/xe/xe_oa.c | 33 +++++++++++++++++++++++++++++++- drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ include/uapi/drm/xe_drm.h | 6 ++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index a68659fd5386..b2f0188a5233 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -80,6 +80,7 @@ struct xe_oa_open_param { int engine_instance; struct xe_exec_queue *exec_q; struct xe_hw_engine *hwe; + bool no_preempt; }; struct xe_oa_config_bo { @@ -1018,6 +1019,13 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) if (stream->enabled) return 0; + if (stream->no_preempt) { + int ret = stream->exec_q->ops->no_preempt(stream->exec_q, true); + + if (ret) + return ret; + } + xe_oa_stream_enable(stream); stream->enabled = true; @@ -1026,13 +1034,18 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) static int xe_oa_disable_locked(struct xe_oa_stream *stream) { + int ret = 0; + if (!stream->enabled) return 0; xe_oa_stream_disable(stream); + if (stream->no_preempt) + ret = stream->exec_q->ops->no_preempt(stream->exec_q, false); + stream->enabled = false; - return 0; + return ret; } static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) @@ -1307,6 +1320,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, stream->sample = param->sample; stream->periodic = param->period_exponent > 0; stream->period_exponent = param->period_exponent; + stream->no_preempt = param->no_preempt; /* * For Xe2+, when overrun mode is enabled, there are no partial reports at the end @@ -1651,6 +1665,13 @@ static int xe_oa_set_prop_engine_instance(struct xe_oa *oa, u64 value, return 0; } +static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value, + struct xe_oa_open_param *param) +{ + param->no_preempt = value; + return 0; +} + typedef int (*xe_oa_set_property_fn)(struct xe_oa *oa, u64 value, struct xe_oa_open_param *param); static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { @@ -1662,6 +1683,7 @@ static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { [DRM_XE_OA_PROPERTY_OA_DISABLED] = xe_oa_set_prop_disabled, [DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID] = xe_oa_set_prop_exec_queue_id, [DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE] = xe_oa_set_prop_engine_instance, + [DRM_XE_OA_PROPERTY_NO_PREEMPT] = xe_oa_set_no_preempt, }; static int xe_oa_user_ext_set_property(struct xe_oa *oa, u64 extension, @@ -1766,6 +1788,15 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f if (param.exec_q && !param.sample) privileged_op = false; + if (param.no_preempt) { + if (!param.exec_q) { + drm_dbg(&oa->xe->drm, "Preemption disable without exec_q!\n"); + ret = -EINVAL; + goto err_exec_q; + } + privileged_op = true; + } + if (privileged_op && xe_perf_stream_paranoid && !perfmon_capable()) { drm_dbg(&oa->xe->drm, "Insufficient privileges to open xe perf stream\n"); ret = -EACCES; diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h index 706d45577dae..540c3ec53a6d 100644 --- a/drivers/gpu/drm/xe/xe_oa_types.h +++ b/drivers/gpu/drm/xe/xe_oa_types.h @@ -235,5 +235,8 @@ struct xe_oa_stream { /** @oa_status: temporary storage for oa_status register value */ u32 oa_status; + + /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ + u32 no_preempt; }; #endif diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h index b410553faa9b..12eaa8532b5c 100644 --- a/include/uapi/drm/xe_drm.h +++ b/include/uapi/drm/xe_drm.h @@ -1611,6 +1611,12 @@ enum drm_xe_oa_property_id { * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. */ DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, + + /** + * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing + * to be disabled for the stream exec queue. + */ + DRM_XE_OA_PROPERTY_NO_PREEMPT, }; /** -- 2.41.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 0/3] drm/xe/oa: Add NO_PREEMPT property @ 2024-06-25 20:15 Ashutosh Dixit 2024-06-25 20:15 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit 0 siblings, 1 reply; 9+ messages in thread From: Ashutosh Dixit @ 2024-06-25 20:15 UTC (permalink / raw) To: intel-xe Cc: Umesh Nerlige Ramappa, Matthew Brost, Lionel Landwerlin, Jose Souza Add DRM_XE_OA_PROPERTY_NO_PREEMPT property. This is intended to be Xe GuC equivalent of i915 property DRM_I915_PERF_PROP_HOLD_PREEMPTION. v2: Introduce no_preempt exec queue op v3: Introduce set_no_preempt and clear_no_preempt exec queue op's Ashutosh Dixit (3): drm/xe/oa: Allow stream enable/disable functions to return error drm/xe: Exec queue op's to enable/disable preemption and timeslicing drm/xe/oa: Allow preemption to be disabled on the stream exec queue drivers/gpu/drm/xe/xe_exec_queue_types.h | 4 ++ drivers/gpu/drm/xe/xe_execlist.c | 14 +++++ drivers/gpu/drm/xe/xe_guc_submit.c | 45 ++++++++++++++++ drivers/gpu/drm/xe/xe_oa.c | 67 ++++++++++++++++++------ drivers/gpu/drm/xe/xe_oa_types.h | 3 ++ include/uapi/drm/xe_drm.h | 6 +++ 6 files changed, 124 insertions(+), 15 deletions(-) -- 2.41.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue 2024-06-25 20:15 [PATCH 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit @ 2024-06-25 20:15 ` Ashutosh Dixit 2024-06-25 20:49 ` Souza, Jose 2024-06-25 21:55 ` Umesh Nerlige Ramappa 0 siblings, 2 replies; 9+ messages in thread From: Ashutosh Dixit @ 2024-06-25 20:15 UTC (permalink / raw) To: intel-xe Cc: Umesh Nerlige Ramappa, Matthew Brost, Lionel Landwerlin, Jose Souza Mesa VK_KHR_performance_query use case requires preemption to be disabled for the stream exec queue. Implement this functionality here based on the new set_no_preempt and clear_no_preempt exec queue ops. Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> --- drivers/gpu/drm/xe/xe_oa.c | 33 +++++++++++++++++++++++++++++++- drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ include/uapi/drm/xe_drm.h | 6 ++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index a68659fd5386..6453c36c4539 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -80,6 +80,7 @@ struct xe_oa_open_param { int engine_instance; struct xe_exec_queue *exec_q; struct xe_hw_engine *hwe; + bool no_preempt; }; struct xe_oa_config_bo { @@ -1018,6 +1019,13 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) if (stream->enabled) return 0; + if (stream->no_preempt) { + int ret = stream->exec_q->ops->set_no_preempt(stream->exec_q); + + if (ret) + return ret; + } + xe_oa_stream_enable(stream); stream->enabled = true; @@ -1026,13 +1034,18 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) static int xe_oa_disable_locked(struct xe_oa_stream *stream) { + int ret = 0; + if (!stream->enabled) return 0; xe_oa_stream_disable(stream); + if (stream->no_preempt) + ret = stream->exec_q->ops->clear_no_preempt(stream->exec_q); + stream->enabled = false; - return 0; + return ret; } static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) @@ -1307,6 +1320,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, stream->sample = param->sample; stream->periodic = param->period_exponent > 0; stream->period_exponent = param->period_exponent; + stream->no_preempt = param->no_preempt; /* * For Xe2+, when overrun mode is enabled, there are no partial reports at the end @@ -1651,6 +1665,13 @@ static int xe_oa_set_prop_engine_instance(struct xe_oa *oa, u64 value, return 0; } +static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value, + struct xe_oa_open_param *param) +{ + param->no_preempt = value; + return 0; +} + typedef int (*xe_oa_set_property_fn)(struct xe_oa *oa, u64 value, struct xe_oa_open_param *param); static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { @@ -1662,6 +1683,7 @@ static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { [DRM_XE_OA_PROPERTY_OA_DISABLED] = xe_oa_set_prop_disabled, [DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID] = xe_oa_set_prop_exec_queue_id, [DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE] = xe_oa_set_prop_engine_instance, + [DRM_XE_OA_PROPERTY_NO_PREEMPT] = xe_oa_set_no_preempt, }; static int xe_oa_user_ext_set_property(struct xe_oa *oa, u64 extension, @@ -1766,6 +1788,15 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f if (param.exec_q && !param.sample) privileged_op = false; + if (param.no_preempt) { + if (!param.exec_q) { + drm_dbg(&oa->xe->drm, "Preemption disable without exec_q!\n"); + ret = -EINVAL; + goto err_exec_q; + } + privileged_op = true; + } + if (privileged_op && xe_perf_stream_paranoid && !perfmon_capable()) { drm_dbg(&oa->xe->drm, "Insufficient privileges to open xe perf stream\n"); ret = -EACCES; diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h index 706d45577dae..540c3ec53a6d 100644 --- a/drivers/gpu/drm/xe/xe_oa_types.h +++ b/drivers/gpu/drm/xe/xe_oa_types.h @@ -235,5 +235,8 @@ struct xe_oa_stream { /** @oa_status: temporary storage for oa_status register value */ u32 oa_status; + + /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ + u32 no_preempt; }; #endif diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h index b410553faa9b..12eaa8532b5c 100644 --- a/include/uapi/drm/xe_drm.h +++ b/include/uapi/drm/xe_drm.h @@ -1611,6 +1611,12 @@ enum drm_xe_oa_property_id { * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. */ DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, + + /** + * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing + * to be disabled for the stream exec queue. + */ + DRM_XE_OA_PROPERTY_NO_PREEMPT, }; /** -- 2.41.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue 2024-06-25 20:15 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit @ 2024-06-25 20:49 ` Souza, Jose 2024-06-26 0:29 ` Dixit, Ashutosh 2024-06-25 21:55 ` Umesh Nerlige Ramappa 1 sibling, 1 reply; 9+ messages in thread From: Souza, Jose @ 2024-06-25 20:49 UTC (permalink / raw) To: Dixit, Ashutosh, intel-xe@lists.freedesktop.org Cc: Brost, Matthew, Nerlige Ramappa, Umesh, Landwerlin, Lionel G On Tue, 2024-06-25 at 13:15 -0700, Ashutosh Dixit wrote: > Mesa VK_KHR_performance_query use case requires preemption to be disabled > for the stream exec queue. Implement this functionality here based on the > new set_no_preempt and clear_no_preempt exec queue ops. Is this planned to land in the same Kernel version as the other OA patches? If not would be nice to have some flag indicating that this feature is supported in running kernel, like we have in i915. uAPI looks good to me, will implement on Mesa tomorrow. thank you Acked-by: José Roberto de Souza <jose.souza@intel.com> > > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> > --- > drivers/gpu/drm/xe/xe_oa.c | 33 +++++++++++++++++++++++++++++++- > drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ > include/uapi/drm/xe_drm.h | 6 ++++++ > 3 files changed, 41 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > index a68659fd5386..6453c36c4539 100644 > --- a/drivers/gpu/drm/xe/xe_oa.c > +++ b/drivers/gpu/drm/xe/xe_oa.c > @@ -80,6 +80,7 @@ struct xe_oa_open_param { > int engine_instance; > struct xe_exec_queue *exec_q; > struct xe_hw_engine *hwe; > + bool no_preempt; > }; > > struct xe_oa_config_bo { > @@ -1018,6 +1019,13 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > if (stream->enabled) > return 0; > > + if (stream->no_preempt) { > + int ret = stream->exec_q->ops->set_no_preempt(stream->exec_q); > + > + if (ret) > + return ret; > + } > + > xe_oa_stream_enable(stream); > > stream->enabled = true; > @@ -1026,13 +1034,18 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > > static int xe_oa_disable_locked(struct xe_oa_stream *stream) > { > + int ret = 0; > + > if (!stream->enabled) > return 0; > > xe_oa_stream_disable(stream); > > + if (stream->no_preempt) > + ret = stream->exec_q->ops->clear_no_preempt(stream->exec_q); > + > stream->enabled = false; > - return 0; > + return ret; > } > > static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) > @@ -1307,6 +1320,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, > stream->sample = param->sample; > stream->periodic = param->period_exponent > 0; > stream->period_exponent = param->period_exponent; > + stream->no_preempt = param->no_preempt; > > /* > * For Xe2+, when overrun mode is enabled, there are no partial reports at the end > @@ -1651,6 +1665,13 @@ static int xe_oa_set_prop_engine_instance(struct xe_oa *oa, u64 value, > return 0; > } > > +static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value, > + struct xe_oa_open_param *param) > +{ > + param->no_preempt = value; > + return 0; > +} > + > typedef int (*xe_oa_set_property_fn)(struct xe_oa *oa, u64 value, > struct xe_oa_open_param *param); > static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > @@ -1662,6 +1683,7 @@ static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > [DRM_XE_OA_PROPERTY_OA_DISABLED] = xe_oa_set_prop_disabled, > [DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID] = xe_oa_set_prop_exec_queue_id, > [DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE] = xe_oa_set_prop_engine_instance, > + [DRM_XE_OA_PROPERTY_NO_PREEMPT] = xe_oa_set_no_preempt, > }; > > static int xe_oa_user_ext_set_property(struct xe_oa *oa, u64 extension, > @@ -1766,6 +1788,15 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f > if (param.exec_q && !param.sample) > privileged_op = false; > > + if (param.no_preempt) { > + if (!param.exec_q) { > + drm_dbg(&oa->xe->drm, "Preemption disable without exec_q!\n"); > + ret = -EINVAL; > + goto err_exec_q; > + } > + privileged_op = true; > + } > + > if (privileged_op && xe_perf_stream_paranoid && !perfmon_capable()) { > drm_dbg(&oa->xe->drm, "Insufficient privileges to open xe perf stream\n"); > ret = -EACCES; > diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h > index 706d45577dae..540c3ec53a6d 100644 > --- a/drivers/gpu/drm/xe/xe_oa_types.h > +++ b/drivers/gpu/drm/xe/xe_oa_types.h > @@ -235,5 +235,8 @@ struct xe_oa_stream { > > /** @oa_status: temporary storage for oa_status register value */ > u32 oa_status; > + > + /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ > + u32 no_preempt; > }; > #endif > diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h > index b410553faa9b..12eaa8532b5c 100644 > --- a/include/uapi/drm/xe_drm.h > +++ b/include/uapi/drm/xe_drm.h > @@ -1611,6 +1611,12 @@ enum drm_xe_oa_property_id { > * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. > */ > DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, > + > + /** > + * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing > + * to be disabled for the stream exec queue. > + */ > + DRM_XE_OA_PROPERTY_NO_PREEMPT, > }; > > /** ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue 2024-06-25 20:49 ` Souza, Jose @ 2024-06-26 0:29 ` Dixit, Ashutosh 0 siblings, 0 replies; 9+ messages in thread From: Dixit, Ashutosh @ 2024-06-26 0:29 UTC (permalink / raw) To: Souza, Jose Cc: intel-xe@lists.freedesktop.org, Brost, Matthew, Nerlige Ramappa, Umesh, Landwerlin, Lionel G On Tue, 25 Jun 2024 13:49:07 -0700, Souza, Jose wrote: > Hi Jose, > On Tue, 2024-06-25 at 13:15 -0700, Ashutosh Dixit wrote: > > Mesa VK_KHR_performance_query use case requires preemption to be disabled > > for the stream exec queue. Implement this functionality here based on the > > new set_no_preempt and clear_no_preempt exec queue ops. > > Is this planned to land in the same Kernel version as the other OA > patches? Let's see if we can get them reviewed and merged tomorrow which is the cutoff for 6.11. If we can merge tomorrow, they will get in with the other OA patches. That is why I was trying to rush this ahead of other things. > If not would be nice to have some flag indicating that this feature is > supported in running kernel, like we have in i915. Yes, if we don't make it tomorrow's deadline, we'll need to figure something out. > uAPI looks good to me, will implement on Mesa tomorrow. > > thank you > > Acked-by: José Roberto de Souza <jose.souza@intel.com> Thanks. -- Ashutosh > > > > > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> > > --- > > drivers/gpu/drm/xe/xe_oa.c | 33 +++++++++++++++++++++++++++++++- > > drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ > > include/uapi/drm/xe_drm.h | 6 ++++++ > > 3 files changed, 41 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > > index a68659fd5386..6453c36c4539 100644 > > --- a/drivers/gpu/drm/xe/xe_oa.c > > +++ b/drivers/gpu/drm/xe/xe_oa.c > > @@ -80,6 +80,7 @@ struct xe_oa_open_param { > > int engine_instance; > > struct xe_exec_queue *exec_q; > > struct xe_hw_engine *hwe; > > + bool no_preempt; > > }; > > > > struct xe_oa_config_bo { > > @@ -1018,6 +1019,13 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > > if (stream->enabled) > > return 0; > > > > + if (stream->no_preempt) { > > + int ret = stream->exec_q->ops->set_no_preempt(stream->exec_q); > > + > > + if (ret) > > + return ret; > > + } > > + > > xe_oa_stream_enable(stream); > > > > stream->enabled = true; > > @@ -1026,13 +1034,18 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > > > > static int xe_oa_disable_locked(struct xe_oa_stream *stream) > > { > > + int ret = 0; > > + > > if (!stream->enabled) > > return 0; > > > > xe_oa_stream_disable(stream); > > > > + if (stream->no_preempt) > > + ret = stream->exec_q->ops->clear_no_preempt(stream->exec_q); > > + > > stream->enabled = false; > > - return 0; > > + return ret; > > } > > > > static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) > > @@ -1307,6 +1320,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, > > stream->sample = param->sample; > > stream->periodic = param->period_exponent > 0; > > stream->period_exponent = param->period_exponent; > > + stream->no_preempt = param->no_preempt; > > > > /* > > * For Xe2+, when overrun mode is enabled, there are no partial reports at the end > > @@ -1651,6 +1665,13 @@ static int xe_oa_set_prop_engine_instance(struct xe_oa *oa, u64 value, > > return 0; > > } > > > > +static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value, > > + struct xe_oa_open_param *param) > > +{ > > + param->no_preempt = value; > > + return 0; > > +} > > + > > typedef int (*xe_oa_set_property_fn)(struct xe_oa *oa, u64 value, > > struct xe_oa_open_param *param); > > static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > > @@ -1662,6 +1683,7 @@ static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > > [DRM_XE_OA_PROPERTY_OA_DISABLED] = xe_oa_set_prop_disabled, > > [DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID] = xe_oa_set_prop_exec_queue_id, > > [DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE] = xe_oa_set_prop_engine_instance, > > + [DRM_XE_OA_PROPERTY_NO_PREEMPT] = xe_oa_set_no_preempt, > > }; > > > > static int xe_oa_user_ext_set_property(struct xe_oa *oa, u64 extension, > > @@ -1766,6 +1788,15 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f > > if (param.exec_q && !param.sample) > > privileged_op = false; > > > > + if (param.no_preempt) { > > + if (!param.exec_q) { > > + drm_dbg(&oa->xe->drm, "Preemption disable without exec_q!\n"); > > + ret = -EINVAL; > > + goto err_exec_q; > > + } > > + privileged_op = true; > > + } > > + > > if (privileged_op && xe_perf_stream_paranoid && !perfmon_capable()) { > > drm_dbg(&oa->xe->drm, "Insufficient privileges to open xe perf stream\n"); > > ret = -EACCES; > > diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h > > index 706d45577dae..540c3ec53a6d 100644 > > --- a/drivers/gpu/drm/xe/xe_oa_types.h > > +++ b/drivers/gpu/drm/xe/xe_oa_types.h > > @@ -235,5 +235,8 @@ struct xe_oa_stream { > > > > /** @oa_status: temporary storage for oa_status register value */ > > u32 oa_status; > > + > > + /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ > > + u32 no_preempt; > > }; > > #endif > > diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h > > index b410553faa9b..12eaa8532b5c 100644 > > --- a/include/uapi/drm/xe_drm.h > > +++ b/include/uapi/drm/xe_drm.h > > @@ -1611,6 +1611,12 @@ enum drm_xe_oa_property_id { > > * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. > > */ > > DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, > > + > > + /** > > + * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing > > + * to be disabled for the stream exec queue. > > + */ > > + DRM_XE_OA_PROPERTY_NO_PREEMPT, > > }; > > > > /** > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue 2024-06-25 20:15 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit 2024-06-25 20:49 ` Souza, Jose @ 2024-06-25 21:55 ` Umesh Nerlige Ramappa 2024-06-25 22:02 ` Matthew Brost 1 sibling, 1 reply; 9+ messages in thread From: Umesh Nerlige Ramappa @ 2024-06-25 21:55 UTC (permalink / raw) To: Ashutosh Dixit; +Cc: intel-xe, Matthew Brost, Lionel Landwerlin, Jose Souza On Tue, Jun 25, 2024 at 01:15:18PM -0700, Ashutosh Dixit wrote: >Mesa VK_KHR_performance_query use case requires preemption to be disabled >for the stream exec queue. Implement this functionality here based on the >new set_no_preempt and clear_no_preempt exec queue ops. > >Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> lgtm Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> >--- > drivers/gpu/drm/xe/xe_oa.c | 33 +++++++++++++++++++++++++++++++- > drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ > include/uapi/drm/xe_drm.h | 6 ++++++ > 3 files changed, 41 insertions(+), 1 deletion(-) > >diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c >index a68659fd5386..6453c36c4539 100644 >--- a/drivers/gpu/drm/xe/xe_oa.c >+++ b/drivers/gpu/drm/xe/xe_oa.c >@@ -80,6 +80,7 @@ struct xe_oa_open_param { > int engine_instance; > struct xe_exec_queue *exec_q; > struct xe_hw_engine *hwe; >+ bool no_preempt; > }; > > struct xe_oa_config_bo { >@@ -1018,6 +1019,13 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > if (stream->enabled) > return 0; > >+ if (stream->no_preempt) { >+ int ret = stream->exec_q->ops->set_no_preempt(stream->exec_q); >+ >+ if (ret) >+ return ret; >+ } >+ > xe_oa_stream_enable(stream); > > stream->enabled = true; >@@ -1026,13 +1034,18 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > > static int xe_oa_disable_locked(struct xe_oa_stream *stream) > { >+ int ret = 0; >+ > if (!stream->enabled) > return 0; > > xe_oa_stream_disable(stream); > >+ if (stream->no_preempt) >+ ret = stream->exec_q->ops->clear_no_preempt(stream->exec_q); >+ > stream->enabled = false; >- return 0; >+ return ret; > } > > static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) >@@ -1307,6 +1320,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, > stream->sample = param->sample; > stream->periodic = param->period_exponent > 0; > stream->period_exponent = param->period_exponent; >+ stream->no_preempt = param->no_preempt; > > /* > * For Xe2+, when overrun mode is enabled, there are no partial reports at the end >@@ -1651,6 +1665,13 @@ static int xe_oa_set_prop_engine_instance(struct xe_oa *oa, u64 value, > return 0; > } > >+static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value, >+ struct xe_oa_open_param *param) >+{ >+ param->no_preempt = value; >+ return 0; >+} >+ > typedef int (*xe_oa_set_property_fn)(struct xe_oa *oa, u64 value, > struct xe_oa_open_param *param); > static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { >@@ -1662,6 +1683,7 @@ static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > [DRM_XE_OA_PROPERTY_OA_DISABLED] = xe_oa_set_prop_disabled, > [DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID] = xe_oa_set_prop_exec_queue_id, > [DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE] = xe_oa_set_prop_engine_instance, >+ [DRM_XE_OA_PROPERTY_NO_PREEMPT] = xe_oa_set_no_preempt, > }; > > static int xe_oa_user_ext_set_property(struct xe_oa *oa, u64 extension, >@@ -1766,6 +1788,15 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f > if (param.exec_q && !param.sample) > privileged_op = false; > >+ if (param.no_preempt) { >+ if (!param.exec_q) { >+ drm_dbg(&oa->xe->drm, "Preemption disable without exec_q!\n"); >+ ret = -EINVAL; >+ goto err_exec_q; >+ } >+ privileged_op = true; >+ } >+ > if (privileged_op && xe_perf_stream_paranoid && !perfmon_capable()) { > drm_dbg(&oa->xe->drm, "Insufficient privileges to open xe perf stream\n"); > ret = -EACCES; >diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h >index 706d45577dae..540c3ec53a6d 100644 >--- a/drivers/gpu/drm/xe/xe_oa_types.h >+++ b/drivers/gpu/drm/xe/xe_oa_types.h >@@ -235,5 +235,8 @@ struct xe_oa_stream { > > /** @oa_status: temporary storage for oa_status register value */ > u32 oa_status; >+ >+ /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ >+ u32 no_preempt; > }; > #endif >diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h >index b410553faa9b..12eaa8532b5c 100644 >--- a/include/uapi/drm/xe_drm.h >+++ b/include/uapi/drm/xe_drm.h >@@ -1611,6 +1611,12 @@ enum drm_xe_oa_property_id { > * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. > */ > DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, >+ >+ /** >+ * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing >+ * to be disabled for the stream exec queue. >+ */ >+ DRM_XE_OA_PROPERTY_NO_PREEMPT, > }; > > /** >-- >2.41.0 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue 2024-06-25 21:55 ` Umesh Nerlige Ramappa @ 2024-06-25 22:02 ` Matthew Brost 0 siblings, 0 replies; 9+ messages in thread From: Matthew Brost @ 2024-06-25 22:02 UTC (permalink / raw) To: Umesh Nerlige Ramappa Cc: Ashutosh Dixit, intel-xe, Lionel Landwerlin, Jose Souza On Tue, Jun 25, 2024 at 02:55:20PM -0700, Umesh Nerlige Ramappa wrote: > On Tue, Jun 25, 2024 at 01:15:18PM -0700, Ashutosh Dixit wrote: > > Mesa VK_KHR_performance_query use case requires preemption to be disabled > > for the stream exec queue. Implement this functionality here based on the > > new set_no_preempt and clear_no_preempt exec queue ops. > > > > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> > > lgtm > > Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> > This patch should be adjusted based Umesh's and my feedback in patch #2. Matt > > --- > > drivers/gpu/drm/xe/xe_oa.c | 33 +++++++++++++++++++++++++++++++- > > drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ > > include/uapi/drm/xe_drm.h | 6 ++++++ > > 3 files changed, 41 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > > index a68659fd5386..6453c36c4539 100644 > > --- a/drivers/gpu/drm/xe/xe_oa.c > > +++ b/drivers/gpu/drm/xe/xe_oa.c > > @@ -80,6 +80,7 @@ struct xe_oa_open_param { > > int engine_instance; > > struct xe_exec_queue *exec_q; > > struct xe_hw_engine *hwe; > > + bool no_preempt; > > }; > > > > struct xe_oa_config_bo { > > @@ -1018,6 +1019,13 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > > if (stream->enabled) > > return 0; > > > > + if (stream->no_preempt) { > > + int ret = stream->exec_q->ops->set_no_preempt(stream->exec_q); > > + > > + if (ret) > > + return ret; > > + } > > + > > xe_oa_stream_enable(stream); > > > > stream->enabled = true; > > @@ -1026,13 +1034,18 @@ static int xe_oa_enable_locked(struct xe_oa_stream *stream) > > > > static int xe_oa_disable_locked(struct xe_oa_stream *stream) > > { > > + int ret = 0; > > + > > if (!stream->enabled) > > return 0; > > > > xe_oa_stream_disable(stream); > > > > + if (stream->no_preempt) > > + ret = stream->exec_q->ops->clear_no_preempt(stream->exec_q); > > + > > stream->enabled = false; > > - return 0; > > + return ret; > > } > > > > static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg) > > @@ -1307,6 +1320,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream, > > stream->sample = param->sample; > > stream->periodic = param->period_exponent > 0; > > stream->period_exponent = param->period_exponent; > > + stream->no_preempt = param->no_preempt; > > > > /* > > * For Xe2+, when overrun mode is enabled, there are no partial reports at the end > > @@ -1651,6 +1665,13 @@ static int xe_oa_set_prop_engine_instance(struct xe_oa *oa, u64 value, > > return 0; > > } > > > > +static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value, > > + struct xe_oa_open_param *param) > > +{ > > + param->no_preempt = value; > > + return 0; > > +} > > + > > typedef int (*xe_oa_set_property_fn)(struct xe_oa *oa, u64 value, > > struct xe_oa_open_param *param); > > static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > > @@ -1662,6 +1683,7 @@ static const xe_oa_set_property_fn xe_oa_set_property_funcs[] = { > > [DRM_XE_OA_PROPERTY_OA_DISABLED] = xe_oa_set_prop_disabled, > > [DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID] = xe_oa_set_prop_exec_queue_id, > > [DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE] = xe_oa_set_prop_engine_instance, > > + [DRM_XE_OA_PROPERTY_NO_PREEMPT] = xe_oa_set_no_preempt, > > }; > > > > static int xe_oa_user_ext_set_property(struct xe_oa *oa, u64 extension, > > @@ -1766,6 +1788,15 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f > > if (param.exec_q && !param.sample) > > privileged_op = false; > > > > + if (param.no_preempt) { > > + if (!param.exec_q) { > > + drm_dbg(&oa->xe->drm, "Preemption disable without exec_q!\n"); > > + ret = -EINVAL; > > + goto err_exec_q; > > + } > > + privileged_op = true; > > + } > > + > > if (privileged_op && xe_perf_stream_paranoid && !perfmon_capable()) { > > drm_dbg(&oa->xe->drm, "Insufficient privileges to open xe perf stream\n"); > > ret = -EACCES; > > diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h > > index 706d45577dae..540c3ec53a6d 100644 > > --- a/drivers/gpu/drm/xe/xe_oa_types.h > > +++ b/drivers/gpu/drm/xe/xe_oa_types.h > > @@ -235,5 +235,8 @@ struct xe_oa_stream { > > > > /** @oa_status: temporary storage for oa_status register value */ > > u32 oa_status; > > + > > + /** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */ > > + u32 no_preempt; > > }; > > #endif > > diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h > > index b410553faa9b..12eaa8532b5c 100644 > > --- a/include/uapi/drm/xe_drm.h > > +++ b/include/uapi/drm/xe_drm.h > > @@ -1611,6 +1611,12 @@ enum drm_xe_oa_property_id { > > * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. > > */ > > DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, > > + > > + /** > > + * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing > > + * to be disabled for the stream exec queue. > > + */ > > + DRM_XE_OA_PROPERTY_NO_PREEMPT, > > }; > > > > /** > > -- > > 2.41.0 > > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-26 0:41 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-06-25 20:05 [PATCH v2 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 1/3] drm/xe/oa: Allow stream enable/disable functions to return error Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 2/3] drm/xe: Introduce no_preempt exec queue op Ashutosh Dixit 2024-06-25 20:05 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit -- strict thread matches above, loose matches on Subject: below -- 2024-06-25 20:15 [PATCH 0/3] drm/xe/oa: Add NO_PREEMPT property Ashutosh Dixit 2024-06-25 20:15 ` [PATCH 3/3] drm/xe/oa: Allow preemption to be disabled on the stream exec queue Ashutosh Dixit 2024-06-25 20:49 ` Souza, Jose 2024-06-26 0:29 ` Dixit, Ashutosh 2024-06-25 21:55 ` Umesh Nerlige Ramappa 2024-06-25 22:02 ` Matthew Brost
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox