[PATCH v2 17/23] coresight: trbe: Calculate trace size across buffer wrap
Suzuki K Poulose
suzuki.poulose at arm.com
Tue Dec 1 03:34:13 PST 2026
On 16/10/2026 17:55, Leo Yan wrote:
> trbe_get_trace_size() assumes that the TRBE write pointer is always ahead
> of the perf AUX head. That is not true after a WRAP event, where the write
> pointer can move back to the start of the programmed TRBE span.
>
> Calculate the size in two parts for WRAP: the bytes from the current AUX
> head to TRBLIMITR_EL1, plus any bytes from TRBBASER_EL1 to the current
> TRBPTR_EL1. Keep the non-WRAP path strict and reject an unexpected write
> pointer below the AUX head.
>
> For CPUs affected by the overwrite-fill-mode or write-out-of-range errata,
> continue to ignore TRBPTR_EL1 on WRAP and account data only up to
> TRBLIMITR_EL1, since bytes beyond the programmed limit are uncertain.
>
> Apply this fallback before validating the write pointer so a WRAP report
> with a pointer outside the programmed range still publishes the trace
> from the AUX head to the programmed limit.
>
> Signed-off-by: Leo Yan <leo.yan at arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose at arm.com>
More information about the linux-arm-kernel
mailing list