[PATCH 07/19] coresight: trbe: Refactor AUX flag setting
Leo Yan
leo.yan at arm.com
Wed Dec 10 07:43:08 PST 2025
On Tue, Dec 09, 2025 at 01:37:39PM +0000, James Clark wrote:
[...]
> > + if (!is_trbe_running(trbsr))
> > + perf_aux_output_flag(handle, PERF_AUX_FLAG_COLLISION);
> > +
>
> Do we need the complexity of COLLISION (changed to PARTIAL in a later
> commit) and TRUNCATED at the same time?
> From my understanding, TRUNCATED would be when Perf is too slow and we want
> to disable the event for it to catch up, and PARTIAL is when there was some
> buffer error so technically we don't need the event to be disabled, but Perf
> still needs to be notified if we want to start only resetting the decoder
> when a flag is set rather than on all aux records?
The main difference between the TRUNCATED flag and the COLLISION/PARTIAL
flags is that the TRUNCATED flag implicitly asks the event core layer to
disable the PMU event. In contrast, the COLLISION and PARTIAL flags are
only stored in AUX record and no additional action in the event core
layer.
Setting the TRUNCATED flag would be a over-killer if the buffer has
free space, as it would run the expensive sequence of disabling both ETE
and TRBE and then requiring userspace to re-enable them.
> There is no happy path where there is a buffer error, so I'm not sure why we
> need the complexity of an extra case? There's no harm in disabling the event
> on a buffer error. Also it's hard to see what the exact scenario for PARTIAL
> is, because we set truncated anyway for fatal statuses. The comment in the
> later commit for the PARTIAL change just says "trace was stopped", but not
> why.
The trace can be stopped on Fill mode (stop on wrap) or Stop on trigger, so
it is not (only) about buffer error. In these cases, even though the trace
unit is stopped, the buffer may still have space available, tracing can be
directly re-enabled in interrupt handler, thus the COLLISION/PARTIAL flags
are better choices.
Only when the buffer is actually used out (i.e., handle->size == 0), it is
appropriate to set TRUNCATED flag, since at that point we must wait for
userspace to read out the data.
Thanks,
Leo
More information about the linux-arm-kernel
mailing list