From: James Clark <james.clark@linaro.org>
To: Leo Yan <leo.yan@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Yeoreum Yun <yeoreum.yun@arm.com>, Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Tamas Petz <tamas.petz@arm.com>,
Tamas Zsoldos <tamas.zsoldos@arm.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH 07/19] coresight: trbe: Refactor AUX flag setting
Date: Tue, 9 Dec 2025 13:37:39 +0000 [thread overview]
Message-ID: <a638f74f-94bc-4052-b8e1-e940aca2d4ce@linaro.org> (raw)
In-Reply-To: <20251201-trbe_buffer_refactor_v1-1-v1-7-7da32b076b28@arm.com>
On 01/12/2025 11:21 am, Leo Yan wrote:
> Rather than spreading AUX flag setting in different functions, use
> trbe_get_fault_act() as a central place for setting the flag.
>
> Later we will support WRAP mode with continuous trace, so the WRAP
> event does not necessarily cause the trace discontinuity, change to
> check the stop status instead.
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-trbe.c | 38 +++++++++++++---------------
> 1 file changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 28e2bfa68074f19ccaa4a737d00af577aea818fe..b06885a08e082fd34f68d9588518807b5c47c86e 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -265,25 +265,6 @@ static void trbe_reset_local(struct trbe_cpudata *cpudata)
> write_sysreg_s(0, SYS_TRBSR_EL1);
> }
>
> -static void trbe_report_wrap_event(struct perf_output_handle *handle)
> -{
> - /*
> - * Mark the buffer to indicate that there was a WRAP event by
> - * setting the COLLISION flag. This indicates to the user that
> - * the TRBE trace collection was stopped without stopping the
> - * ETE and thus there might be some amount of trace that was
> - * lost between the time the WRAP was detected and the IRQ
> - * was consumed by the CPU.
> - *
> - * Setting the TRUNCATED flag would move the event to STOPPED
> - * state unnecessarily, even when there is space left in the
> - * ring buffer. Using the COLLISION flag doesn't have this side
> - * effect. We only set TRUNCATED flag when there is no space
> - * left in the ring buffer.
> - */
> - perf_aux_output_flag(handle, PERF_AUX_FLAG_COLLISION);
> -}
> -
> static void trbe_truncate_event(struct perf_output_handle *handle)
> {
> struct trbe_buf *buf = etm_perf_sink_config(handle);
> @@ -687,6 +668,23 @@ static enum trbe_fault_action trbe_get_fault_act(struct perf_output_handle *hand
> goto out_fatal;
> }
>
> + /*
> + * Mark the buffer to indicate that there was a WRAP event by
> + * setting the COLLISION flag. This indicates to the user that
> + * the TRBE trace collection was stopped without stopping the
> + * ETE and thus there might be some amount of trace that was
> + * lost between the time the WRAP was detected and the IRQ
> + * was consumed by the CPU.
> + *
> + * Setting the TRUNCATED flag would move the event to STOPPED
> + * state unnecessarily, even when there is space left in the
> + * ring buffer. Using the COLLISION flag doesn't have this side
> + * effect. We only set TRUNCATED flag when there is no space
> + * left in the ring buffer.
> + */
> + 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?
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.
> if (is_trbe_wrap(trbsr))
> return TRBE_FAULT_ACT_WRAP;
>
> @@ -878,7 +876,6 @@ static unsigned long arm_trbe_update_buffer(struct coresight_device *csdev,
> goto done;
> }
>
> - trbe_report_wrap_event(handle);
> wrap = true;
> }
>
> @@ -1099,7 +1096,6 @@ static int trbe_handle_overflow(struct perf_output_handle *handle)
> if (buf->snapshot)
> handle->head += size;
>
> - trbe_report_wrap_event(handle);
> perf_aux_output_end(handle, size);
> event_data = perf_aux_output_begin(handle, event);
> if (!event_data) {
>
next prev parent reply other threads:[~2025-12-09 13:37 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 11:21 [PATCH 00/19] coresight: trbe: Support trigger and circle buffer modes Leo Yan
2025-12-01 11:21 ` [PATCH 01/19] coresight: trbe: Use helpers for checking errata Leo Yan
2025-12-04 12:08 ` Anshuman Khandual
2025-12-01 11:21 ` [PATCH 02/19] coresight: trbe: Remove redundant disable operation Leo Yan
2025-12-04 12:25 ` Anshuman Khandual
2025-12-01 11:21 ` [PATCH 03/19] coresight: trbe: Remove buffer disabling in trbe_handle_overflow() Leo Yan
2025-12-04 12:31 ` Anshuman Khandual
2025-12-01 11:21 ` [PATCH 04/19] coresight: trbe: Remove set_trbe_disabled() from the enable flow Leo Yan
2025-12-04 12:43 ` Anshuman Khandual
2025-12-04 13:25 ` Leo Yan
2025-12-01 11:21 ` [PATCH 05/19] coresight: trbe: Refactor status clearing Leo Yan
2025-12-04 12:57 ` Anshuman Khandual
2025-12-09 15:29 ` Leo Yan
2025-12-01 11:21 ` [PATCH 06/19] coresight: trbe: Refactor syndrome decoding Leo Yan
2025-12-02 11:06 ` Suzuki K Poulose
2025-12-02 14:24 ` Leo Yan
2025-12-09 13:17 ` James Clark
2025-12-09 16:06 ` Leo Yan
2025-12-05 4:10 ` Anshuman Khandual
2025-12-09 15:57 ` Leo Yan
2025-12-01 11:21 ` [PATCH 07/19] coresight: trbe: Refactor AUX flag setting Leo Yan
2025-12-02 11:15 ` Suzuki K Poulose
2025-12-02 14:21 ` Leo Yan
2025-12-09 13:37 ` James Clark [this message]
2025-12-10 15:43 ` Leo Yan
2025-12-12 14:50 ` James Clark
2025-12-12 15:27 ` Leo Yan
2025-12-12 15:52 ` James Clark
2025-12-01 11:21 ` [PATCH 08/19] coresight: trbe: Use PERF_AUX_FLAG_PARTIAL instead of PERF_AUX_FLAG_COLLISION Leo Yan
2025-12-05 4:28 ` Anshuman Khandual
2025-12-09 13:40 ` James Clark
2025-12-10 16:19 ` Leo Yan
2025-12-01 11:21 ` [PATCH 09/19] coresight: trbe: Add fault action argument to trbe_handle_overflow() Leo Yan
2025-12-01 11:22 ` [PATCH 10/19] coresight: trbe: Always check fault action when updating buffer Leo Yan
2025-12-02 12:00 ` Suzuki K Poulose
2025-12-01 11:22 ` [PATCH 11/19] coresight: trbe: Apply overwrite erratum for only wrap event Leo Yan
2025-12-02 12:05 ` Suzuki K Poulose
2025-12-02 16:56 ` Leo Yan
2025-12-02 17:12 ` Leo Yan
2025-12-01 11:22 ` [PATCH 12/19] coresight: trbe: Calculate size for buffer wrapping Leo Yan
2025-12-01 11:22 ` [PATCH 13/19] coresight: trbe: Remove misleading comment Leo Yan
2025-12-01 11:22 ` [PATCH 14/19] coresight: trbe: Refactor compute_trbe_buffer_limit() Leo Yan
2025-12-01 11:22 ` [PATCH 15/19] coresight: trbe: Add static key for bypassing trigger mode Leo Yan
2025-12-02 12:10 ` Suzuki K Poulose
2025-12-01 11:22 ` [PATCH 16/19] coresight: trbe: Support " Leo Yan
2025-12-01 11:22 ` [PATCH 17/19] coresight: trbe: Enable circle mode for snapshot Leo Yan
2025-12-01 11:22 ` [PATCH 18/19] coresight: trbe: Add kunit tests Leo Yan
2025-12-01 11:22 ` [PATCH 19/19] perf: cs-etm: Set watermark for AUX trace Leo Yan
2025-12-05 4:48 ` Anshuman Khandual
2025-12-09 14:54 ` James Clark
2025-12-10 2:22 ` Anshuman Khandual
2025-12-05 4:53 ` [PATCH 00/19] coresight: trbe: Support trigger and circle buffer modes Anshuman Khandual
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=a638f74f-94bc-4052-b8e1-e940aca2d4ce@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=anshuman.khandual@arm.com \
--cc=coresight@lists.linaro.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@linaro.org \
--cc=namhyung@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=tamas.petz@arm.com \
--cc=tamas.zsoldos@arm.com \
--cc=will@kernel.org \
--cc=yeoreum.yun@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).