public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Yong Zhang <yong.zhang0@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: migrate_disable() race with cpu hotplug?
Date: Thu, 28 Jul 2011 08:55:07 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1107280853500.2660@ionos> (raw)
In-Reply-To: <20110728031600.GA338@windriver.com>

On Thu, 28 Jul 2011, Yong Zhang wrote:

> On Wed, Jul 27, 2011 at 11:52:18PM +0200, Thomas Gleixner wrote:
> > On Tue, 26 Jul 2011, Yong Zhang wrote:
> > 
> > > When reading the code, I'm afraid there is a race between migrate_disable()
> > > and cpu hotplug. A scenario will like below:
> > > 
> > > 	CPU0			CPU1
> > > _cpu_down();
> > >   cpu_unplug_begin();
> > >     wait_for_completion()
> > >   			sync_unplug_thread();
> > > 			  complete();
> > > 			race_window? /*
> > > 				      * migrate_disable() will
> > > 				      * not take effect since
> > > 				      * hotplug is in progress
> > > 				      */
> > 
> > Rightfully so. The caller will just block on the cpu_hotplug.lock
> > mutex until the unplug operation will be done.
> 
> Yup, just notice the mutex_lock/mutex_unlock in pin_current_cpu().
> 
> But if the caller block on mutex_lock() then waked up, it's possible
> that it's been migrated to another cpu. So in the 'retry' loop, we
> should reget hotplug_pcp.

Ooops, that was the original plan. I somehow managed to fatfinger
that. Good catch.
 
Thanks,

	tglx

      reply	other threads:[~2011-07-28  6:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  8:59 migrate_disable() race with cpu hotplug? Yong Zhang
2011-07-27 21:52 ` Thomas Gleixner
2011-07-28  3:16   ` Yong Zhang
2011-07-28  6:55     ` Thomas Gleixner [this message]

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=alpine.LFD.2.02.1107280853500.2660@ionos \
    --to=tglx@linutronix.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=yong.zhang0@gmail.com \
    /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