diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2011-10-30 10:16:38 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-10-30 10:16:41 -0400 |
commit | 1943f53c9ca182fa233e5a17e89ef8e421d7819e (patch) | |
tree | 198ebf12ab17cdc6bdd12386fad95d9c09fb3c83 /arch | |
parent | d3bf37955d46718ee1a7f1fc69f953d2328ba7c2 (diff) |
[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')
-rw-r--r-- | arch/s390/include/asm/smp.h | 5 | ||||
-rw-r--r-- | arch/s390/kernel/ipl.c | 1 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 23 |
3 files changed, 29 insertions, 0 deletions
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h index 045e009fc164..ab47a69fdf07 100644 --- a/arch/s390/include/asm/smp.h +++ b/arch/s390/include/asm/smp.h | |||
@@ -33,6 +33,7 @@ extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; | |||
33 | extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *); | 33 | extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *); |
34 | extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp, | 34 | extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp, |
35 | int from, int to); | 35 | int from, int to); |
36 | extern void smp_restart_with_online_cpu(void); | ||
36 | extern void smp_restart_cpu(void); | 37 | extern void smp_restart_cpu(void); |
37 | 38 | ||
38 | /* | 39 | /* |
@@ -64,6 +65,10 @@ static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) | |||
64 | func(data); | 65 | func(data); |
65 | } | 66 | } |
66 | 67 | ||
68 | static inline void smp_restart_with_online_cpu(void) | ||
69 | { | ||
70 | } | ||
71 | |||
67 | #define smp_vcpu_scheduled (1) | 72 | #define smp_vcpu_scheduled (1) |
68 | 73 | ||
69 | #endif /* CONFIG_SMP */ | 74 | #endif /* CONFIG_SMP */ |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 48c710206366..90769b4bc7f6 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -1738,6 +1738,7 @@ static struct kobj_attribute on_restart_attr = | |||
1738 | 1738 | ||
1739 | void do_restart(void) | 1739 | void do_restart(void) |
1740 | { | 1740 | { |
1741 | smp_restart_with_online_cpu(); | ||
1741 | smp_send_stop(); | 1742 | smp_send_stop(); |
1742 | on_restart_trigger.action->fn(&on_restart_trigger); | 1743 | on_restart_trigger.action->fn(&on_restart_trigger); |
1743 | stop_run(&on_restart_trigger); | 1744 | stop_run(&on_restart_trigger); |
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) | |||
97 | return raw_cpu_stopped(cpu_logical_map(cpu)); | 97 | return raw_cpu_stopped(cpu_logical_map(cpu)); |
98 | } | 98 | } |
99 | 99 | ||
100 | /* | ||
101 | * Ensure that PSW restart is done on an online CPU | ||
102 | */ | ||
103 | void smp_restart_with_online_cpu(void) | ||
104 | { | ||
105 | int cpu; | ||
106 | |||
107 | for_each_online_cpu(cpu) { | ||
108 | if (stap() == __cpu_logical_map[cpu]) { | ||
109 | /* We are online: Enable DAT again and return */ | ||
110 | __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK); | ||
111 | return; | ||
112 | } | ||
113 | } | ||
114 | /* We are not online: Do PSW restart on an online CPU */ | ||
115 | while (sigp(cpu, sigp_restart) == sigp_busy) | ||
116 | cpu_relax(); | ||
117 | /* And stop ourself */ | ||
118 | while (raw_sigp(stap(), sigp_stop) == sigp_busy) | ||
119 | cpu_relax(); | ||
120 | for (;;); | ||
121 | } | ||
122 | |||
100 | void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) | 123 | void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) |
101 | { | 124 | { |
102 | struct _lowcore *lc, *current_lc; | 125 | struct _lowcore *lc, *current_lc; |