[PATCH v3 24/31] coresight: Add per-CPU path pointer
Leo Yan
leo.yan at arm.com
Fri Oct 3 09:39:40 PDT 2025
On Thu, Oct 02, 2025 at 03:22:17PM +0100, Mike Leach wrote:
[...]
> > +static DEFINE_PER_CPU(struct coresight_path *, csdev_cpu_path);
>
> This replicates the per-cpu tracer_path variable in coresight-sysfs.c
> - seems there should be a way to combine them.
> This is also set / unset on enable / disable
Good question.
I considered this and piloted change, but I gave up. The main reason is
that coresight-sysfs.c not only maintains paths for CPU bound sources;
it also needs to retrieve the path pointer for uncore sources.
Consolidating all of this would make this series complex.
In next spin, I will try to export a helper, like
coresight_get_path(csdev), to retrieve path pointer for per-CPU source.
[...]
> > +int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
> > + void *sink_data)
> > +{
> > + int ret;
> > + struct coresight_device *source;
> > +
> > + ret = _coresight_enable_path(path, mode, sink_data);
> > + if (ret)
> > + return ret;
> > +
> > + source = coresight_get_source(path);
> > + if (coresight_is_percpu_source(source))
> > + per_cpu(csdev_cpu_path, source->cpu) = path;
>
>
> why is this in a refactored function for enable() but not disable().
> Seems that the original coresight_enable_path() creates a 'source'
> variable, so just the two lines
>
> if (coresight_is_percpu_source(source))
> per_cpu(csdev_cpu_path, source->cpu) = path;
It would be (checking for only success case):
if (!ret && coresight_is_percpu_source(source))
per_cpu(csdev_cpu_path, source->cpu) = path;
> added to the original function acheives the same thing with less churn
Okay, will do.
Thanks,
Leo
More information about the linux-arm-kernel
mailing list