[PATCH v3 12/31] coresight: sysfs: Validate CPU online status for per-CPU sources

Mike Leach mike.leach at linaro.org
Thu Oct 2 05:45:16 PDT 2025


V Minor issue - could this not be part of the previous patch
introducing CPU ID to csdev?

On Mon, 15 Sept 2025 at 11:34, Leo Yan <leo.yan at arm.com> wrote:
>
> The current SysFS flow first enables the links and sink, then rolls back
> to disable them if the source fails to enable. This failure can occur if
> the associated CPU is offline, which causes the SMP call to fail.
>
> Validate whether the associated CPU is online for a per-CPU tracer. If
> the CPU is offline, return -ENODEV and bail out.
>
> Reviewed-by: Yeoreum Yun <yeoreum.yun at arm.com>
> Signed-off-by: Leo Yan <leo.yan at arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-sysfs.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c
> index 5e52324aa9ac7b3de9379bc3f2b349a2cdea83c2..cb02f1bfaf068ec3f50f997bcb94f7d5215ccea8 100644
> --- a/drivers/hwtracing/coresight/coresight-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-sysfs.c
> @@ -162,6 +162,9 @@ static int coresight_validate_source_sysfs(struct coresight_device *csdev,
>                 return -EINVAL;
>         }
>
> +       if (coresight_is_percpu_source(csdev) && !cpu_online(csdev->cpu))
> +               return -ENODEV;
> +
>         return 0;
>  }
>
>
> --
> 2.34.1
>

Reviewed-by: Mike Leach <mike.leach at linaro.org>

--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK



More information about the linux-arm-kernel mailing list