[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150730160058.GB19282@twins.programming.kicks-ass.net>
Date: Thu, 30 Jul 2015 18:00:58 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jan H. Schönherr <jschoenh@...zon.de>
Cc: Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Joerg Roedel <jroedel@...e.de>, Borislav Petkov <bp@...en8.de>,
linux-kernel@...r.kernel.org, Lai Jiangshan <laijs@...fujitsu.com>,
Michael Ellerman <mpe@...erman.id.au>,
Anton Blanchard <anton@...ba.org>, Matt Wilson <msw@...zon.com>
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@...zon.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@...zon.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Peter Zijlstra <peterz@...radead.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists