Linux Documentation
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@linux.dev>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>, Leo Yan <leo.yan@arm.com>,
	Will Deacon <will@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Suyash Mahar <smahar@meta.com>, Amir Ayupov <aaupov@fb.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<coresight@lists.linaro.org>, <linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	<linux-doc@vger.kernel.org>, John Garry <john.garry@linux.dev>
Subject: Re: [PATCH v4 15/19] perf auxtrace: cs-etm: Capture wrapped snapshots
Date: Tue, 24 Nov 2026 22:41:26 +0200	[thread overview]
Message-ID: <8b37f5ea-9427-43f6-8abf-07a36a9bbb72@intel.com> (raw)
In-Reply-To: <20261105-james-cs-unformatted-per-thread-fix-v4-15-7759e0ce2449@linaro.org>

On 05/11/2026 13:45, James Clark wrote:
> find_snapshot() isn't implemented for Coresight, so when a wrap occurs
> we only save from offset 0 to current head, modulo buffer size, rather
> than capturing the whole buffer. Coresight drivers currently use a
> monotonic head pointer even in snapshot mode, which gives a lot more
> information for taking snapshots than a wrapped pointer. It means we
> don't need to search for data at the end of the buffer to guess if a
> wrap has occurred, and we can go back to saving partial buffers after a
> wrap by checking if the next size to take is less than the buffer
> size.
> 
> The drivers will always be able to generate a monotonic head because
> TRBE has a bytes written counter, so even if we stop generating an AUX
> record on every overflow, we can check if the counter indicated an
> overwrite and offset head by a whole buffer size if it wrapped. This
> forces userspace to read the whole buffer rather than between last and
> current head. ETR and other sinks use software double buffering, so can
> continue as they are.
> 
> 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.
> 
> Reviewed-by: Leo Yan <leo.yan@arm.com>
> Tested-by: Leo Yan <leo.yan@arm.com>
> Signed-off-by: James Clark <james.clark@linaro.org>

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>


  reply	other threads:[~2026-11-24 20:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 11:44 [PATCH v4 00/19] perf cs-etm: Per-thread mode fixes and snapshot wrap support James Clark
2026-11-05 11:44 ` [PATCH v4 01/19] perf cs-etm: Fix nVHE per-thread decoding James Clark
2026-11-05 11:44 ` [PATCH v4 02/19] perf cs-etm: Warn for invalid timestamp option James Clark
2026-11-05 11:44 ` [PATCH v4 03/19] perf cs-etm: Turn on context packet timestamps in per-thread mode James Clark
2026-11-05 11:44 ` [PATCH v4 04/19] perf cs-etm: Use per-CPU queues for " James Clark
2026-11-05 11:44 ` [PATCH v4 05/19] perf test: cs-etm: Increase window size in disassembly test James Clark
2026-11-05 11:44 ` [PATCH v4 06/19] perf cs-etm: Don't drop previous target for kernel samples James Clark
2026-11-05 11:44 ` [PATCH v4 07/19] perf python: Expose sample instruction length James Clark
2026-11-05 11:44 ` [PATCH v4 08/19] perf cs-etm: Use instruction length in disassembly script James Clark
2026-11-05 11:44 ` [PATCH v4 09/19] perf cs-etm: Increase default timestamp generation period James Clark
2026-11-05 11:44 ` [PATCH v4 10/19] perf auxtrace: Turn Intel BTS snapshot search into a generic one James Clark
2026-11-24 20:35   ` Adrian Hunter
2026-11-05 11:44 ` [PATCH v4 11/19] perf arm-spe: Use generic snapshot search James Clark
2026-11-05 11:45 ` [PATCH v4 12/19] perf auxtrace: intel-pt: Use common snapshot pointer fixup James Clark
2026-11-24 20:38   ` Adrian Hunter
2026-11-05 11:45 ` [PATCH v4 13/19] perf cs-etm: Queue partial AUX records James Clark
2026-11-05 11:45 ` [PATCH v4 14/19] perf cs-etm: Don't print missing buffers in snapshot mode James Clark
2026-11-05 11:45 ` [PATCH v4 15/19] perf auxtrace: cs-etm: Capture wrapped snapshots James Clark
2026-11-24 20:41   ` Adrian Hunter [this message]
2026-11-05 11:45 ` [PATCH v4 16/19] perf test: Allow infinite named_thread loops James Clark
2026-11-05 11:45 ` [PATCH v4 17/19] perf test: cs-etm: Add test for per-thread mode James Clark
2026-11-05 11:45 ` [PATCH v4 18/19] perf test: cs-etm: Test multiple per-thread threads James Clark
2026-11-05 11:45 ` [PATCH v4 19/19] perf test: cs-etm: Increase snapshot size James Clark
2026-11-05 11:56   ` Leo Yan
2026-11-24 17:35 ` [PATCH v4 00/19] perf cs-etm: Per-thread mode fixes and snapshot wrap support James Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b37f5ea-9427-43f6-8abf-07a36a9bbb72@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=aaupov@fb.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=coresight@lists.linaro.org \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=john.garry@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=leo.yan@linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=smahar@meta.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox