Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Shekhar Chauhan <shekhar.chauhan@intel.com>
Subject: [PATCH i-g-t v2] tools/xe-perf-recorder: Wait for mmio-trigger-report
Date: Fri,  4 Sep 2026 18:20:55 -0700	[thread overview]
Message-ID: <20260905012055.494831-1-ashutosh.dixit@intel.com> (raw)

After mmio trigger is issued, we should wait till we receive a report with
the context id issued in the mmio trigger.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 tools/xe-perf/xe_perf_recorder.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/xe-perf/xe_perf_recorder.c b/tools/xe-perf/xe_perf_recorder.c
index e13eef5190..cb7ca67bdb 100644
--- a/tools/xe-perf/xe_perf_recorder.c
+++ b/tools/xe-perf/xe_perf_recorder.c
@@ -370,6 +370,7 @@ struct recording_context {
 	uint32_t vm;
 	uint32_t exec_queue;
 	struct intel_bb *ibb;
+	uint32_t mmio_trg_val;
 };
 
 static uint32_t oa_unit_mmio_trigger_reg(struct recording_context *ctx)
@@ -642,13 +643,15 @@ check_mmio_trigger_report(struct recording_context *ctx, const void *report)
 	const uint32_t *report_32 = report;
 	uint64_t value;
 
-	if (report_reason(report_32))
+	if (!ctx->mmio_trg_val || report_reason(report_32))
 		return;
 
 	value = (fmt->header == HDR_64_BIT) ? ((const uint64_t *)report)[2] : report_32[2];
 
-	if (value == 0xc0ffee01 || value == 0xc0ffee02)
+	if (value == ctx->mmio_trg_val) {
 		fprintf(stdout, "Received trigger report with value 0x%" PRIx64 "\n", value);
+		ctx->mmio_trg_val = 0;
+	}
 }
 
 static bool write_stream_data(struct recording_context *ctx,
@@ -712,6 +715,18 @@ static bool write_perf_data(FILE *output, struct recording_context *ctx)
 	return false;
 }
 
+static void write_mmio_trigger_data(struct recording_context *ctx)
+{
+	struct pollfd pollfd = { .fd = ctx->perf_fd, .events = POLLIN };
+
+	while (ctx->mmio_trg_val) {
+		poll(&pollfd, 1, -1);
+		assert(pollfd.revents & POLLIN);
+
+		write_perf_data(ctx->output_stream, ctx);
+	}
+}
+
 static clock_t correlation_clock_id = CLOCK_MONOTONIC;
 
 static const char *
@@ -797,6 +812,9 @@ static void emit_oa_trigger(struct recording_context *ctx, uint32_t value)
 	intel_bb_flush_render(ctx->ibb);
 	intel_bb_sync(ctx->ibb);
 	intel_bb_reset(ctx->ibb, false);
+
+	ctx->mmio_trg_val = value;
+	write_mmio_trigger_data(ctx);
 }
 
 static void
@@ -815,7 +833,6 @@ read_command_file(struct recording_context *ctx)
 		FILE *file;
 
 		emit_oa_trigger(ctx, 0xc0ffee02);
-		write_perf_data(ctx->output_stream, ctx);
 
 		while (offset < len &&
 		       ((ret = read(ctx->command_fifo_fd,
-- 
2.51.0


             reply	other threads:[~2026-09-05  1:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05  1:20 Ashutosh Dixit [this message]
2026-09-05  2:22 ` ✓ i915.CI.BAT: success for tools/xe-perf-recorder: Wait for mmio-trigger-report (rev2) Patchwork
2026-09-05  2:24 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-05  4:05 ` ✗ i915.CI.Full: failure " Patchwork
2026-09-05  4:54 ` ✗ Xe.CI.FULL: " Patchwork
2026-09-21  6:40 ` [PATCH i-g-t v2] tools/xe-perf-recorder: Wait for mmio-trigger-report Shekhar Chauhan
2026-09-23  5:25   ` Shekhar Chauhan

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=20260905012055.494831-1-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