[PATCH v2 10/23] coresight: trbe: Drop redundant disables

Suzuki K Poulose suzuki.poulose at arm.com
Fri Nov 27 02:32:04 PST 2026


On 16/10/2026 17:55, Leo Yan wrote:
> The IRQ handler has a common point that disables TRBE before dispatching
> the fault action. Once execution reaches the overflow handling or
> truncate path, the trace buffer has already been stopped.
> 
> The __arm_trbe_enable() error path does not need a disable there either,
> as TRBE is already in disabled state.
> 
> Remove TRBE disable from the truncate helper and from the overflow
> failure path. The truncate helper only needs to mark and end the AUX
> output, so rename it to trbe_truncate_event() to reflect its remaining
> purpose.
> 
> Signed-off-by: Leo Yan <leo.yan at arm.com>

Reviewed-by: Suzuki K Poulose <suzuki.poulose at arm.com>


> ---
>   drivers/hwtracing/coresight/coresight-trbe.c | 15 +++------------
>   1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index dd9c9330bb0c739795f300dafc6ce34e72fbf280..4a041bbc6e970d72a7d735e15f7221037cb091d6 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -301,18 +301,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;
> @@ -1024,7 +1016,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;
>   }
>   
> @@ -1117,7 +1109,6 @@ static int trbe_handle_overflow(struct perf_output_handle *handle)
>   		 * is able to detect this with a disconnected handle
>   		 * (handle->event = NULL).
>   		 */
> -		trbe_drain_and_disable_local(buf->cpudata);
>   		*this_cpu_ptr(buf->cpudata->drvdata->handle) = NULL;
>   		return -EINVAL;
>   	}
> @@ -1208,7 +1199,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;
>   	}
> 




More information about the linux-arm-kernel mailing list