[PATCH v6 01/19] coresight: sysfs: Validate CPU online status for per-CPU sources
Suzuki K Poulose
suzuki.poulose at arm.com
Mon Mar 16 07:28:35 PDT 2026
On 16/03/2026 14:02, Leo Yan wrote:
> On Fri, Mar 13, 2026 at 11:03:02AM +0000, Suzuki K Poulose wrote:
>> On 05/03/2026 10:17, Leo Yan 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.
>>>
>>> Populate CPU ID into the coresight_device structure, for components that
>>> are not CPU bound, set this field to -1.
>>>
>>> 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>
>>> Reviewed-by: Mike Leach <mike.leach at linaro.org>
>>> Tested-by: James Clark <james.clark at linaro.org>
>>> Signed-off-by: Leo Yan <leo.yan at arm.com>
>>
>> While this works, how about we make it an explicit buy in from the driver
>> for CPU bound ?
>>
>> e.g., add a flag in the coresight_desc.flags = CORESIGHT_DESC_CPU_BOUND
>>
>> and then desc.cpu describes the associated CPU. Otherwise, defaults to -1.
>> That way you could restrict the changes to only those that need the
>> CPU (ETMx and CTIs ?) Also makes any new driver safe.
>
> Instead of adding a flag, I'd use a helper to check existed flags:
>
> static inline bool coresight_is_cpu_bound(struct coresight_device *csdev)
> {
> if (!csdev)
> return false;
>
> if (coresight_is_percpu_source(csdev))
> return true;
>
> if (csdev->type == CORESIGHT_DEV_TYPE_HELPER &&
> csdev->subtype.helper_subtype == CORESIGHT_DEV_SUBTYPE_HELPER_ECT_CTI)
That works, but if a new device type comes in, we may have to expand the
list. Having a flag makes much more sense and the core driver only does
what has been asked for. I prefer the flags.
Cheers
Suzuki
> return true;
>
> return false;
> }
>
> Only CPU bound device will assign CPU ID, otherwise will set -1.
>
> Thanks,
> Leo
More information about the linux-arm-kernel
mailing list