Skip to content

Commit 1ea83d4

Browse files
rmurphy-armgregkh
authored andcommitted
perf/arm-cmn: Fix PMU instance naming
[ Upstream commit 79d7c3d ] Although it's neat to avoid the suffix for the typical case of a single PMU, it means systems with multiple CMN instances end up with inconsistent naming. I think it also breaks perf tool's "uncore alias" logic if the common instance prefix is also the full name of one. Avoid any surprises by not trying to be clever and simply numbering every instance, even when it might technically prove redundant. Fixes: 0ba6477 ("perf: Add Arm CMN-600 PMU driver") Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/649a2281233f193d59240b13ed91b57337c77b32.1611839564.git.robin.murphy@arm.com Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent cb8e225 commit 1ea83d4

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

Documentation/admin-guide/perf/arm-cmn.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PMU events
1717
----------
1818

1919
The PMU driver registers a single PMU device for the whole interconnect,
20-
see /sys/bus/event_source/devices/arm_cmn. Multi-chip systems may link
20+
see /sys/bus/event_source/devices/arm_cmn_0. Multi-chip systems may link
2121
more than one CMN together via external CCIX links - in this situation,
2222
each mesh counts its own events entirely independently, and additional
2323
PMU devices will be named arm_cmn_{1..n}.

drivers/perf/arm-cmn.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ static int arm_cmn_probe(struct platform_device *pdev)
15021502
struct arm_cmn *cmn;
15031503
const char *name;
15041504
static atomic_t id;
1505-
int err, rootnode, this_id;
1505+
int err, rootnode;
15061506

15071507
cmn = devm_kzalloc(&pdev->dev, sizeof(*cmn), GFP_KERNEL);
15081508
if (!cmn)
@@ -1549,14 +1549,9 @@ static int arm_cmn_probe(struct platform_device *pdev)
15491549
.cancel_txn = arm_cmn_end_txn,
15501550
};
15511551

1552-
this_id = atomic_fetch_inc(&id);
1553-
if (this_id == 0) {
1554-
name = "arm_cmn";
1555-
} else {
1556-
name = devm_kasprintf(cmn->dev, GFP_KERNEL, "arm_cmn_%d", this_id);
1557-
if (!name)
1558-
return -ENOMEM;
1559-
}
1552+
name = devm_kasprintf(cmn->dev, GFP_KERNEL, "arm_cmn_%d", atomic_fetch_inc(&id));
1553+
if (!name)
1554+
return -ENOMEM;
15601555

15611556
err = cpuhp_state_add_instance(arm_cmn_hp_state, &cmn->cpuhp_node);
15621557
if (err)

0 commit comments

Comments
 (0)