[RFC PATCH powerpc] Set cpu sibling mask before online cpu
Benjamin Herrenschmidt
benh at kernel.crashing.org
Tue Jun 11 17:00:16 EST 2013
On Thu, 2013-05-16 at 18:20 +0800, Li Zhong wrote:
> It seems following race is possible:
>
.../...
> vdso_getcpu_init();
> #endif
> - notify_cpu_starting(cpu);
> - set_cpu_online(cpu, true);
> /* Update sibling maps */
> base = cpu_first_thread_sibling(cpu);
> for (i = 0; i < threads_per_core; i++) {
> - if (cpu_is_offline(base + i))
> + if (cpu_is_offline(base + i) && (cpu != base + i))
> continue;
> cpumask_set_cpu(cpu, cpu_sibling_mask(base + i));
> cpumask_set_cpu(base + i, cpu_sibling_mask(cpu));
> @@ -667,6 +665,10 @@ __cpuinit void start_secondary(void *unused)
> }
> of_node_put(l2_cache);
>
> + smp_wmb();
> + notify_cpu_starting(cpu);
> + set_cpu_online(cpu, true);
> +
So we could have an online CPU with an empty sibling mask. Now we can
have a sibling that isn't online ... Is that ok ?
Or should we do a two pass mechanism:
- Pass 1, set the new cpu siblings
- set_cpu_online
- Pass 2, set other CPU sibling of this cpu
?
Cheers,
Ben.
More information about the Linuxppc-dev
mailing list