Re: [PATCH i-g-t v3] tools/xe-perf-recorder: expose some OA stream open properties

"Dixit, Ashutosh" <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
On Wed, 05 Aug 2026 23:34:02 -0700, Shekhar Chauhan wrote:
>
> xe-perf-recorder only passes 5 of the OA stream open properties to
> DRM_XE_OBSERVATION_OP_STREAM_OPEN, leaving the rest without an open
> source consumer. Add few of the remaining ones.
>
> v2: Remove properties which don't exercise anything in xe-perf-recorder.
> v3: Minor nitpicks.

Reviewed-by: Ashutosh Dixit <[email protected]>

>
> Signed-off-by: Shekhar Chauhan <[email protected]>
> ---
>  tools/xe-perf/xe_perf_recorder.c | 32 ++++++++++++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/tools/xe-perf/xe_perf_recorder.c b/tools/xe-perf/xe_perf_recorder.c
> index c69050b43..e13eef519 100644
> --- a/tools/xe-perf/xe_perf_recorder.c
> +++ b/tools/xe-perf/xe_perf_recorder.c
> @@ -364,6 +364,9 @@ struct recording_context {
>	struct drm_xe_oa_unit *oa_unit;
>	struct drm_xe_engine_class_instance *hwe;
>
> +	int oa_buffer_size;
> +	int wait_num_reports;
> +
>	uint32_t vm;
>	uint32_t exec_queue;
>	struct intel_bb *ibb;
> @@ -487,6 +490,12 @@ perf_open(struct recording_context *ctx)
>		DRM_XE_OA_PROPERTY_OA_METRIC_SET, ctx->metric_set->perf_oa_metrics_set,
>		DRM_XE_OA_PROPERTY_OA_FORMAT, __ff(ctx->metric_set->perf_oa_format),
>		DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT, ctx->oa_exponent,
> +
> +		DRM_XE_OA_PROPERTY_OA_BUFFER_SIZE, ctx->oa_buffer_size,
> +		DRM_XE_OA_PROPERTY_WAIT_NUM_REPORTS, ctx->wait_num_reports,
> +
> +		/* Open disabled; the stream is enabled right after open */
> +		DRM_XE_OA_PROPERTY_OA_DISABLED, true,
>	};
>	struct intel_xe_oa_open_prop param = {
>		.num_properties = ARRAY_SIZE(properties) / 2,
> @@ -924,7 +933,10 @@ usage(const char *name)
>		"     --output,             -o <path>   Output file (default = xe_perf.record)\n"
>		"     --cpu-clock,          -k <path>   Cpu clock to use for correlations\n"
>		"                                       Values: boot, mono, mono_raw (default = mono)\n"
> -		"     --oa-unit-id          -u <value>  OA unit id for the capture.\n",
> +		"     --oa-unit-id          -u <value>  OA unit id for the capture.\n"
> +		"     --oa-buffer-size      -b <value>  OA buffer size in bytes (default = 64M)\n"
> +		"     --wait-num-reports    -w <value>  Num reports before unblocking poll()/read()\n"
> +		"                                       (default = 1)\n",
>		name);
>  }
>
> @@ -1038,6 +1050,8 @@ main(int argc, char *argv[])
>		{"command-fifo",	required_argument, 0, 'f'},
>		{"cpu-clock",		required_argument, 0, 'k'},
>		{"oa-unit-id",		required_argument, 0, 'u'},
> +		{"oa-buffer-size",	required_argument, 0, 'b'},
> +		{"wait-num-reports",	required_argument, 0, 'w'},
>		{0, 0, 0, 0}
>	};
>	const struct {
> @@ -1066,9 +1080,11 @@ main(int argc, char *argv[])
>		.command_fifo_fd = -1,
>
>		.oa_unit_id = 0,
> +		.oa_buffer_size = 64 * 1024 * 1024,
> +		.wait_num_reports = 1,
>	};
>
> -	while ((opt = getopt_long(argc, argv, "hc:d:p:m:Co:s:f:k:P:u:", long_options, NULL)) != -1) {
> +	while ((opt = getopt_long(argc, argv, "hc:d:p:m:Co:s:f:k:P:u:b:w:", long_options, NULL)) != -1) {
>		switch (opt) {
>		case 'h':
>			usage(argv[0]);
> @@ -1119,6 +1135,12 @@ main(int argc, char *argv[])
>		case 'u':
>			ctx.oa_unit_id = atoi(optarg);
>			break;
> +		case 'b':
> +			ctx.oa_buffer_size = atoi(optarg);
> +			break;
> +		case 'w':
> +			ctx.wait_num_reports = atoi(optarg);
> +			break;
>		default:
>			fprintf(stderr, "Internal error: "
>				"unexpected getopt value: %d\n", opt);
> @@ -1291,6 +1313,12 @@ main(int argc, char *argv[])
>		goto fail;
>	}
>
> +	if (perf_ioctl(ctx.perf_fd, DRM_XE_OBSERVATION_IOCTL_ENABLE, 0) < 0) {
> +		fprintf(stderr, "Unable to enable xe oa stream: %s\n",
> +			strerror(errno));
> +		goto fail;
> +	}
> +
>	init_mmio_trigger_ctx(&ctx);
>	emit_oa_trigger(&ctx, 0xc0ffee01);
>
> --
> 2.53.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.