irqchip/riscv-aplic: Process pending affinity changes on EOI
Subsystems (3)
PATCH 1/1 irqchip/riscv-aplic: Process pending affinity changes on EOI
IMSIC rejects an affinity change with -EBUSY while a previous vector move is still in flight, and the IRQ core then records the new mask as pending. The change is meant to be applied by irq_move_irq() in the IMSIC irq_ack callback, but APLIC MSI interrupts are handled by handle_fasteoi_irq(), which does not call irq_ack.
The pending change is therefore never applied. While it is pending, later affinity changes only update the pending mask, so the interrupt stays on its old CPU.
Call the parent's irq_ack from the EOI callback, before retriggering level sources so that they fire at the updated target.
--- drivers/irqchip/irq-riscv-aplic-msi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/irqchip/irq-riscv-aplic-msi.c +5 -2
@@ -57,9 +57,12 @@ static void aplic_msi_irq_retrigger_level(struct irq_data *d)static void aplic_msi_irq_eoi (struct irq_data *d) {/* -* EOI handling is required only for level-triggered interrupts -* when APLIC is in MSI mode. +* The fasteoi flow does not call irq_ack. Let the IMSIC parent +* process affinity moves deferred while its previous vector move +* was still in flight. Both edge and level sources need this. */ +irq_chip_ack_parent (d); +aplic_msi_irq_retrigger_level (d); }
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260909-aplic-affinity-fix-80a4b30bd03e
Best regards,
Signature · 1 line
Troy Mitchell <[email protected]>
Thomas Gleixner
maintainerQuoted 5 lines · Troy Mitchell
IMSIC rejects an affinity change with
-EBUSYwhile a previous vector move is still in flight, and the IRQ core then records the new mask as pending. The change is meant to be applied byirq_move_irq()in the IMSICirq_ackcallback, but APLIC MSI interrupts are handled byhandle_fasteoi_irq(), which does not callirq_ack.
Which is a bug when the interrupt is edge type.
Edge type interrupts are fire and forget from the device point of view. So you want handle_edge_irq() for them, which issues the ack() _before_ the handler is invoked. Otherwise you can lose interrupts.
Thanks,
tglx
Quoted 7 lines · Thomas Gleixner
Quoted 5 lines · Troy Mitchell
IMSIC rejects an affinity change with
-EBUSYwhile a previous vector move is still in flight, and the IRQ core then records the new mask as pending. The change is meant to be applied byirq_move_irq()in the IMSICirq_ackcallback, but APLIC MSI interrupts are handled byhandle_fasteoi_irq(), which does not callirq_ack.
Quoted 5 lines
Which is a bug when the interrupt is edge type.
Edge type interrupts are fire and forget from the device point of view. So you want
handle_edge_irq()for them, which issues theack()_before_ the handler is invoked. Otherwise you can lose interrupts.
Right, I can reproduce the lost edge here. v2 will use handle_edge_irq() for edge sources and handle_fasteoi_ack_irq() for level sources.
Signature · 1 line
Troy Mitchell