提交 0212f260 编写于 作者: V Vaidyanathan Srinivasan 提交者: Benjamin Herrenschmidt

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: NVaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 8dbce53c
...@@ -140,25 +140,25 @@ static void pseries_mach_cpu_die(void) ...@@ -140,25 +140,25 @@ static void pseries_mach_cpu_die(void)
if (!get_lppaca()->shared_proc) if (!get_lppaca()->shared_proc)
get_lppaca()->donate_dedicated_cpu = 0; get_lppaca()->donate_dedicated_cpu = 0;
get_lppaca()->idle = 0; get_lppaca()->idle = 0;
}
if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
/* /*
* Call to start_secondary_resume() will not return. * Call to start_secondary_resume() will not return.
* Kernel stack will be reset and start_secondary() * Kernel stack will be reset and start_secondary()
* will be called to continue the online operation. * will be called to continue the online operation.
*/ */
start_secondary_resume(); start_secondary_resume();
}
}
} else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) { /* Requested state is CPU_STATE_OFFLINE at this point */
WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
set_cpu_current_state(cpu, CPU_STATE_OFFLINE); set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
unregister_slb_shadow(hard_smp_processor_id(), unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
__pa(get_slb_shadow())); rtas_stop_self();
rtas_stop_self();
}
/* Should never get here... */ /* Should never get here... */
BUG(); BUG();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册