Messages in this thread | | | Date | Thu, 30 Jul 2015 18:00:58 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH] sched: fix cpu_active_mask/cpu_online_mask race |
| |
On Mon, Jul 27, 2015 at 08:21:28PM +0200, Jan H. Schönherr wrote: > From: Jan H. Schönherr <jschoenh@amazon.de> > > Together, these give us the following non-working solutions: > - secondary CPU sets active before online, because active is assumed to > be a subset of online; > - secondary CPU sets online before active, because the primary CPU > assumes that an online CPU is also active; > - secondary CPU sets online and waits for primary CPU to set active, > because it might deadlock. > > Commit 875ebe940d77 ("powerpc/smp: Wait until secondaries are active & > online") introduces an arch-specific solution to this arch-independent > problem. > > Now, go for a more general solution without explicit waiting and simply > set active twice: once on the secondary CPU after online was set and > once on the primary CPU after online was seen.
Very vile indeed ;-)
> Fixes: 6acbfb96976f ("sched: Fix hotplug vs. set_cpus_allowed_ptr()") > Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Peter Zijlstra <peterz@infradead.org> > --- > kernel/sched/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 78b4bad10..155bb4a 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -5433,6 +5433,7 @@ static int sched_cpu_active(struct notifier_block *nfb, > case CPU_STARTING: > set_cpu_rq_start_time(); > return NOTIFY_OK; > + case CPU_ONLINE:
Not without a big honking comment right there :-)
> case CPU_DOWN_FAILED: > set_cpu_active((long)hcpu, true); > return NOTIFY_OK;
| |