From: Linus Torvalds <torvalds@linux-foundation.org>
To: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
Nathan Lynch <nathanl@austin.ibm.com>,
Joel Schopp <jschopp@austin.ibm.com>,
Ashok Raj <ashok.raj@intel.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Gautham R Shenoy <ego@in.ibm.com>,
akpm@linux-foundation.org, Dipankar <dipankar@in.ibm.com>
Subject: Re: CPU hotplug: system hang on CPU hot remove during `pfmon --system-wide'
Date: Tue, 29 May 2007 13:56:24 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.98.0705291347320.26602@woody.linux-foundation.org> (raw)
In-Reply-To: <20070528065550.GL6157@in.ibm.com>
On Mon, 28 May 2007, Srivatsa Vaddagiri wrote:
>
> So is it settled now on what approach we are going to follow (freezer
> vs lock based) for cpu hotplug? I thought that Linus was not favouring freezer
> based approach sometime back ..
As far as I'm concerned, we should
- use "preempt_disable()" to protect against CPU's coming and going
- use "stop_machine()" or similar that already honors preemption, and
which I trust a whole lot more than freezer.
- .. especially since this is already how we are supposed to be protected
against CPU's going away, and we've already started doing that (for an
example of this, see things like e18f3ffb9c from Andrew)
It really does seem fairly straightforward to make "__cpu_up()" be called
through stop_machine too. Looking at _cpu_down:
mutex_lock(&cpu_bitmask_lock);
p = __stop_machine_run(take_cpu_down, NULL, cpu);
mutex_unlock(&cpu_bitmask_lock);
and then looking at _cpu_up:
mutex_lock(&cpu_bitmask_lock);
ret = __cpu_up(cpu);
mutex_unlock(&cpu_bitmask_lock);
I just go "Aww, wouldn't it be nice to just make that "__cpu_up()" call be
done through __stop_machine_run() too?"
Hmm?
Then, you could get the "cpu_bitmask_lock" if you need to sleep, but if
you don't want to do that (and quite often you don't), just doing a
"preempt_disable()" or taking a spinlock will *also* guarantee that no new
CPU's suddenly show up, so it's safe to look at the CPU online bitmasks.
Do we really need anything else?
As mentioned, it's actually fairly easy to add verification calls to make
sure that certain accesses are done with preemption disabled, so..
Linus
next prev parent reply other threads:[~2007-05-29 20:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 1:54 Satoru Takeuchi
2007-05-28 6:55 ` Srivatsa Vaddagiri
2007-05-29 20:56 ` Linus Torvalds [this message]
2007-05-30 2:42 ` Rusty Russell
2007-05-30 16:55 ` Srivatsa Vaddagiri
2007-05-30 17:03 ` Linus Torvalds
2007-05-31 16:51 ` Srivatsa Vaddagiri
2007-06-06 15:24 ` Gautham R Shenoy
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.0.98.0705291347320.26602@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=ashok.raj@intel.com \
--cc=dipankar@in.ibm.com \
--cc=ego@in.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=jschopp@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nathanl@austin.ibm.com \
--cc=rusty@rustcorp.com.au \
--cc=takeuchi_satoru@jp.fujitsu.com \
--cc=vatsa@in.ibm.com \
--cc=zwane@arm.linux.org.uk \
/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®