Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1196161

Re: [PATCH] sched: fix cpu_active_mask/cpu_online_mask race

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] sched: fix cpu_active_mask/cpu_online_mask race
Date 2015-07-30 18:10 +0200
Message-ID <pRYz7-3ia-7@gated-at.bofh.it> (permalink)
References <pOlaW-5aC-7@gated-at.bofh.it> <pQVjY-1sG-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;
--
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/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] sched: fix cpu_active_mask/cpu_online_mask race Peter Zijlstra <peterz@infradead.org> - 2015-07-30 18:10 +0200
  [PATCH v2] sched: fix cpu_active_mask/cpu_online_mask race Jan H. Schönherr <jschoenh@amazon.de> - 2015-07-30 21:20 +0200

csiph-web