[PATCH v4 5/9] coresight: etm4x: remove redundant call etm4_enable_hw() with hotplug

Jie Gan jie.gan at oss.qualcomm.com
Wed Apr 15 04:59:59 PDT 2026



On 4/13/2026 10:19 PM, Yeoreum Yun wrote:
> The cpu_online_mask is set at the CPUHP_BRINGUP_CPU step.
> In other words, if etm4_enable_sysfs() is called between
> CPUHP_BRINGUP_CPU and CPUHP_AP_ARM_CORESIGHT_STARTING,
> etm4_enable_hw() may be invoked in etm4_enable_sysfs_smp_call()
> and then executed again in etm4_starting_cpu().
> 
> To remove this redundant call, take the hotplug lock before executing
> etm4_enable_sysfs_smp_call().
> 
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
> ---
>   drivers/hwtracing/coresight/coresight-etm4x-core.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 01099689525b..facd5a306228 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -959,8 +959,20 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa
>   	arg.config = drvdata->config;
>   	raw_spin_unlock(&drvdata->spinlock);
>   
> +	/*
> +	 * Take the hotplug lock to prevent redundant calls to etm4_enable_hw().
> +	 *
> +	 * The cpu_online_mask is set at the CPUHP_BRINGUP_CPU step.
> +	 * In other words, if etm4_enable_sysfs() is called between
> +	 * CPUHP_BRINGUP_CPU and CPUHP_AP_ARM_CORESIGHT_STARTING,
> +	 * etm4_enable_hw() may be invoked in etm4_enable_sysfs_smp_call()
> +	 * and then executed again in etm4_starting_cpu().
> +	 */
> +	cpus_read_lock();
>   	ret = smp_call_function_single(drvdata->cpu,
>   				       etm4_enable_sysfs_smp_call, &arg, 1);
> +	cpus_read_unlock();
> +
>   	if (!ret)
>   		ret = arg.rc;
>   	if (!ret)

Reviewed-by: Jie Gan <jie.gan at oss.qualcomm.com>






More information about the linux-arm-kernel mailing list