Skip to contentSkip to conversation

x86/hpet: do local APIC EOI after interrupt processing

PATCH In review Roger Pau Monne 2 participants 2 messages Aug 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hpet: do local APIC EOI after interrupt processing

The current logic in the HPET interrupt ->ack() hook will perform a local APIC EOI ahead of enabling interrupts, possibly leading to recursion in the interrupt handler.

Fix this by doing the local APIC EOI strictly after the window with interrupt enabled, as that prevents the recursion, and would only allow for interrupts with higher priority to be serviced.

Use the generic ack_nonmaskable_msi_irq() and end_nonmaskable_irq() functions, removing the need for hpet_msi_ack().

Fixes 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast')
---
 xen/arch/x86/hpet.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
xen/arch/x86/hpet.c +2 -8
index 192de433cfd1..d05b5eb1361f 100644
@@ -303,13 +303,6 @@ static unsigned int cf_check hpet_msi_startup(struct irq_desc *desc)
 
 #define hpet_msi_shutdown hpet_msi_mask
 
-static void cf_check hpet_msi_ack(struct irq_desc *desc)
-{
-    irq_complete_move(desc);
-    move_native_irq(desc);
-    ack_APIC_irq();
-}
-
 static void cf_check hpet_msi_set_affinity(
     struct irq_desc *desc, const cpumask_t *mask)
 {
@@ -337,7 +330,8 @@ static hw_irq_controller hpet_msi_type = {
     .shutdown   = hpet_msi_shutdown,
     .enable	    = hpet_msi_unmask,
     .disable    = hpet_msi_mask,
-    .ack        = hpet_msi_ack,
+    .ack        = ack_nonmaskable_msi_irq,
+    .end        = end_nonmaskable_irq,
     .set_affinity   = hpet_msi_set_affinity,
 };
 
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Roger Pau Monne

The current logic in the HPET interrupt ->ack() hook will perform a local APIC EOI ahead of enabling interrupts, possibly leading to recursion in the interrupt handler.

Fix this by doing the local APIC EOI strictly after the window with interrupt enabled, as that prevents the recursion, and would only allow for interrupts with higher priority to be serviced.

Quoted 6 lines

Use the generic ack_nonmaskable_msi_irq() and end_nonmaskable_irq() functions, removing the need for hpet_msi_ack().

Fixes 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast')

Good riddance to the mess in our patchqueue cased by this.