From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>,
Jose Souza <jose.souza@intel.com>,
Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
Jonathan Cavitt <jonathan.cavitt@intel.com>
Subject: [PATCH 6/7] drm/xe/oa: Add syncs support to OA config ioctl
Date: Mon, 19 Aug 2024 17:58:07 -0700 [thread overview]
Message-ID: <20240820005808.1412649-7-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20240820005808.1412649-1-ashutosh.dixit@intel.com>
In addition to stream open, add xe_sync support to the OA config ioctl,
where it is even more useful. This allows e.g. Mesa to replay a workload
repeatedly on the GPU, each time with a different OA configuration, while
precisely controlling (at batch buffer granularity) the workload segment
for which a particular OA configuration is active, without introducing
stalls in the userspace pipeline.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
drivers/gpu/drm/xe/xe_oa.c | 32 ++++++++++++++++++--------------
drivers/gpu/drm/xe/xe_oa_types.h | 3 +++
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 36cf1e5e53f31..f43767e0a75ec 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -884,6 +884,7 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream)
xe_gt_WARN_ON(gt, xe_guc_pc_unset_gucrc_mode(>->uc.guc.pc));
xe_oa_free_configs(stream);
+ xe_file_put(stream->xef);
}
static int xe_oa_alloc_oa_buffer(struct xe_oa_stream *stream)
@@ -1454,36 +1455,37 @@ static int xe_oa_disable_locked(struct xe_oa_stream *stream)
static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg)
{
- struct drm_xe_ext_set_property ext;
+ struct xe_oa_open_param param = {};
long ret = stream->oa_config->id;
struct xe_oa_config *config;
int err;
- err = __copy_from_user(&ext, u64_to_user_ptr(arg), sizeof(ext));
- if (XE_IOCTL_DBG(stream->oa->xe, err))
- return -EFAULT;
-
- if (XE_IOCTL_DBG(stream->oa->xe, ext.pad) ||
- XE_IOCTL_DBG(stream->oa->xe, ext.base.name != DRM_XE_OA_EXTENSION_SET_PROPERTY) ||
- XE_IOCTL_DBG(stream->oa->xe, ext.base.next_extension) ||
- XE_IOCTL_DBG(stream->oa->xe, ext.property != DRM_XE_OA_PROPERTY_OA_METRIC_SET))
- return -EINVAL;
+ err = xe_oa_user_extensions(stream->oa, arg, 0, ¶m);
+ if (err)
+ return err;
- config = xe_oa_get_oa_config(stream->oa, ext.value);
+ config = xe_oa_get_oa_config(stream->oa, param.metric_set);
if (!config)
return -ENODEV;
if (config != stream->oa_config) {
+ param.xef = stream->xef;
+ err = xe_oa_parse_syncs(stream->oa, ¶m);
+ if (err)
+ goto err_config_put;
+
+ stream->num_syncs = param.num_syncs;
+ stream->syncs = param.syncs;
+
err = xe_oa_emit_oa_config(stream, config);
if (!err)
config = xchg(&stream->oa_config, config);
- else
- ret = err;
}
+err_config_put:
xe_oa_config_put(config);
- return ret;
+ return err ?: ret;
}
static long xe_oa_status_locked(struct xe_oa_stream *stream, unsigned long arg)
@@ -1726,6 +1728,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
stream->period_exponent = param->period_exponent;
stream->no_preempt = param->no_preempt;
+ stream->xef = xe_file_get(param->xef);
stream->num_syncs = param->num_syncs;
stream->syncs = param->syncs;
@@ -1826,6 +1829,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
err_free_configs:
xe_oa_free_configs(stream);
exit:
+ xe_file_put(stream->xef);
return ret;
}
diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h
index 412f1460c1437..438e746e8e1f5 100644
--- a/drivers/gpu/drm/xe/xe_oa_types.h
+++ b/drivers/gpu/drm/xe/xe_oa_types.h
@@ -239,6 +239,9 @@ struct xe_oa_stream {
/** @no_preempt: Whether preemption and timeslicing is disabled for stream exec_q */
u32 no_preempt;
+ /** @xef: xe_file with which the stream was opened */
+ struct xe_file *xef;
+
/** @oa_fence_lock: Lock for struct xe_oa_fence */
spinlock_t oa_fence_lock;
--
2.41.0
next prev parent reply other threads:[~2024-08-20 0:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 0:58 [PATCH v2 0/7] drm/xe/oa: xe_syncs for OA Ashutosh Dixit
2024-08-20 0:58 ` [PATCH 1/7] drm/xe/oa: Separate batch submission from waiting for completion Ashutosh Dixit
2024-08-20 0:58 ` [PATCH 2/7] drm/xe/oa/uapi: Define and parse OA sync properties Ashutosh Dixit
2024-08-20 0:58 ` [PATCH 3/7] drm/xe/oa: Add input fence dependencies Ashutosh Dixit
2024-08-20 0:58 ` [PATCH 4/7] drm/xe/oa: Signal output fences Ashutosh Dixit
2024-08-20 19:23 ` Matthew Brost
2024-08-21 15:20 ` Dixit, Ashutosh
2024-08-21 16:02 ` Matthew Brost
2024-08-20 0:58 ` [PATCH 5/7] drm/xe/oa: Move functions up so they can be reused for config ioctl Ashutosh Dixit
2024-08-20 0:58 ` Ashutosh Dixit [this message]
2024-08-20 0:58 ` [PATCH 7/7] drm/xe/oa: Allow only certain property changes from config Ashutosh Dixit
2024-08-20 14:15 ` Cavitt, Jonathan
2024-08-21 15:19 ` Dixit, Ashutosh
2024-08-20 1:03 ` ✓ CI.Patch_applied: success for drm/xe/oa: xe_syncs for OA (rev2) Patchwork
2024-08-20 1:04 ` ✓ CI.checkpatch: " Patchwork
2024-08-20 1:05 ` ✓ CI.KUnit: " Patchwork
2024-08-20 1:17 ` ✓ CI.Build: " Patchwork
2024-08-20 1:19 ` ✓ CI.Hooks: " Patchwork
2024-08-20 1:20 ` ✓ CI.checksparse: " Patchwork
2024-08-20 1:40 ` ✓ CI.BAT: " Patchwork
2024-08-20 9:37 ` ✗ CI.FULL: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-08-21 15:28 [PATCH v3 0/7] drm/xe/oa: xe_syncs for OA Ashutosh Dixit
2024-08-21 15:28 ` [PATCH 6/7] drm/xe/oa: Add syncs support to OA config ioctl Ashutosh Dixit
2024-08-28 1:50 [PATCH v4 0/7] drm/xe/oa: xe_syncs for OA Ashutosh Dixit
2024-08-28 1:50 ` [PATCH 6/7] drm/xe/oa: Add syncs support to OA config ioctl Ashutosh Dixit
2024-08-30 22:16 [PATCH v5 0/7] drm/xe/oa: xe_syncs for OA Ashutosh Dixit
2024-08-30 22:16 ` [PATCH 6/7] drm/xe/oa: Add syncs support to OA config ioctl Ashutosh Dixit
2024-09-18 19:53 [PATCH v6 0/7] drm/xe/oa: xe_syncs for OA Ashutosh Dixit
2024-09-18 19:53 ` [PATCH 6/7] drm/xe/oa: Add syncs support to OA config ioctl Ashutosh Dixit
2024-10-22 20:03 [PATCH v7 0/7] drm/xe/oa: xe_syncs for OA Ashutosh Dixit
2024-10-22 20:03 ` [PATCH 6/7] drm/xe/oa: Add syncs support to OA config ioctl Ashutosh Dixit
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=20240820005808.1412649-7-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=jose.souza@intel.com \
--cc=lionel.g.landwerlin@intel.com \
--cc=matthew.brost@intel.com \
--cc=umesh.nerlige.ramappa@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