All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2] tools/xe-perf-recorder: Wait for mmio-trigger-report
@ 2026-09-05  1:20 Ashutosh Dixit
  2026-09-05  2:22 ` ✓ i915.CI.BAT: success for tools/xe-perf-recorder: Wait for mmio-trigger-report (rev2) Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ashutosh Dixit @ 2026-09-05  1:20 UTC (permalink / raw)
  To: igt-dev; +Cc: Shekhar Chauhan

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-23  5:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-05  1:20 [PATCH i-g-t v2] tools/xe-perf-recorder: Wait for mmio-trigger-report Ashutosh Dixit
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.