xen/arm: irq: End cleanly spurious interrupt
PATCH 1/1 xen/arm: irq: End cleanly spurious interrupt
no_irq_type handlers are used when an IRQ does not have action attached. This is useful to detect misconfiguration between the interrupt controller and the software.
Currently, all the handlers will do nothing on spurious interrupt. This means if such interrupt is received, the priority of the interrupt will not be dropped and the processor will lose the ability to receive any interrupt lower or equal to the priority.
Spurious interrupt can happen while releasing interrupt assigned to guest (happen during domain destruction). The interaction is roughly
CPU0 CPU1release_guest_irq(A)spin_lock(&desc->lock)gic_remove_irq_from_guest
receive IRQ A
spin_lock(&desc->lock)
desc->handler->shutdown()
set_bit(IRQ_DISABLED)
desc->handler = &no_irq_type
spin_unlock(&desc->lock)
desc->handler->end();
spin_unlock(&desc->lock)Because the no_irq_type.end callback is implemented as a NOP, CPU1 will not drop the priority of the interrupt. So the CPU will not be able to receive any interrupt route to any guest afterwards.
The problem can be prevented by dropping the priority and deactivating the interrupt via gic_hw_ops->gic_host_irq->end().
Note that, for now, interrupt used by Xen are safe because it is not using no_irq_type on release.
--- xen/arch/arm/irq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
xen/arch/arm/irq.c +8 -1
@@ -44,7 +44,14 @@ static void ack_none(struct irq_desc *irq)printk ("unexpected IRQ trap at irq %02x\n" , irq->irq); } -static void end_none (struct irq_desc *irq) { } +static void end_none (struct irq_desc *irq) +{ +/* +* Still allow a CPU to end an interrupt if we receive a spurious +* interrupt. This will prevent the CPU to lose interrupt forever. +*/ + gic_hw_ops->gic_host_irq_type->end (irq); +}hw_irq_controller no_irq_type = { .typename ="none" ,
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 29 lines · Julien Grall
no_irq_typehandlers are used when an IRQ does not have action attached. This is useful to detect misconfiguration between the interrupt controller and the software.Currently, all the handlers will do nothing on spurious interrupt. This means if such interrupt is received, the priority of the interrupt will not be dropped and the processor will lose the ability to receive any interrupt lower or equal to the priority.
Spurious interrupt can happen while releasing interrupt assigned to guest (happen during domain destruction). The interaction is roughly
CPU0 CPU1
release_guest_irq(A)spin_lock(&desc->lock)gic_remove_irq_from_guestreceive IRQ A spin_lock(&desc->lock) desc->handler->shutdown() set_bit(IRQ_DISABLED) desc->handler = &no_irq_type spin_unlock(&desc->lock) desc->handler->end(); spin_unlock(&desc->lock)Because the no_irq_type.end callback is implemented as a NOP, CPU1 will not drop the priority of the interrupt. So the CPU will not be able to receive any interrupt route to any guest afterwards.
Quoted 7 lines
The problem can be prevented by dropping the priority and deactivating the interrupt via
gic_hw_ops->gic_host_irq->end().Note that, for now, interrupt used by Xen are safe because it is not using
no_irq_typeon release.Signed-off-by Julien Grall <[email protected]>
Hi Juergen,
Can I have your relese ack on this fix?
Cheers,
Stefano
Quoted 27 lines
--- xen/arch/arm/irq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)xen/arch/arm/irq.c +8
-1@@ -44,7 +44,14 @@ static void ack_none(struct irq_desc *irq)printk ("unexpected IRQ trap at irq %02x\n" , irq->irq); } -static void end_none (struct irq_desc *irq) { } +static void end_none (struct irq_desc *irq) +{ +/* +* Still allow a CPU to end an interrupt if we receive a spurious +* interrupt. This will prevent the CPU to lose interrupt forever. +*/ + gic_hw_ops->gic_host_irq_type->end (irq); +}hw_irq_controller no_irq_type = { .typename ="none" ,Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 36 lines · Stefano Stabellini
Quoted 35 lines · Julien Grall
no_irq_typehandlers are used when an IRQ does not have action attached. This is useful to detect misconfiguration between the interrupt controller and the software.Currently, all the handlers will do nothing on spurious interrupt. This means if such interrupt is received, the priority of the interrupt will not be dropped and the processor will lose the ability to receive any interrupt lower or equal to the priority.
Spurious interrupt can happen while releasing interrupt assigned to guest (happen during domain destruction). The interaction is roughly
CPU0 CPU1
release_guest_irq(A)spin_lock(&desc->lock)gic_remove_irq_from_guestreceive IRQ A spin_lock(&desc->lock) desc->handler->shutdown() set_bit(IRQ_DISABLED) desc->handler = &no_irq_type spin_unlock(&desc->lock) desc->handler->end(); spin_unlock(&desc->lock)Because the no_irq_type.end callback is implemented as a NOP, CPU1 will not drop the priority of the interrupt. So the CPU will not be able to receive any interrupt route to any guest afterwards.
The problem can be prevented by dropping the priority and deactivating the interrupt via
gic_hw_ops->gic_host_irq->end().Note that, for now, interrupt used by Xen are safe because it is not using
no_irq_typeon release.
Quoted 7 lines
Quoted 1 line
Signed-off-by Julien Grall <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Hi Juergen,
Can I have your relese ack on this fix?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel