From: Suresh Siddha <suresh.b.siddha@intel.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"trenn@novell.com" <trenn@novell.com>,
"prarit@redhat.com" <prarit@redhat.com>,
"tj@kernel.org" <tj@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Song, Youquan" <youquan.song@intel.com>,
"stable@kernel.org" <stable@kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [patch 1/2] stop_machine: enable __stop_machine() to be called from the cpu online path
Date: Tue, 07 Jun 2011 12:12:37 -0700 [thread overview]
Message-ID: <1307473957.21608.4480.camel@sbsiddha-MOBL3.sc.intel.com> (raw)
In-Reply-To: <4DEE712F.3080800@zytor.com>
On Tue, 2011-06-07 at 11:42 -0700, H. Peter Anvin wrote:
> On 06/07/2011 11:38 AM, Suresh Siddha wrote:
> >
> > This is kind of a false positive. We are just checking if the calling
> > cpu is online/offline (and there is no possible process migration
> > between an online and offline cpu).
> >
>
> Is the state not available in a percpu variable of some sort? If not,
> shouldn't it be rather than indirecting via a CPU number?
This is what I first thought about but the current percpu cpu_state is
arch specific and not all architectures define it.
Thinking a bit more, I should be able to use the stop machine's percpu
thread state and use it here. Something like the appended. I am testing
and will send the modified patches shortly.
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index c78b0c2..97a1770 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -153,7 +153,7 @@ static DEFINE_PER_CPU(struct cpu_stop_work, stop_cpus_work);
*/
int __stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg)
{
- int online = cpu_online(smp_processor_id());
+ int online = percpu_read(cpu_stopper.enabled);
int include_this_offline = 0;
struct cpu_stop_work *work;
struct cpu_stop_done done;
@@ -513,13 +513,13 @@ int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
.active_cpus = cpus };
/* Include the calling cpu that might not be online yet. */
- if (!cpu_online(smp_processor_id()))
+ if (!percpu_read(cpu_stopper.enabled))
smdata.num_threads++;
/* Set the initial state and stop all online cpus. */
set_state(&smdata, STOPMACHINE_PREPARE);
- if (cpu_online(smp_processor_id()))
+ if (percpu_read(cpu_stopper.enabled))
return stop_cpus(cpu_online_mask, stop_machine_cpu_stop,
&smdata);
else
next prev parent reply other threads:[~2011-06-07 19:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 23:16 [patch 0/2] enhance stop machine infrastructure for MTRR rendezvous sequence Suresh Siddha
2011-06-06 23:16 ` [patch 1/2] stop_machine: enable __stop_machine() to be called from the cpu online path Suresh Siddha
2011-06-07 0:19 ` [tip:x86/urgent] x86, stop_machine: Enable " tip-bot for Suresh Siddha
2011-06-07 18:02 ` [patch 1/2] stop_machine: enable " Ingo Molnar
2011-06-07 18:38 ` Suresh Siddha
2011-06-07 18:42 ` H. Peter Anvin
2011-06-07 19:12 ` Suresh Siddha [this message]
2011-06-06 23:16 ` [patch 2/2] x86, mtrr: use __stop_machine() for doing MTRR rendezvous Suresh Siddha
2011-06-07 0:19 ` [tip:x86/urgent] x86, mtrr: Use " tip-bot for Suresh Siddha
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=1307473957.21608.4480.camel@sbsiddha-MOBL3.sc.intel.com \
--to=suresh.b.siddha@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=prarit@redhat.com \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=stable@kernel.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=trenn@novell.com \
--cc=youquan.song@intel.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
all inboxes | Powered by JetHome®