linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming
@ 2021-01-28 13:12 Robin Murphy
  2021-01-28 13:12 ` [PATCH 2/2] perf/arm-cmn: Move IRQs when migrating context Robin Murphy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Robin Murphy @ 2021-01-28 13:12 UTC (permalink / raw)
  To: will, mark.rutland; +Cc: linux-arm-kernel

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: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 Documentation/admin-guide/perf/arm-cmn.rst |  2 +-
 drivers/perf/arm-cmn.c                     | 13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/Documentation/admin-guide/perf/arm-cmn.rst b/Documentation/admin-guide/perf/arm-cmn.rst
index 0e4809346014..796e25b7027b 100644
--- a/Documentation/admin-guide/perf/arm-cmn.rst
+++ b/Documentation/admin-guide/perf/arm-cmn.rst
@@ -17,7 +17,7 @@ PMU events
 ----------
 
 The PMU driver registers a single PMU device for the whole interconnect,
-see /sys/bus/event_source/devices/arm_cmn. Multi-chip systems may link
+see /sys/bus/event_source/devices/arm_cmn_0. Multi-chip systems may link
 more than one CMN together via external CCIX links - in this situation,
 each mesh counts its own events entirely independently, and additional
 PMU devices will be named arm_cmn_{1..n}.
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index a76ff594f3ca..f3071b5ddaae 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1502,7 +1502,7 @@ static int arm_cmn_probe(struct platform_device *pdev)
 	struct arm_cmn *cmn;
 	const char *name;
 	static atomic_t id;
-	int err, rootnode, this_id;
+	int err, rootnode;
 
 	cmn = devm_kzalloc(&pdev->dev, sizeof(*cmn), GFP_KERNEL);
 	if (!cmn)
@@ -1549,14 +1549,9 @@ static int arm_cmn_probe(struct platform_device *pdev)
 		.cancel_txn = arm_cmn_end_txn,
 	};
 
-	this_id = atomic_fetch_inc(&id);
-	if (this_id == 0) {
-		name = "arm_cmn";
-	} else {
-		name = devm_kasprintf(cmn->dev, GFP_KERNEL, "arm_cmn_%d", this_id);
-		if (!name)
-			return -ENOMEM;
-	}
+	name = devm_kasprintf(cmn->dev, GFP_KERNEL, "arm_cmn_%d", atomic_fetch_inc(&id));
+	if (!name)
+		return -ENOMEM;
 
 	err = cpuhp_state_add_instance(arm_cmn_hp_state, &cmn->cpuhp_node);
 	if (err)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] perf/arm-cmn: Move IRQs when migrating context
  2021-01-28 13:12 [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Robin Murphy
@ 2021-01-28 13:12 ` Robin Murphy
  2021-01-28 20:14 ` [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Will Deacon
  2021-01-28 21:07 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Robin Murphy @ 2021-01-28 13:12 UTC (permalink / raw)
  To: will, mark.rutland; +Cc: linux-arm-kernel

If we migrate the PMU context to another CPU, we need to remember to
retarget the IRQs as well.

Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/perf/arm-cmn.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index f3071b5ddaae..46defb1dcf86 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1150,7 +1150,7 @@ static int arm_cmn_commit_txn(struct pmu *pmu)
 static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
 {
 	struct arm_cmn *cmn;
-	unsigned int target;
+	unsigned int i, target;
 
 	cmn = hlist_entry_safe(node, struct arm_cmn, cpuhp_node);
 	if (cpu != cmn->cpu)
@@ -1161,6 +1161,8 @@ static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
 		return 0;
 
 	perf_pmu_migrate_context(&cmn->pmu, cpu, target);
+	for (i = 0; i < cmn->num_dtcs; i++)
+		irq_set_affinity_hint(cmn->dtc[i].irq, cpumask_of(target));
 	cmn->cpu = target;
 	return 0;
 }
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming
  2021-01-28 13:12 [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Robin Murphy
  2021-01-28 13:12 ` [PATCH 2/2] perf/arm-cmn: Move IRQs when migrating context Robin Murphy
@ 2021-01-28 20:14 ` Will Deacon
  2021-01-29  0:14   ` Robin Murphy
  2021-01-28 21:07 ` Will Deacon
  2 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2021-01-28 20:14 UTC (permalink / raw)
  To: Robin Murphy; +Cc: mark.rutland, linux-arm-kernel

On Thu, Jan 28, 2021 at 01:12:43PM +0000, Robin Murphy wrote:
> 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: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  Documentation/admin-guide/perf/arm-cmn.rst |  2 +-
>  drivers/perf/arm-cmn.c                     | 13 ++++---------
>  2 files changed, 5 insertions(+), 10 deletions(-)

Hmm, so usually I'd push-back on changes like this because it's a
user-visible change, however in this case we're talking about a pretty
niche PMU and a relatively new driver so I think we should proceed. However,
if anybody complains then we'll need to support them in one way or another.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming
  2021-01-28 13:12 [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Robin Murphy
  2021-01-28 13:12 ` [PATCH 2/2] perf/arm-cmn: Move IRQs when migrating context Robin Murphy
  2021-01-28 20:14 ` [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Will Deacon
@ 2021-01-28 21:07 ` Will Deacon
  2 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2021-01-28 21:07 UTC (permalink / raw)
  To: Robin Murphy, mark.rutland
  Cc: catalin.marinas, kernel-team, linux-arm-kernel, Will Deacon

On Thu, 28 Jan 2021 13:12:43 +0000, Robin Murphy wrote:
> 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.

Applied to will (for-next/perf), thanks!

[1/2] perf/arm-cmn: Fix PMU instance naming
      https://git.kernel.org/will/c/79d7c3dca99f
[2/2] perf/arm-cmn: Move IRQs when migrating context
      https://git.kernel.org/will/c/1c8147ea89c8

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming
  2021-01-28 20:14 ` [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Will Deacon
@ 2021-01-29  0:14   ` Robin Murphy
  0 siblings, 0 replies; 5+ messages in thread
From: Robin Murphy @ 2021-01-29  0:14 UTC (permalink / raw)
  To: Will Deacon; +Cc: mark.rutland, linux-arm-kernel

On 2021-01-28 20:14, Will Deacon wrote:
> On Thu, Jan 28, 2021 at 01:12:43PM +0000, Robin Murphy wrote:
>> 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: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   Documentation/admin-guide/perf/arm-cmn.rst |  2 +-
>>   drivers/perf/arm-cmn.c                     | 13 ++++---------
>>   2 files changed, 5 insertions(+), 10 deletions(-)
> 
> Hmm, so usually I'd push-back on changes like this because it's a
> user-visible change, however in this case we're talking about a pretty
> niche PMU and a relatively new driver so I think we should proceed. However,
> if anybody complains then we'll need to support them in one way or another.

Yeah, I'm kicking myself for not remembering about the aliasing thing 
from the start - it came up tangentially from conversation with some 
interested users the other day - so hopefully the practicality will 
outweigh any possible early-adopter inconvenience.

Thanks,
Robin.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-29  0:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 13:12 [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Robin Murphy
2021-01-28 13:12 ` [PATCH 2/2] perf/arm-cmn: Move IRQs when migrating context Robin Murphy
2021-01-28 20:14 ` [PATCH 1/2] perf/arm-cmn: Fix PMU instance naming Will Deacon
2021-01-29  0:14   ` Robin Murphy
2021-01-28 21:07 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).