From 67fcd2d2e59558a2b0936f35e4b9be10fb5848f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Date: Wed, 3 Sep 2025 13:54:21 +0200 Subject: [PATCH] x86/hpet: do local APIC EOI after interrupt processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(). Reported-by: Andrew Cooper Fixes: 3ba523ff957c ('CPUIDLE: enable MSI capable HPET for timer broadcast') Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper master commit: 1db7829e56578970c1037c4dd1c27f939be4c054 master date: 2025-08-06 10:47:16 +0200 --- xen/arch/x86/hpet.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 9290cf7a42..7e9d996436 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -299,13 +299,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) { @@ -333,7 +326,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, };