From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
pavel@ucw.cz, len.brown@intel.com, mingo@elte.hu,
akpm@linux-foundation.org, suresh.b.siddha@intel.com,
lucas.demarchi@profusion.mobi,
linux-pm@lists.linux-foundation.org, rusty@rustcorp.com.au,
vatsa@linux.vnet.ibm.com, ashok.raj@intel.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] CPU hotplug, freezer: Fix bugs in CPU hotplug call path
Date: Tue, 04 Oct 2011 15:37:20 +0200 [thread overview]
Message-ID: <1317735440.32543.4.camel@twins> (raw)
In-Reply-To: <4E8B09F3.4080800@linux.vnet.ibm.com>
On Tue, 2011-10-04 at 18:58 +0530, Srivatsa S. Bhat wrote:
> +static int tasks_frozen;
> +
> +void set_tasks_frozen_flag(void)
> +{
> + tasks_frozen = 1;
> + smp_mb();
> +}
> +
> +void clear_tasks_frozen_flag(void)
> +{
> + tasks_frozen = 0;
> + smp_mb();
> +}
> +
> +int tasks_are_frozen(void)
> +{
> + return tasks_frozen;
> +}
See Documentation/memory-barriers.txt, memory barriers always come in
pairs, furthermore memory barriers always should have a comment
explaining the ordering and referring to the pair match.
I think you want at least an smp_rmb() before reading tasks_frozen,
possible you also want to use ACCESS_ONCE() to force the compiler to
emit the read.
Furthermore, do you really need this? isn't it both set and read from
the same task context, all under pm_mutex?
next prev parent reply other threads:[~2011-10-04 13:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 19:44 [PATCH] CPU hotplug, freezer: Fix bugs in CPU hotplug call path Srivatsa S. Bhat
2011-10-03 10:03 ` Peter Zijlstra
2011-10-04 13:19 ` Srivatsa S. Bhat
2011-10-04 13:28 ` [PATCH v2] " Srivatsa S. Bhat
2011-10-04 13:37 ` Peter Zijlstra [this message]
2011-10-07 20:56 ` Srivatsa S. Bhat
2011-10-08 12:52 ` Américo Wang
2011-10-08 20:28 ` Srivatsa S. Bhat
2011-10-10 10:48 ` Peter Zijlstra
2011-10-21 11:30 ` Srivatsa S. Bhat
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=1317735440.32543.4.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=ashok.raj@intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=lucas.demarchi@profusion.mobi \
--cc=mingo@elte.hu \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--cc=rusty@rustcorp.com.au \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=suresh.b.siddha@intel.com \
--cc=vatsa@linux.vnet.ibm.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 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.