[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <26841df4-04d5-45d6-b589-e6061db2ad33@arm.com>
Date: Thu, 4 Dec 2025 17:55:03 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: Leo Yan <leo.yan@....com>, Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>, James Clark <james.clark@...aro.org>,
Yeoreum Yun <yeoreum.yun@....com>, Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>, Tamas Petz <tamas.petz@....com>,
Tamas Zsoldos <tamas.zsoldos@....com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>
Cc: coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 02/19] coresight: trbe: Remove redundant disable operation
On 01/12/25 4:51 PM, Leo Yan wrote:
> The trace unit is already disabled when trbe_stop_and_truncate_event()
> is called, so draining and stopping the buffer in the function is
> redundant.
>
> Remove the unnecessary disable operation and rename the function to
> trbe_truncate_event() to better reflect its purpose.
>
> Signed-off-by: Leo Yan <leo.yan@....com>
> ---
> drivers/hwtracing/coresight/coresight-trbe.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 0ddb3db0213cf0014e29decfb79da68b0a351b31..2f44e4a65e0ee2b2c8fdd06a51ab01fc57f44a4e 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -284,18 +284,10 @@ static void trbe_report_wrap_event(struct perf_output_handle *handle)
> perf_aux_output_flag(handle, PERF_AUX_FLAG_COLLISION);
> }
>
> -static void trbe_stop_and_truncate_event(struct perf_output_handle *handle)
> +static void trbe_truncate_event(struct perf_output_handle *handle)
> {
> struct trbe_buf *buf = etm_perf_sink_config(handle);
>
> - /*
> - * We cannot proceed with the buffer collection and we
> - * do not have any data for the current session. The
> - * etm_perf driver expects to close out the aux_buffer
> - * at event_stop(). So disable the TRBE here and leave
> - * the update_buffer() to return a 0 size.
> - */
> - trbe_drain_and_disable_local(buf->cpudata);
> perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
> perf_aux_output_end(handle, 0);
> *this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
> @@ -1008,7 +1000,7 @@ static int __arm_trbe_enable(struct trbe_buf *buf,
> trbe_enable_hw(buf);
> return 0;
> err:
> - trbe_stop_and_truncate_event(handle);
> + trbe_truncate_event(handle);
> return ret;
> }
>
> @@ -1169,7 +1161,7 @@ static irqreturn_t arm_trbe_irq_handler(int irq, void *dev)
> trbe_handle_spurious(handle);
> break;
> case TRBE_FAULT_ACT_FATAL:
> - trbe_stop_and_truncate_event(handle);
> + trbe_truncate_event(handle);
> truncated = true;
> break;
> }
>
In arm_trbe_irq_handler() function trbe_drain_and_disable_local() is
called early on before TRBE_FAULT_ACT_FATAL gets handled but for the
other case __arm_trbe_enable() - do all the code paths leading upto
present trbe_stop_and_truncate_event() would have definitely called
trbe_drain_and_disable_local() as well ? If yes, please do call out
those code paths clearly in the commit message.
Besides it might be worth adding an WARN_ON() in trbe_truncate_event()
if the TRBE has not been disabled as now being expected there.
Powered by blists - more mailing lists