Skip to contentSkip to conversation

x86: pipeline: Fix vector stall after vector error handling

PATCH In review Florian Bezdeka 3 participants 3 messages Nov 8, 2021 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: pipeline: Fix vector stall after vector error handling

Whenever an IRQ was handled for a vector being NULL or in one of the error states the interrupt was not acknowledged at the APIC. That can happen if a vector is cleaned up by one of the device drivers while there is still one IRQ in flight.

This has two effects:
- If the affected vector is re-assigned later, it does not work, the IRQ never makes its way to the CPU
- Interrupts with lower priority are no longer delivered to the CPU

The problem was observed on a quite big Intel XEON machine where some vectors / irqs were temporary used and cleaned up and re-assigned later.

---
 arch/x86/kernel/irq_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/irq_pipeline.c +2 -0
index 48d9959bc11a..63de68141b21 100644
@@ -239,6 +239,8 @@ void arch_handle_irq(struct pt_regs *regs, u8 vector, bool irq_movable)
 	} else {
 		desc = __this_cpu_read(vector_irq[vector]);
 		if (unlikely(IS_ERR_OR_NULL(desc))) {
+			__ack_APIC_irq();
+
 			if (desc == VECTOR_UNUSED) {
 				pr_emerg_ratelimited("%s: %d.%u No irq handler for vector\n",
 						__func__, smp_processor_id(),
Signature · 1 line
2.30.2
#1 lore raw
Quoted 25 lines · Florian Bezdeka

Whenever an IRQ was handled for a vector being NULL or in one of the error states the interrupt was not acknowledged at the APIC. That can happen if a vector is cleaned up by one of the device drivers while there is still one IRQ in flight.

This has two effects:
- If the affected vector is re-assigned later, it does not work, the IRQ never makes its way to the CPU
- Interrupts with lower priority are no longer delivered to the CPU

The problem was observed on a quite big Intel XEON machine where some vectors / irqs were temporary used and cleaned up and re-assigned later.

---
 arch/x86/kernel/irq_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/irq_pipeline.c +0 -0
index 48d9959bc11a..63de68141b21 100644

arch/x86/kernel/irq_pipeline.c void arch_handle_irq(struct pt_regs *regs, u8 vector, bool irq_movable) · line 246

Quoted 8 lines
arch/x86/kernel/irq_pipeline.c +2 -0
@@ -239,6 +239,8 @@ void arch_handle_irq(struct pt_regs *regs, u8 vector, bool irq_movable)
 	} else {
 		desc = __this_cpu_read(vector_irq[vector]);
 		if (unlikely(IS_ERR_OR_NULL(desc))) {
+			__ack_APIC_irq();
+
 			if (desc == VECTOR_UNUSED) {
 				pr_emerg_ratelimited("%s: %d.%u No irq handler for vector\n",
 						__func__, smp_processor_id(),

Nice catch! And very hard work to get there - well done!

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#2 lore raw
In reply to Florian Bezdeka
Quoted 24 lines · Florian Bezdeka

Whenever an IRQ was handled for a vector being NULL or in one of the error states the interrupt was not acknowledged at the APIC. That can happen if a vector is cleaned up by one of the device drivers while there is still one IRQ in flight.

This has two effects:
- If the affected vector is re-assigned later, it does not work, the IRQ never makes its way to the CPU
- Interrupts with lower priority are no longer delivered to the CPU

The problem was observed on a quite big Intel XEON machine where some vectors / irqs were temporary used and cleaned up and re-assigned later.

---
 arch/x86/kernel/irq_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/irq_pipeline.c +0 -0
index 48d9959bc11a..63de68141b21 100644

arch/x86/kernel/irq_pipeline.c void arch_handle_irq(struct pt_regs *regs, u8 vector, bool irq_movable) · line 246

Quoted 8 lines
arch/x86/kernel/irq_pipeline.c +2 -0
@@ -239,6 +239,8 @@ void arch_handle_irq(struct pt_regs *regs, u8 vector, bool irq_movable)
 	} else {
 		desc = __this_cpu_read(vector_irq[vector]);
 		if (unlikely(IS_ERR_OR_NULL(desc))) {
+			__ack_APIC_irq();
+
 			if (desc == VECTOR_UNUSED) {
 				pr_emerg_ratelimited("%s: %d.%u No irq handler for vector\n",
 						__func__, smp_processor_id(),

Ouch. Thanks for digging this. Merged upstream.

Signature · 1 line
Philippe.