TRBE fills gaps in the AUX buffer before advancing aux_head. Neither perf_aux_output_skip() nor perf_aux_output_end() guarantees ordering of these CPU stores before publishing the new head.
Add smp_wmb() after memset() in __trbe_pad_buf(). This covers alignment padding published by perf_aux_output_skip() and the overwrite erratum padding written by trbe_get_trace_size() before perf_aux_output_end().
Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver") Assisted-by: LLM Signed-off-by: Leo Yan leo.yan@arm.com --- drivers/hwtracing/coresight/coresight-trbe.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index c7cbca45f2debd4047b93283ea9fe5dd9e1f2ebf..b605121b1dcfed9837c15cd92ff4c42515f39eaf 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -362,6 +362,8 @@ static void trbe_stop_and_truncate_event(struct perf_output_handle *handle) static void __trbe_pad_buf(struct trbe_buf *buf, u64 offset, int len) { memset((void *)buf->trbe_base + offset, ETE_IGNORE_PACKET, len); + /* Order the padding stores before publishing the new aux_head. */ + smp_wmb(); }
static void trbe_pad_buf(struct perf_output_handle *handle, int len)