[PATCH 10/19] coresight: trbe: Always check fault action when updating buffer
James Clark
james.clark at linaro.org
Tue Dec 16 07:34:20 PST 2025
On 01/12/2025 13:22, Leo Yan wrote:
> The current code checks the fault action only via the IRQ status bit,
> which is unreliable due to possible hardware latency.
This makes it sound like it's fixing a bug, but without a fixes: tag I'm
assuming it's not a bug. Also I don't get how the change improves the
latency situation, it still calls trbe_get_fault_act() basically in the
same place. I think there might be another reason like it makes the code
cleaner for a later change? Or the commit message needs some elaboration.
>
> Move the fault action check out of the IRQ status condition. This also
> causes the buffer size to be calculated for non-WRAP and fault cases,
> which is fine since the write pointer is trusted for the calculation.
>
> Signed-off-by: Leo Yan <leo.yan at arm.com>
> ---
> drivers/hwtracing/coresight/coresight-trbe.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index f56ecdeaa6596afb440e4d53732e08a85f9bf89d..e579ea98523c24d23a0cd265dcdd0a46b52b52da 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -806,7 +806,6 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev,
> enum trbe_fault_action act;
> unsigned long size, status;
> unsigned long flags;
> - bool wrap = false;
>
> WARN_ON(buf->cpudata != cpudata);
> WARN_ON(cpudata->cpu != smp_processor_id());
> @@ -858,21 +857,11 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev,
> */
> clr_trbe_irq();
> isb();
> -
> - act = trbe_get_fault_act(handle, status);
> - /*
> - * If this was not due to a WRAP event, we have some
> - * errors and as such buffer is empty.
> - */
> - if (act != TRBE_FAULT_ACT_WRAP) {
> - size = 0;
> - goto done;
> - }
> -
> - wrap = true;
> }
>
> - size = trbe_get_trace_size(handle, buf, wrap);
> + act = trbe_get_fault_act(handle, status);
> +
> + size = trbe_get_trace_size(handle, buf, act == TRBE_FAULT_ACT_WRAP);
>
> done:
> local_irq_restore(flags);
>
More information about the linux-arm-kernel
mailing list