From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
mingo@elte.hu, linux-kernel@vger.kernel.org,
Oleg Nesterov <oleg@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 2/2] cpuhotplug: introduce try_get_online_cpus()
Date: Wed, 3 Jun 2009 17:16:47 -0700 [thread overview]
Message-ID: <20090604001647.GA9057@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090601161931.GC6698@linux.vnet.ibm.com>
On Mon, Jun 01, 2009 at 09:19:31AM -0700, Paul E. McKenney wrote:
> On Mon, Jun 01, 2009 at 05:01:50PM +0930, Rusty Russell wrote:
> > On Sat, 30 May 2009 06:01:18 am Andrew Morton wrote:
> > > I do think that we should look at
> > > alternative (non-trylocky) ways of fixing them.
> >
> > Speculating: we could add a "keep_cpu()" (FIXME: improve name) which is kind
> > of like get_cpu() only doesn't disable preemption and only stops *this* cpu
> > from going down.
> >
> > Not sure where that gets us, but if someone's going to dig deep into this it
> > might help.
>
> I have been beating up on the approach of disabling preemption to pin down
> a single CPU, and although it is working, it is no faster than simply
> doing get_online_cpus() and it is much much more subtle and complex.
> I am not sure that I have all the races properly accounted for, and I
> am failing to see the point of having something quite this ugly in the
> kernel when much simpler alternatives exist.
>
> The main vulnerability is the possibility that someone will invoke
> synchroniize_rcu_expedited() while holding a mutex that is also acquired
> in a CPU-hotplug notifier, as Lai noted. But this is easily handled
> given a primitive that will say whether the current CPU is executing in a
> CPU-hotplug notifier. This primitive is permitted to sometimes mistakenly
> say that the current CPU is executing in a CPU-hotplug notifier when it
> is not (as long as it doesn't do so too often), but not vice versa.
>
> One way to implement this would be to have such a primitive simply say
> whether or not a CPU-hotplug operation is currently in effect. Yes, this
> is racy, but not when it matters -- you cannot possibly exit a CPU-hotplug
> operation while executing in a CPU-hotplug notifier. For example,
> the following exported from kernel/cpu.c would work just fine:
>
> bool cpu_hotplug_in_progress(void)
> {
> return cpu_hotplug.active_writer != NULL;
> }
>
> I believe that we should be OK moving forward with an updated version of
> http://lkml.org/lkml/2009/5/22/332 even without the deadlock avoidance.
> Having the deadlock avoidance would be better, of course, so I will use
> something like the above on the next patch.
Of course, the above does not actually solve the deadlock, instead
merely making it less likely to occur. I have absolutely no idea what
I was thinking!
Back to try_get_online_cpus().
Thanx, Paul
prev parent reply other threads:[~2009-06-04 0:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-29 8:29 [PATCH 2/2] cpuhotplug: introduce try_get_online_cpus() Lai Jiangshan
2009-05-29 20:31 ` Andrew Morton
2009-06-01 2:42 ` Lai Jiangshan
2009-06-01 7:31 ` Rusty Russell
2009-06-01 16:19 ` Paul E. McKenney
2009-06-04 0:16 ` Paul E. McKenney [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=20090604001647.GA9057@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.