Re: [PATCH v3 15/18] perf auxtrace: cs-etm: Capture wrapped snapshots

From: Leo Yan

Date: Thu Nov 05 2026 - 04:26:35 EST


On Mon, Nov 02, 2026 at 12:15:29PM +0000, James Clark wrote:

> Add auxtrace_record__monotonic_find_snapshot() and use it for Coresight.
> A monotonic head can't be auto-detected in the default find_snapshot()
> by checking if head > buffer size, because before the first wrap a
> monotonic head looks the same as a wrapped one. The search would then
> falsely detect a wrap when head is near the end of the buffer, and the
> wrapped pointer fixup moves 'old' and 'head' a whole buffer ahead of the
> driver's head. With a wrapped head that doesn't matter because only the
> offset within the buffer is used, but with a monotonic head the next
> snapshot would either save already saved data again or drop up to a
> buffer's worth of new data.

As mentioned, the default find_snapshot() can falsely report a wrap,
which now prevents us from using it for the monotonic-head case.
However, I don't think this block consolidation; I see the decision
not to consolidate as a design preference.

If an AUX driver transitions from an arbitrary head to a monotonic head
in the future, we might still need to consolidate the find_snapshot()
implementations.

Reviewed-by: Leo Yan <leo.yan@xxxxxxx>