diff options
author | Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> | 2010-02-28 21:58:16 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-03-08 19:57:10 -0500 |
commit | 0212f2602a38e740d5a96aba4cebfc2ebc993ecf (patch) | |
tree | c65166065be1d195ca603b7d71f8ed4f5d32e223 /arch/powerpc/platforms | |
parent | 8dbce53cc249a76e9450708d291fce5a7e29c6a1 (diff) |
powerpc: Move checks in pseries_mach_cpu_die()
Rearrange condition checks for better code readability and
prevention of possible race conditions when
preferred_offline_state can potentially change during the
execution of pseries_mach_cpu_die(). The patch will make
pseries_mach_cpu_die() put cpu in one of the consistent states
and not hit the run over BUG()
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/hotplug-cpu.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 349e0af9389a..fefb7f84800b 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
@@ -140,25 +140,25 @@ static void pseries_mach_cpu_die(void) | |||
140 | if (!get_lppaca()->shared_proc) | 140 | if (!get_lppaca()->shared_proc) |
141 | get_lppaca()->donate_dedicated_cpu = 0; | 141 | get_lppaca()->donate_dedicated_cpu = 0; |
142 | get_lppaca()->idle = 0; | 142 | get_lppaca()->idle = 0; |
143 | } | ||
144 | 143 | ||
145 | if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { | 144 | if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { |
146 | unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); | 145 | unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); |
147 | 146 | ||
148 | /* | 147 | /* |
149 | * Call to start_secondary_resume() will not return. | 148 | * Call to start_secondary_resume() will not return. |
150 | * Kernel stack will be reset and start_secondary() | 149 | * Kernel stack will be reset and start_secondary() |
151 | * will be called to continue the online operation. | 150 | * will be called to continue the online operation. |
152 | */ | 151 | */ |
153 | start_secondary_resume(); | 152 | start_secondary_resume(); |
153 | } | ||
154 | } | ||
154 | 155 | ||
155 | } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) { | 156 | /* Requested state is CPU_STATE_OFFLINE at this point */ |
157 | WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE); | ||
156 | 158 | ||
157 | set_cpu_current_state(cpu, CPU_STATE_OFFLINE); | 159 | set_cpu_current_state(cpu, CPU_STATE_OFFLINE); |
158 | unregister_slb_shadow(hard_smp_processor_id(), | 160 | unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); |
159 | __pa(get_slb_shadow())); | 161 | rtas_stop_self(); |
160 | rtas_stop_self(); | ||
161 | } | ||
162 | 162 | ||
163 | /* Should never get here... */ | 163 | /* Should never get here... */ |
164 | BUG(); | 164 | BUG(); |