Hi MAthieu,
On Mon, 4 May 2020 at 20:07, Mathieu Poirier mathieu.poirier@linaro.org wrote:
Good day,
On Fri, May 01, 2020 at 03:02:24PM +0100, Mike Leach wrote:
Add default sink selection to the perf trace handling in the etm driver. Uses the select default sink infrastructure to select a sink for the perf session, if no other sink is specified.
Signed-off-by: Mike Leach mike.leach@linaro.org
.../hwtracing/coresight/coresight-etm-perf.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 84f1dcb69827..790fea1952b0 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -226,9 +226,6 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, sink = coresight_get_enabled_sink(true); }
if (!sink)
goto err;
mask = &event_data->mask; /*
@@ -253,6 +250,19 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, continue; }
/*
* No sink provided or found - now search the path from the
* etm to find a suitable default sink.
*/
if (!sink) {
sink = coresight_find_default_sink(csdev);
if (!sink) {
/* couldn't find a sink - remove this cpu */
cpumask_clear_cpu(cpu, mask);
continue;
}
}
/* * Building a path doesn't enable it, it simply builds a * list of devices from source to sink that can be
@@ -267,6 +277,10 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, *etm_event_cpu_path_ptr(event_data, cpu) = path; }
/* no sink found - cannot trace */
if (!sink)
goto err;
Error conditions should be dealt with in the for_each_cpu() loop, right after calling coresight_find_default_sink(). Otherwise errors will be caught only if they happen on the last CPU that is present in the mask.
Yes - looking at this again it is clearly wrong. Will fix.
Mike
/* If we don't have any CPUs ready for tracing, abort */ cpu = cpumask_first(mask); if (cpu >= nr_cpu_ids)
-- 2.17.1