On 01/12/25 4:51 PM, Leo Yan wrote:
The trace unit is already disabled when trbe_stop_and_truncate_event() is called, so draining and stopping the buffer in the function is redundant.
Remove the unnecessary disable operation and rename the function to trbe_truncate_event() to better reflect its purpose.
Signed-off-by: Leo Yan leo.yan@arm.com
drivers/hwtracing/coresight/coresight-trbe.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 0ddb3db0213cf0014e29decfb79da68b0a351b31..2f44e4a65e0ee2b2c8fdd06a51ab01fc57f44a4e 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -284,18 +284,10 @@ static void trbe_report_wrap_event(struct perf_output_handle *handle) perf_aux_output_flag(handle, PERF_AUX_FLAG_COLLISION); } -static void trbe_stop_and_truncate_event(struct perf_output_handle *handle) +static void trbe_truncate_event(struct perf_output_handle *handle) { struct trbe_buf *buf = etm_perf_sink_config(handle);
- /*
* We cannot proceed with the buffer collection and we* do not have any data for the current session. The* etm_perf driver expects to close out the aux_buffer* at event_stop(). So disable the TRBE here and leave* the update_buffer() to return a 0 size.*/- trbe_drain_and_disable_local(buf->cpudata); perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); perf_aux_output_end(handle, 0); *this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
@@ -1008,7 +1000,7 @@ static int __arm_trbe_enable(struct trbe_buf *buf, trbe_enable_hw(buf); return 0; err:
- trbe_stop_and_truncate_event(handle);
- trbe_truncate_event(handle); return ret;
} @@ -1169,7 +1161,7 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev) trbe_handle_spurious(handle); break; case TRBE_FAULT_ACT_FATAL:
trbe_stop_and_truncate_event(handle);
truncated = true; break; }trbe_truncate_event(handle);
In arm_trbe_irq_handler() function trbe_drain_and_disable_local() is called early on before TRBE_FAULT_ACT_FATAL gets handled but for the other case __arm_trbe_enable() - do all the code paths leading upto present trbe_stop_and_truncate_event() would have definitely called trbe_drain_and_disable_local() as well ? If yes, please do call out those code paths clearly in the commit message.
Besides it might be worth adding an WARN_ON() in trbe_truncate_event() if the TRBE has not been disabled as now being expected there.