Skip to contentSkip to conversation

prevent powerpc from invoking irq handlers on offline CPUs

PATCH In review Paul E. McKenney 2 participants 5 messages Aug 31, 2008 – Sep 1, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 prevent powerpc from invoking irq handlers on offline CPUs

Make powerpc refrain from clearing a given to-be-offlined CPU's bit in the cpu_online_mask until it has processed pending irqs. This change prevents other CPUs from being blindsided by an apparently offline CPU nevertheless changing globally visible state.

---

 smp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -1
index 5337ca7..1fedd7d 100644
@@ -250,11 +250,11 @@ int generic_cpu_disable(void)
 	if (cpu == boot_cpuid)
 		return -EBUSY;
 
-	cpu_clear(cpu, cpu_online_map);
 #ifdef CONFIG_PPC64
 	vdso_data->processorCount--;
 	fixup_irqs(cpu_online_map);
 #endif
+	cpu_clear(cpu, cpu_online_map);
 	return 0;
 }
 
#1 lore raw
Quoted 7 lines · Paul E. McKenney

Make powerpc refrain from clearing a given to-be-offlined CPU's bit in the cpu_online_mask until it has processed pending irqs. This change prevents other CPUs from being blindsided by an apparently offline CPU nevertheless changing globally visible state.

---

Sounds reasonable... the only possible worry here is if somebody tries an IPI ... The IPI code will and the target CPU mask with the online map, so it may try to send to the to-be-offlined CPU and timeout, no ?

Cheers,
Ben.

Quoted 20 lines
 smp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -1
index 5337ca7..1fedd7d 100644
@@ -250,11 +250,11 @@ int generic_cpu_disable(void)
 	if (cpu == boot_cpuid)
 		return -EBUSY;
 
-	cpu_clear(cpu, cpu_online_map);
 #ifdef CONFIG_PPC64
 	vdso_data->processorCount--;
 	fixup_irqs(cpu_online_map);
 #endif
+	cpu_clear(cpu, cpu_online_map);
 	return 0;
 }
 
#2 lore raw
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Paul E. McKenney

Make powerpc refrain from clearing a given to-be-offlined CPU's bit in the cpu_online_mask until it has processed pending irqs. This change prevents other CPUs from being blindsided by an apparently offline CPU nevertheless changing globally visible state.

Quoted 6 lines
Quoted 2 lines

---

Sounds reasonable... the only possible worry here is if somebody tries an IPI ... The IPI code will and the target CPU mask with the online map, so it may try to send to the to-be-offlined CPU and timeout, no ?

OK. Do we need separate IPI and online masks?

Thanx, Paul

Quoted 24 lines

Cheers,
Ben.

Quoted 20 lines
 smp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/smp.c +1 -1
index 5337ca7..1fedd7d 100644
@@ -250,11 +250,11 @@ int generic_cpu_disable(void)
 	if (cpu == boot_cpuid)
 		return -EBUSY;
 
-	cpu_clear(cpu, cpu_online_map);
 #ifdef CONFIG_PPC64
 	vdso_data->processorCount--;
 	fixup_irqs(cpu_online_map);
 #endif
+	cpu_clear(cpu, cpu_online_map);
 	return 0;
 }
 
#3 lore raw
Quoted 7 lines · Paul E. McKenney
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Paul E. McKenney

Make powerpc refrain from clearing a given to-be-offlined CPU's bit in the cpu_online_mask until it has processed pending irqs. This change prevents other CPUs from being blindsided by an apparently offline CPU nevertheless changing globally visible state.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

---

Sounds reasonable... the only possible worry here is if somebody tries an IPI ... The IPI code will and the target CPU mask with the online map, so it may try to send to the to-be-offlined CPU and timeout, no ?

OK. Do we need separate IPI and online masks?

Shouldn't we already have routed all interrupts to other CPUs anyway ?

IE. The affinity of all interrupts should have been updated. So the only thing we're going to get here are possibly IPIs and decrementer, I don't see it being a big deal making sure we test we are online when receiving it.

Ben.

#4 lore raw
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 14 lines · Paul E. McKenney
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 7 lines · Paul E. McKenney

Make powerpc refrain from clearing a given to-be-offlined CPU's bit in the cpu_online_mask until it has processed pending irqs. This change prevents other CPUs from being blindsided by an apparently offline CPU nevertheless changing globally visible state.

---

Sounds reasonable... the only possible worry here is if somebody tries an IPI ... The IPI code will and the target CPU mask with the online map, so it may try to send to the to-be-offlined CPU and timeout, no ?

Quoted 8 lines
Quoted 1 line

OK. Do we need separate IPI and online masks?

Shouldn't we already have routed all interrupts to other CPUs anyway ?

IE. The affinity of all interrupts should have been updated. So the only thing we're going to get here are possibly IPIs and decrementer, I don't see it being a big deal making sure we test we are online when receiving it.

It did look to me that the CPU removed itself from the interrupt queue before re-enabling interrupts, so makes sense to me...

Thanx, Paul