Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753127AbbG3QBm (ORCPT ); Thu, 30 Jul 2015 12:01:42 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:42680 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752321AbbG3QBl (ORCPT ); Thu, 30 Jul 2015 12:01:41 -0400 Date: Thu, 30 Jul 2015 18:00:58 +0200 From: Peter Zijlstra To: Jan =?iso-8859-1?Q?H=2E_Sch=F6nherr?= Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, Joerg Roedel , Borislav Petkov , linux-kernel@vger.kernel.org, Lai Jiangshan , Michael Ellerman , Anton Blanchard , Matt Wilson Subject: Re: [PATCH] sched: fix cpu_active_mask/cpu_online_mask race Message-ID: <20150730160058.GB19282@twins.programming.kicks-ass.net> References: <20150720152744.GA7010@nazgul.tnic> <1438021288-12335-1-git-send-email-jschoenh@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1438021288-12335-1-git-send-email-jschoenh@amazon.de> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1866 Lines: 49 On Mon, Jul 27, 2015 at 08:21:28PM +0200, Jan H. Sch?nherr wrote: > From: Jan H. Sch?nherr > > 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 > Cc: Ingo Molnar > Cc: Peter Zijlstra > --- > 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; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/