Commit 6a75a6b8 authored by Milton Miller's avatar Milton Miller Committed by Benjamin Herrenschmidt

powerpc: Use cpu_thread_in_core in smp_init for of_spin_map

We used to assume that even numbered threads were the primary
threads, ie those that would be listed and started as a cpu from
open firmware.  Replace a left over is even (% 2) check with a check
for it being a primary thread and update the comments.

Tested with a debug print on pseries, identical code found for cell.
Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent ed7b2144
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
#endif #endif
/* /*
* The primary thread of each non-boot processor is recorded here before * The Primary thread of each non-boot processor was started from the OF client
* smp init. * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
*/ */
static cpumask_t of_spin_map; static cpumask_t of_spin_map;
...@@ -208,11 +208,7 @@ void __init smp_init_cell(void) ...@@ -208,11 +208,7 @@ void __init smp_init_cell(void)
/* Mark threads which are still spinning in hold loops. */ /* Mark threads which are still spinning in hold loops. */
if (cpu_has_feature(CPU_FTR_SMT)) { if (cpu_has_feature(CPU_FTR_SMT)) {
for_each_present_cpu(i) { for_each_present_cpu(i) {
if (i % 2 == 0) if (cpu_thread_in_core(i) == 0)
/*
* Even-numbered logical cpus correspond to
* primary threads.
*/
cpu_set(i, of_spin_map); cpu_set(i, of_spin_map);
} }
} else { } else {
......
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
/* /*
* The primary thread of each non-boot processor is recorded here before * The Primary thread of each non-boot processor was started from the OF client
* smp init. * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
*/ */
static cpumask_t of_spin_map; static cpumask_t of_spin_map;
...@@ -161,8 +161,7 @@ static void __devinit smp_pSeries_kick_cpu(int nr) ...@@ -161,8 +161,7 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
static int smp_pSeries_cpu_bootable(unsigned int nr) static int smp_pSeries_cpu_bootable(unsigned int nr)
{ {
/* Special case - we inhibit secondary thread startup /* Special case - we inhibit secondary thread startup
* during boot if the user requests it. Odd-numbered * during boot if the user requests it.
* cpus are assumed to be secondary threads.
*/ */
if (system_state < SYSTEM_RUNNING && if (system_state < SYSTEM_RUNNING &&
cpu_has_feature(CPU_FTR_SMT) && cpu_has_feature(CPU_FTR_SMT) &&
...@@ -199,11 +198,7 @@ static void __init smp_init_pseries(void) ...@@ -199,11 +198,7 @@ static void __init smp_init_pseries(void)
/* Mark threads which are still spinning in hold loops. */ /* Mark threads which are still spinning in hold loops. */
if (cpu_has_feature(CPU_FTR_SMT)) { if (cpu_has_feature(CPU_FTR_SMT)) {
for_each_present_cpu(i) { for_each_present_cpu(i) {
if (i % 2 == 0) if (cpu_thread_in_core(i) == 0)
/*
* Even-numbered logical cpus correspond to
* primary threads.
*/
cpu_set(i, of_spin_map); cpu_set(i, of_spin_map);
} }
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment