Message ID | 20141209105819.0e847b4b@kryten (mailing list archive) |
---|---|
State | Accepted |
Commit | 7c5c92ed56d932b2c19c3f8aea86369509407d33 |
Delegated to: | Michael Ellerman |
Headers | show |
On Mon, Dec 8, 2014 at 3:58 PM, Anton Blanchard <anton@samba.org> wrote: > Hi Ingo, > >> At that point I thought the previous task_cpu() was somewhat ingrained >> in the scheduler and came up with the patch. If not, we could go on a >> hunt to see what else needs fixing. > > I had another look. The scheduled does indeed make assumptions about the > previous task_cpu, but we have a hammer to fix it up called > select_fallback_rq. > > I annotated select_fallback_rq, and did hit a case where the CPU was > not active. ppc64 patch below. Anton, I'll assume I will get this through the usual powerpc pull requests? > I think x86 have a similar (although harder to hit) issue. Ingo? Linus
On Tue, 2014-12-09 at 12:54 -0800, Linus Torvalds wrote: > On Mon, Dec 8, 2014 at 3:58 PM, Anton Blanchard <anton@samba.org> wrote: > > Hi Ingo, > > > >> At that point I thought the previous task_cpu() was somewhat ingrained > >> in the scheduler and came up with the patch. If not, we could go on a > >> hunt to see what else needs fixing. > > > > I had another look. The scheduled does indeed make assumptions about the > > previous task_cpu, but we have a hammer to fix it up called > > select_fallback_rq. > > > > I annotated select_fallback_rq, and did hit a case where the CPU was > > not active. ppc64 patch below. > > Anton, I'll assume I will get this through the usual powerpc pull requests? Yeah I'll put it in my tree unless Anton objects. cheers
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 71e186d..d40e46e 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -700,7 +700,6 @@ void start_secondary(void *unused) smp_store_cpu_info(cpu); set_dec(tb_ticks_per_jiffy); preempt_disable(); - cpu_callin_map[cpu] = 1; if (smp_ops->setup_cpu) smp_ops->setup_cpu(cpu); @@ -739,6 +738,14 @@ void start_secondary(void *unused) notify_cpu_starting(cpu); set_cpu_online(cpu, true); + /* + * CPU must be marked active and online before we signal back to the + * master, because the scheduler needs to see the cpu_online and + * cpu_active bits set. + */ + smp_wmb(); + cpu_callin_map[cpu] = 1; + local_irq_enable(); cpu_startup_entry(CPUHP_ONLINE);