On Fri, Aug 21, 2026 at 10:49:09AM +0100, James Clark wrote:
[...]
@@ -2061,10 +2061,20 @@ static int __auxtrace_mmap__read(struct mmap *map, head = auxtrace_mmap__read_head(mm, kernel_is_64_bit);
- if (snapshot && itr->snapshot_has_wrapped) {
err = auxtrace_find_snapshot(itr, mm->idx, mm, data, &head, &old);if (err)return err;
- if (snapshot) {
if (itr->snapshot_has_wrapped) {err = auxtrace_find_snapshot(itr, mm->idx, mm, data, &head, &old);if (err)return err;} else if (itr->monotonic_snapshot_head) {size = head - old;/* Force a full buffer read if a wrap has occurred */if (size > mm->len) {pr_debug3("%s: wrap detected, adjusting old from 0x%"PRIx64" to 0x%"PRIx64"\n",__func__, old, head - mm->len);old = head - mm->len;}}
Wouldn't this be a bug fix, since CoreSight did not have a find_snapshot() callback before this series?
I am wondering whether CoreSight could reuse the common callback introduced by this series. I expect this idea may be pushed back :), however, my concern is more about the overall code complexity.
Reusing a common find_snapshot() mechanism could give us a couple of benefits:
1. Userspace could share the same snapshot/wrap handling, rather than maintaining different mechanisms for different AUX trace.
2. It could also make it easier for the TRBE driver to use circular mode for snapshot, which would avoid IRQ maintenance and many redundant RECORD_AUX records (and avoid the mentioned trigger counter for assistance in snapshot mode).
The monotonic head pointer can simplify some calculations in userspace, but if the common find_snapshot() callback can be extended to handle both arbitrary and monotonic head, seems to me, this is a good chance to simplify the code.
Thanks, Leo