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@arm.com Reviewed-by: Mike Leach mike.leach@linaro.org Tested-by: James Clark james.clark@linaro.org Signed-off-by: Leo Yan leo.yan@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) return true;
return false; }
Only CPU bound device will assign CPU ID, otherwise will set -1.
Thanks, Leo