mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Jan H. Schönherr" <jschoenh@amazon.de>
Cc: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Joerg Roedel <jroedel@suse.de>,
	Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Anton Blanchard <anton@samba.org>, Matt Wilson <msw@amazon.com>
Subject: Re: [PATCH] sched: fix cpu_active_mask/cpu_online_mask race
Date: Thu, 30 Jul 2015 18:00:58 +0200	[thread overview]
Message-ID: <20150730160058.GB19282@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1438021288-12335-1-git-send-email-jschoenh@amazon.de>

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;

  reply	other threads:[~2015-07-30 16:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16  9:17 [PATCH] x86/smpboot: Check for cpu_active on cpu initialization Joerg Roedel
2015-07-20 14:46 ` Borislav Petkov
2015-07-20 15:02   ` Joerg Roedel
2015-07-20 15:10     ` Borislav Petkov
2015-07-20 15:18       ` Joerg Roedel
2015-07-20 15:27         ` Borislav Petkov
2015-07-27 18:21           ` [PATCH] sched: fix cpu_active_mask/cpu_online_mask race Jan H. Schönherr
2015-07-30 16:00             ` Peter Zijlstra [this message]
2015-07-30 19:17               ` [PATCH v2] " Jan H. Schönherr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150730160058.GB19282@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=anton@samba.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jroedel@suse.de \
    --cc=jschoenh@amazon.de \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=msw@amazon.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®