Skip to contentSkip to conversation

perf: arm_pmu_acpi: Get rid of the edge-triggered interrupt oddity

PATCH Applied Marc Zyngier 3 participants 3 messages Jul 25 – Aug 2 Arm PMU profiling and debugging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: arm_pmu_acpi: Get rid of the edge-triggered interrupt oddity

The ACPI spec bizarrely indicates that the PMU interrupt can be edge-triggered, which contradicts the very basics of the PMU architecture (SW is required to clear the interrupt condition for the level to drop).

Remove the code parsing this flag and always flag the interrupt as level triggered, no matter what firmware says.

---
 drivers/perf/arm_pmu_acpi.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/perf/arm_pmu_acpi.c +6 -7
index e80f76d95e68b..ca6bf8f86cfe9 100644
@@ -22,7 +22,7 @@ static DEFINE_PER_CPU(int, pmu_irqs);
 static int arm_pmu_acpi_register_irq(int cpu)
 {
 	struct acpi_madt_generic_interrupt *gicc;
-	int gsi, trigger;
+	int gsi;
 
 	gicc = acpi_cpu_get_madt_gicc(cpu);
 
@@ -38,11 +38,6 @@ static int arm_pmu_acpi_register_irq(int cpu)
 	if (!gsi)
 		return 0;
 
-	if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
-		trigger = ACPI_EDGE_SENSITIVE;
-	else
-		trigger = ACPI_LEVEL_SENSITIVE;
-
 	/*
 	 * Helpfully, the MADT GICC doesn't have a polarity flag for the
 	 * "performance interrupt". Luckily, on compliant GICs the polarity is
@@ -53,8 +48,12 @@ static int arm_pmu_acpi_register_irq(int cpu)
 	 * may not match the real polarity, but that should not matter.
 	 *
 	 * Other interrupt controllers are not supported with ACPI.
+	 *
+	 * The spec also indicates that the PMU interrupt can be edge
+	 * triggered, which doesn't make any sense (SW needs to clear the
+	 * interrupt condition for the level to drop). Ignore the silly flag.
 	 */
-	return acpi_register_gsi(NULL, gsi, trigger, ACPI_ACTIVE_HIGH);
+	return acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH);
 }
 
 static void arm_pmu_acpi_unregister_irq(int cpu)
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Marc Zyngier

The ACPI spec bizarrely indicates that the PMU interrupt can be edge-triggered, which contradicts the very basics of the PMU architecture (SW is required to clear the interrupt condition for the level to drop).

Quoted 7 lines

Remove the code parsing this flag and always flag the interrupt as level triggered, no matter what firmware says.

---
 drivers/perf/arm_pmu_acpi.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Thanks,
Zenghui

maintainer Applied
#2 lore raw
In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

The ACPI spec bizarrely indicates that the PMU interrupt can be edge-triggered, which contradicts the very basics of the PMU architecture (SW is required to clear the interrupt condition for the level to drop).

Remove the code parsing this flag and always flag the interrupt as level triggered, no matter what firmware says.

[...]

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

[1/1] perf: arm_pmu_acpi: Get rid of the edge-triggered interrupt oddity

      https://git.kernel.org/arm64/c/e445816a488a

Cheers,

Signature · 5 lines
Will

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