Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Shekhar Chauhan <shekhar.chauhan@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t v3] tools/xe-perf-recorder: expose some OA stream open properties
Date: Thu, 06 Aug 2026 11:16:55 -0700	[thread overview]
Message-ID: <87fr0rf71k.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20260806063402.4003061-1-shekhar.chauhan@intel.com>

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 <ashutosh.dixit@intel.com>

>
> Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
> ---
>  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
>

  reply	other threads:[~2026-08-06 18:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  6:34 [PATCH i-g-t v3] tools/xe-perf-recorder: expose some OA stream open properties Shekhar Chauhan
2026-08-06 18:16 ` Dixit, Ashutosh [this message]
2026-08-06 20:49 ` ✓ Xe.CI.BAT: success for tools/xe-perf-recorder: expose some OA stream open properties (rev3) Patchwork
2026-08-06 21:06 ` ✓ i915.CI.BAT: " Patchwork
2026-08-07  1:59 ` ✓ i915.CI.Full: " Patchwork
2026-08-07 10:11 ` ✓ Xe.CI.FULL: " 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=87fr0rf71k.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=shekhar.chauhan@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