summaryrefslogtreecommitdiff
path: root/arch/s390/kernel/smp.c
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2011-10-30 15:16:38 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2011-10-30 15:16:41 +0100
commit1943f53c9ca182fa233e5a17e89ef8e421d7819e (patch)
tree198ebf12ab17cdc6bdd12386fad95d9c09fb3c83 /arch/s390/kernel/smp.c
parentd3bf37955d46718ee1a7f1fc69f953d2328ba7c2 (diff)
downloadkernel-common-1943f53c9ca182fa233e5a17e89ef8e421d7819e.tar.gz
kernel-common-1943f53c9ca182fa233e5a17e89ef8e421d7819e.tar.bz2
kernel-common-1943f53c9ca182fa233e5a17e89ef8e421d7819e.zip
[S390] Force PSW restart on online CPU
PSW restart can be triggered on offline CPUs. If this happens, currently the PSW restart code fails, because functions like smp_processor_id() do not work on offline CPUs. This patch fixes this as follows: If PSW restart is triggered on an offline CPU, the PSW restart (sigp restart) is done a second time on another CPU that is online and the old CPU is stopped afterwards. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.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.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 6ab16ac64d29..e4572601e91e 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -97,6 +97,29 @@ static inline int cpu_stopped(int cpu)
return raw_cpu_stopped(cpu_logical_map(cpu));
}
+/*
+ * Ensure that PSW restart is done on an online CPU
+ */
+void smp_restart_with_online_cpu(void)
+{
+ int cpu;
+
+ for_each_online_cpu(cpu) {
+ if (stap() == __cpu_logical_map[cpu]) {
+ /* We are online: Enable DAT again and return */
+ __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
+ return;
+ }
+ }
+ /* We are not online: Do PSW restart on an online CPU */
+ while (sigp(cpu, sigp_restart) == sigp_busy)
+ cpu_relax();
+ /* And stop ourself */
+ while (raw_sigp(stap(), sigp_stop) == sigp_busy)
+ cpu_relax();
+ for (;;);
+}
+
void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
{
struct _lowcore *lc, *current_lc;