Skip to contentSkip to conversation

perf: dsu: Allow multiple devices share same IRQ.

PATCH In review Tuan Phan 4 participants 5 messages Mar 18, 2020 – Mar 19, 2020 Arm PMU profiling and debugging

lore
Share & tools
lore

Tuan Phan

author
#0 lore raw

PATCH 1/2 perf: dsu: Allow multiple devices share same IRQ.

Add IRQF_SHARED flag when register IRQ such that multiple dsu devices can share same IRQ.

---
 drivers/perf/arm_dsu_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_dsu_pmu.c +1 -1
index 70968c8..2622900 100644
@@ -700,7 +700,7 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)
 	if (!name)
 		return -ENOMEM;
 	rc = devm_request_irq(&pdev->dev, irq, dsu_pmu_handle_irq,
-			      IRQF_NOBALANCING, name, dsu_pmu);
+			      IRQF_NOBALANCING | IRQF_SHARED, name, dsu_pmu);
 	if (rc) {
 		dev_warn(&pdev->dev, "Failed to request IRQ %d\n", irq);
 		return rc;
Signature · 1 line
2.7.4
maintainer
#1 lore raw

[+Suzuki, since he wrote the driver]

Quoted 24 lines · Tuan Phan

Add IRQF_SHARED flag when register IRQ such that multiple dsu devices can share same IRQ.

---
 drivers/perf/arm_dsu_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_dsu_pmu.c +1 -1
index 70968c8..2622900 100644
@@ -700,7 +700,7 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)
 	if (!name)
 		return -ENOMEM;
 	rc = devm_request_irq(&pdev->dev, irq, dsu_pmu_handle_irq,
-			      IRQF_NOBALANCING, name, dsu_pmu);
+			      IRQF_NOBALANCING | IRQF_SHARED, name, dsu_pmu);
 	if (rc) {
 		dev_warn(&pdev->dev, "Failed to request IRQ %d\n", irq);
 		return rc;
Signature · 1 line
2.7.4

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#2 lore raw
In reply to Tuan Phan
Quoted 4 lines · Tuan Phan

Add IRQF_SHARED flag when register IRQ such that multiple dsu devices can share same IRQ.

I don't think that this makes sense; further I think that this highlights that the current driver doesn't support such a configuration for other reasons.

A DSU instance can only be accessed from a CPU associated with it, since it's accessed via sysregs. The IRQ handler must run on one of those CPUs.

To handle that, the DSU PMU driver will need to gain an understanding of which CPUs are associated with the instance. As it stands the driver seems to assume that there's a single DSU instance, and that all CPUs are affine to that same instance.

So NAK to this patch, given the above.

Thanks,
Mark.

Quoted 20 lines
---
 drivers/perf/arm_dsu_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_dsu_pmu.c +1 -1
index 70968c8..2622900 100644
@@ -700,7 +700,7 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)
 	if (!name)
 		return -ENOMEM;
 	rc = devm_request_irq(&pdev->dev, irq, dsu_pmu_handle_irq,
-			      IRQF_NOBALANCING, name, dsu_pmu);
+			      IRQF_NOBALANCING | IRQF_SHARED, name, dsu_pmu);
 	if (rc) {
 		dev_warn(&pdev->dev, "Failed to request IRQ %d\n", irq);
 		return rc;
Signature · 1 line
2.7.4
maintainer
#3 lore raw
Quoted 10 lines · Mark Rutland
Quoted 4 lines · Tuan Phan

Add IRQF_SHARED flag when register IRQ such that multiple dsu devices can share same IRQ.

I don't think that this makes sense; further I think that this highlights that the current driver doesn't support such a configuration for other reasons.

Quoted 8 lines

A DSU instance can only be accessed from a CPU associated with it, since it's accessed via sysregs. The IRQ handler must run on one of those CPUs.

To handle that, the DSU PMU driver will need to gain an understanding of which CPUs are associated with the instance. As it stands the driver seems to assume that there's a single DSU instance, and that all CPUs are affine to that same instance.

Sorry, I misread dsu_pmu_get_online_cpu_any_but(), multiple instances are handled already.

Quoted 1 line

So NAK to this patch, given the above.

Regardless, this NAK stands.

Thanks,
Mark.

#4 lore raw
Quoted 15 lines · Mark Rutland
Quoted 14 lines · Mark Rutland
Quoted 4 lines · Tuan Phan

Add IRQF_SHARED flag when register IRQ such that multiple dsu devices can share same IRQ.

I don't think that this makes sense; further I think that this highlights that the current driver doesn't support such a configuration for other reasons.

A DSU instance can only be accessed from a CPU associated with it, since it's accessed via sysregs. The IRQ handler must run on one of those CPUs.

Quoted 7 lines
Quoted 4 lines

To handle that, the DSU PMU driver will need to gain an understanding of which CPUs are associated with the instance. As it stands the driver seems to assume that there's a single DSU instance, and that all CPUs are affine to that same instance.

Sorry, I misread dsu_pmu_get_online_cpu_any_but(), multiple instances are handled already.

Oh, so either way it's effectively a rerun of the U8500 problem of having no guarantee that the interrupt will be taken on an appropriate CPU, and losing genuine events as apparently spurious if it isn't. Yeah, that's really really bad... :(

Quoted 3 lines
Quoted 1 line

So NAK to this patch, given the above.

Regardless, this NAK stands.

Agreed, pretending that this might work without significantly more invasive workarounds does more harm than good.

Robin.