Skip to contentSkip to conversation

coresight: etm: perf: Sink selection using sysfs is deprecated

PATCH In review Linu Cherian 2 participants 3 messages Nov 16, 2020 – Nov 17, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 coresight: etm: perf: Sink selection using sysfs is deprecated

commit bb1860efc817c18fce4112f25f51043e44346d1b upstream.

When commit 6d578258b955 ("coresight: Make sysfs functional on topologies with per core sink")
was merged to stable, this patch was a pre-requisite and got missed out leading to build breakages.

When using the perf interface, sink selection using sysfs is deprecated.

---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm-perf.c +0 -2
index be591b557df9..75379184f391 100644
@@ -222,8 +222,6 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 	if (event->attr.config2) {
 		id = (u32)event->attr.config2;
 		sink = coresight_get_sink_by_id(id);
-	} else {
-		sink = coresight_get_enabled_sink(true);
 	}
 
 	mask = &event_data->mask;
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 coresight: Fix uninitialised pointer bug in etm_setup_aux()

From: Mike Leach <[email protected]>

commit 39a7661dcf655c8198fd5d72412f5030a8e58444 upstream.

Commit [bb1860efc817] changed the sink handling code introducing an uninitialised pointer bug. This results in the default sink selection failing.

Prior to commit:

static void etm_setup_aux(...)

<snip>

        struct coresight_device *sink;

<snip>

        /* First get the selected sink from user space. */
        if (event->attr.config2) {
                id = (u32)event->attr.config2;
                sink = coresight_get_sink_by_id(id);
        } else {
                sink = coresight_get_enabled_sink(true);
        }

<ctd>

*sink always initialised - possibly to NULL which triggers the automatic sink selection.

After commit:

static void etm_setup_aux(...)

<snip>

        struct coresight_device *sink;

<snip>

        /* First get the selected sink from user space. */
        if (event->attr.config2) {
                id = (u32)event->attr.config2;
                sink = coresight_get_sink_by_id(id);
        }

<ctd>

*sink pointer uninitialised when not providing a sink on the perf command line. This breaks later checks to enable automatic sink selection.

Fixes bb1860efc817 ("coresight: etm: perf: Sink selection using sysfs is deprecated")
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etm-perf.c +1 -1
index 75379184f391..9a8d03e62a75 100644
@@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 	u32 id;
 	int cpu = event->cpu;
 	cpumask_t *mask;
-	struct coresight_device *sink;
+	struct coresight_device *sink = NULL;
 	struct etm_event_data *event_data = NULL;
 
 	event_data = alloc_event_data(cpu);
Signature · 1 line
2.25.1
maintainer
#2 lore raw
In reply to Linu Cherian
Quoted 10 lines · Linu Cherian

commit bb1860efc817c18fce4112f25f51043e44346d1b upstream.

When commit 6d578258b955 ("coresight: Make sysfs functional on topologies with per core sink")
was merged to stable, this patch was a pre-requisite and got missed out leading to build breakages.

When using the perf interface, sink selection using sysfs is deprecated.

Quoted 8 lines
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 2 --
 1 file changed, 2 deletions(-)

Both now queued up, thanks.

greg k-h