diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2013-05-22 04:24:37 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-05-27 03:16:15 -0400 |
commit | 9acf73b7d06eaa3fbfbfafc9c835f8fe0d751eff (patch) | |
tree | 4b3a71b06a231eb457c30e787a163608bd417ff1 /arch/s390/kernel/smp.c | |
parent | 576ebd74928fd60ae112b33c42b89602015fadbd (diff) |
s390/smp: lost IPIs on cpu hotplug
IPIs might be lost when a cpu gets brought offline:
When stop_machine executes its state machine there is a race window
for the state STOPMACHINE_DISABLE_IRQ where the to be brought offline
cpu might already have irqs disabled but a different cpu still may
have irqs enabled.
If the enabled cpu receives an interrupt and as a result sends an IPI
to the to be offlined cpu in its bottom halve context, the IPI won't
be noticed before the cpu is offline.
In fact the race window is much larger since there is no guarantee
when an IPI will be received.
To fix this check for enqueued but not yet received IPIs in the
cpu_disable() path and call the respective handlers before the cpu
is marked offline.
Reported-by: Juergen Doelle <juergen.doelle@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r-- | arch/s390/kernel/smp.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 05674b669001..4f977d0d25c2 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -428,34 +428,27 @@ void smp_stop_cpu(void) | |||
428 | * This is the main routine where commands issued by other | 428 | * This is the main routine where commands issued by other |
429 | * cpus are handled. | 429 | * cpus are handled. |
430 | */ | 430 | */ |
431 | static void do_ext_call_interrupt(struct ext_code ext_code, | 431 | static void smp_handle_ext_call(void) |
432 | unsigned int param32, unsigned long param64) | ||
433 | { | 432 | { |
434 | unsigned long bits; | 433 | unsigned long bits; |
435 | int cpu; | ||
436 | |||
437 | cpu = smp_processor_id(); | ||
438 | if (ext_code.code == 0x1202) | ||
439 | inc_irq_stat(IRQEXT_EXC); | ||
440 | else | ||
441 | inc_irq_stat(IRQEXT_EMS); | ||
442 | /* | ||
443 | * handle bit signal external calls | ||
444 | */ | ||
445 | bits = xchg(&pcpu_devices[cpu].ec_mask, 0); | ||
446 | 434 | ||
435 | /* handle bit signal external calls */ | ||
436 | bits = xchg(&pcpu_devices[smp_processor_id()].ec_mask, 0); | ||
447 | if (test_bit(ec_stop_cpu, &bits)) | 437 | if (test_bit(ec_stop_cpu, &bits)) |
448 | smp_stop_cpu(); | 438 | smp_stop_cpu(); |
449 | |||
450 | if (test_bit(ec_schedule, &bits)) | 439 | if (test_bit(ec_schedule, &bits)) |
451 | scheduler_ipi(); | 440 | scheduler_ipi(); |
452 | |||
453 | if (test_bit(ec_call_function, &bits)) | 441 | if (test_bit(ec_call_function, &bits)) |
454 | generic_smp_call_function_interrupt(); | 442 | generic_smp_call_function_interrupt(); |
455 | |||
456 | if (test_bit(ec_call_function_single, &bits)) | 443 | if (test_bit(ec_call_function_single, &bits)) |
457 | generic_smp_call_function_single_interrupt(); | 444 | generic_smp_call_function_single_interrupt(); |
445 | } | ||
458 | 446 | ||
447 | static void do_ext_call_interrupt(struct ext_code ext_code, | ||
448 | unsigned int param32, unsigned long param64) | ||
449 | { | ||
450 | inc_irq_stat(ext_code.code == 0x1202 ? IRQEXT_EXC : IRQEXT_EMS); | ||
451 | smp_handle_ext_call(); | ||
459 | } | 452 | } |
460 | 453 | ||
461 | void arch_send_call_function_ipi_mask(const struct cpumask *mask) | 454 | void arch_send_call_function_ipi_mask(const struct cpumask *mask) |
@@ -760,6 +753,8 @@ int __cpu_disable(void) | |||
760 | { | 753 | { |
761 | unsigned long cregs[16]; | 754 | unsigned long cregs[16]; |
762 | 755 | ||
756 | /* Handle possible pending IPIs */ | ||
757 | smp_handle_ext_call(); | ||
763 | set_cpu_online(smp_processor_id(), false); | 758 | set_cpu_online(smp_processor_id(), false); |
764 | /* Disable pseudo page faults on this cpu. */ | 759 | /* Disable pseudo page faults on this cpu. */ |
765 | pfault_fini(); | 760 | pfault_fini(); |