Skip to contentSkip to conversation

Xe OA Consolidated Diffs

PATCH In review Ashutosh Dixit 2 participants 4 messages Mar 5, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Xe OA Consolidated Diffs

Because Xe OA changes between successive revisions are distributed across multiple patches, I am providing a combined diff of all changes in a single patch to help with the code review.

These changes pertain to: https://patchwork.freedesktop.org/series/121084/

Ashutosh Dixit (1):
drm/xe/oa: Combined diff of changes between v10 and v11

 drivers/gpu/drm/xe/xe_oa.c       | 21 +++++++++++++++------
 drivers/gpu/drm/xe/xe_oa_types.h |  2 +-
 include/uapi/drm/xe_drm.h        | 19 +++++++++++++++++--
 3 files changed, 33 insertions(+), 9 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 drm/xe/oa: Combined diff of changes between v10 and v11

Because Xe OA changes between successive revisions are distributed across multiple patches, provide a combined diff of all changes in a single patch to help with the code review.

These changes pertain to: https://patchwork.freedesktop.org/series/121084/

This patch will not compile, it's purpose is to just provide the diff.

The diff between v10 and v11 consists of the following uapi changes:
* Use a chain of drm_xe_ext_set_property struct's also for stream reconfiguration (using DRM_XE_PERF_IOCTL_CONFIG perf fd ioctl). This will enable additional properties such as syncobj's during stream reconfiguration.
* Add extensions also to output structs from the kernel so they can also be extended if needed in the future
* Change DRM_XE_PERF ioctl number to 0x0b

---
 drivers/gpu/drm/xe/xe_oa.c       | 21 +++++++++++++++------
 drivers/gpu/drm/xe/xe_oa_types.h |  2 +-
 include/uapi/drm/xe_drm.h        | 19 +++++++++++++++++--
 3 files changed, 33 insertions(+), 9 deletions(-)
drivers/gpu/drm/xe/xe_oa.c +15 -6
index c26bbed1940e..0f961ce4fb98 100644
@@ -1004,19 +1004,28 @@ static void xe_oa_disable_locked(struct xe_oa_stream *stream)
 	xe_oa_stream_disable(stream);
 }
 
-static long xe_oa_config_locked(struct xe_oa_stream *stream,
-				unsigned long metrics_set)
+static long xe_oa_config_locked(struct xe_oa_stream *stream, u64 arg)
 {
-	struct xe_oa_config *config;
+	struct drm_xe_ext_set_property ext;
 	long ret = stream->oa_config->id;
+	struct xe_oa_config *config;
+	int err;
 
-	config = xe_oa_get_oa_config(stream->oa, metrics_set);
+	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;
+
+	config = xe_oa_get_oa_config(stream->oa, ext.value);
 	if (!config)
 		return -ENODEV;
 
 	if (config != stream->oa_config) {
-		int err;
-
 		err = xe_oa_emit_oa_config(stream);
 		if (!err)
 			config = xchg(&stream->oa_config, config);
drivers/gpu/drm/xe/xe_oa_types.h +1 -1
index ce20c03bbc28..fd8e42c9bee1 100644
@@ -4,7 +4,7 @@
  */
 
 #ifndef _XE_OA_TYPES_H_
-#define _XE_OA_TYPES_H__
+#define _XE_OA_TYPES_H_
 
 #include <linux/idr.h>
 #include <linux/math.h>
include/uapi/drm/xe_drm.h +17 -2
index bdd7b78f47ba..96a7b0bbbe57 100644
@@ -100,7 +100,7 @@ extern "C" {
 #define DRM_XE_EXEC_QUEUE_GET_PROPERTY	0x08
 #define DRM_XE_EXEC			0x09
 #define DRM_XE_WAIT_USER_FENCE		0x0a
-#define DRM_XE_PERF			0x0e
+#define DRM_XE_PERF			0x0b
 
 /* Must be kept compact -- no holes */
 
@@ -1377,7 +1377,7 @@ enum drm_xe_perf_op {
 };
 
 /**
- * struct drm_xe_perf_param - Perf layer param
+ * struct drm_xe_perf_param - Input of &DRM_XE_PERF
  *
  * The perf layer enables multiplexing perf counter streams of multiple
  * types. The actual params for a particular stream operation are supplied
@@ -1433,6 +1433,9 @@ enum drm_xe_oa_unit_type {
  * struct drm_xe_oa_unit - describe OA unit
  */
 struct drm_xe_oa_unit {
+	/** @extensions: Pointer to the first extension struct, if any */
+	__u64 extensions;
+
 	/** @oa_unit_id: OA unit ID */
 	__u32 oa_unit_id;
 
@@ -1481,6 +1484,8 @@ struct drm_xe_oa_unit {
  *	}
  */
 struct drm_xe_query_oa_units {
+	/** @extensions: Pointer to the first extension struct, if any */
+	__u64 extensions;
 	/** @num_oa_units: number of OA units returned in oau[] */
 	__u32 num_oa_units;
 	/** @pad: MBZ */
@@ -1507,6 +1512,10 @@ enum drm_xe_oa_format_type {
  * @drm_xe_user_extension base.name set to @DRM_XE_OA_EXTENSION_SET_PROPERTY.
  * @param field in struct @drm_xe_perf_param points to the first
  * @drm_xe_ext_set_property struct.
+ *
+ * Exactly the same mechanism is also used for stream reconfiguration using
+ * the @DRM_XE_PERF_IOCTL_CONFIG perf fd ioctl, though only a subset of
+ * properties below can be specified for stream reconfiguration.
  */
 enum drm_xe_oa_property_id {
 #define DRM_XE_OA_EXTENSION_SET_PROPERTY	0
@@ -1600,6 +1609,9 @@ struct drm_xe_oa_config {
  * @DRM_XE_PERF_IOCTL_STATUS perf fd ioctl
  */
 struct drm_xe_oa_stream_status {
+	/** @extensions: Pointer to the first extension struct, if any */
+	__u64 extensions;
+
 	/** @oa_status: OA status register as specified in PRM/Bspec 46717/61226 */
 	__u64 oa_status;
 #define DRM_XE_OASTATUS_MMIO_TRG_Q_FULL		(1 << 6)
@@ -1616,6 +1628,9 @@ struct drm_xe_oa_stream_status {
  * @DRM_XE_PERF_IOCTL_INFO perf fd ioctl
  */
 struct drm_xe_oa_stream_info {
+	/** @extensions: Pointer to the first extension struct, if any */
+	__u64 extensions;
+
 	/** @oa_buf_size: OA buffer size */
 	__u64 oa_buf_size;
 
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH 1/1] drm/xe/oa: Combined diff of changes between v10 and v11

Quoted 1 line · Ashutosh Dixit

Hi Umesh,

Quoted 8 lines

The diff between v10 and v11 consists of the following uapi changes:
* Use a chain of drm_xe_ext_set_property struct's also for stream reconfiguration (using DRM_XE_PERF_IOCTL_CONFIG perf fd ioctl). This will enable additional properties such as syncobj's during stream reconfiguration.
* Add extensions also to output structs from the kernel so they can also be extended if needed in the future
* Change DRM_XE_PERF ioctl number to 0x0b

Just wanted to propose a few minor tweaks to the Perf/OA uapi with this patch. I have sent the new series with these changes here:

https://patchwork.freedesktop.org/series/121084/#rev11

But didn't copy you on the series itself (just this combined diff) so as not to spam you. I have also retained your previous R-b's on the patches.

So please just take a look at this combined diff and let me know if there's anything here you don't agree with or want done differently.

Thanks.
--
Ashutosh

#3 lore raw

✗ CI.Patch_applied: failure for Xe OA Consolidated Diffs

In reply to Ashutosh Dixit
== Series Details ==

== Series Details ==

Series: Xe OA Consolidated Diffs
URL : https://patchwork.freedesktop.org/series/130705/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: e90b5046fce6 drm-tip: 2024y-03m-04d-23h-59m-21s UTC integration manifest === git am output follows ===
error: drivers/gpu/drm/xe/xe_oa.c: does not exist in index
error: drivers/gpu/drm/xe/xe_oa_types.h: does not exist in index
error: patch failed: include/uapi/drm/xe_drm.h:100
error: include/uapi/drm/xe_drm.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/xe/oa: Combined diff of changes between v10 and v11
Patch failed at 0001 drm/xe/oa: Combined diff of changes between v10 and v11 When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".