[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251201-trbe_buffer_refactor_v1-1-v1-7-7da32b076b28@arm.com>
Date: Mon, 01 Dec 2025 11:21:57 +0000
From: Leo Yan <leo.yan@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>, James Clark <james.clark@...aro.org>,
Anshuman Khandual <anshuman.khandual@....com>,
Yeoreum Yun <yeoreum.yun@....com>, Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>, Tamas Petz <tamas.petz@....com>,
Tamas Zsoldos <tamas.zsoldos@....com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>
Cc: coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Leo Yan <leo.yan@....com>
Subject: [PATCH 07/19] coresight: trbe: Refactor AUX flag setting
Rather than spreading AUX flag setting in different functions, use
trbe_get_fault_act() as a central place for setting the flag.
Later we will support WRAP mode with continuous trace, so the WRAP
event does not necessarily cause the trace discontinuity, change to
check the stop status instead.
Signed-off-by: Leo Yan <leo.yan@....com>
---
drivers/hwtracing/coresight/coresight-trbe.c | 38 +++++++++++++---------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 28e2bfa68074f19ccaa4a737d00af577aea818fe..b06885a08e082fd34f68d9588518807b5c47c86e 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -265,25 +265,6 @@ static void trbe_reset_local(struct trbe_cpudata *cpudata)
write_sysreg_s(0, SYS_TRBSR_EL1);
}
-static void trbe_report_wrap_event(struct perf_output_handle *handle)
-{
- /*
- * Mark the buffer to indicate that there was a WRAP event by
- * setting the COLLISION flag. This indicates to the user that
- * the TRBE trace collection was stopped without stopping the
- * ETE and thus there might be some amount of trace that was
- * lost between the time the WRAP was detected and the IRQ
- * was consumed by the CPU.
- *
- * Setting the TRUNCATED flag would move the event to STOPPED
- * state unnecessarily, even when there is space left in the
- * ring buffer. Using the COLLISION flag doesn't have this side
- * effect. We only set TRUNCATED flag when there is no space
- * left in the ring buffer.
- */
- perf_aux_output_flag(handle, PERF_AUX_FLAG_COLLISION);
-}
-
static void trbe_truncate_event(struct perf_output_handle *handle)
{
struct trbe_buf *buf = etm_perf_sink_config(handle);
@@ -687,6 +668,23 @@ static enum trbe_fault_action trbe_get_fault_act(struct perf_output_handle *hand
goto out_fatal;
}
+ /*
+ * Mark the buffer to indicate that there was a WRAP event by
+ * setting the COLLISION flag. This indicates to the user that
+ * the TRBE trace collection was stopped without stopping the
+ * ETE and thus there might be some amount of trace that was
+ * lost between the time the WRAP was detected and the IRQ
+ * was consumed by the CPU.
+ *
+ * Setting the TRUNCATED flag would move the event to STOPPED
+ * state unnecessarily, even when there is space left in the
+ * ring buffer. Using the COLLISION flag doesn't have this side
+ * effect. We only set TRUNCATED flag when there is no space
+ * left in the ring buffer.
+ */
+ if (!is_trbe_running(trbsr))
+ perf_aux_output_flag(handle, PERF_AUX_FLAG_COLLISION);
+
if (is_trbe_wrap(trbsr))
return TRBE_FAULT_ACT_WRAP;
@@ -878,7 +876,6 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev,
goto done;
}
- trbe_report_wrap_event(handle);
wrap = true;
}
@@ -1099,7 +1096,6 @@ static int trbe_handle_overflow(struct perf_output_handle *handle)
if (buf->snapshot)
handle->head += size;
- trbe_report_wrap_event(handle);
perf_aux_output_end(handle, size);
event_data = perf_aux_output_begin(handle, event);
if (!event_data) {
--
2.34.1
Powered by blists - more mailing lists