From: Pranith Kumar <bobby.prani@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org (maintainer:X86 ARCHITECTURE...),
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE...)
Subject: [RFC PATCH] x86: Use volatile semantics for atomic_set()
Date: Mon, 22 Sep 2014 15:39:21 -0400 [thread overview]
Message-ID: <1411414762-32366-1-git-send-email-bobby.prani@gmail.com> (raw)
All the atomic operations have volatile semantics to prevent compiler
reordering. Enforce the same semantics for atomic_set() too.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
arch/x86/include/asm/atomic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index bf20c81..fa92e93 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -36,7 +36,7 @@ static inline int atomic_read(const atomic_t *v)
*/
static inline void atomic_set(atomic_t *v, int i)
{
- v->counter = i;
+ ACCESS_ONCE(v->counter) = i;
}
/**
--
2.1.0
next reply other threads:[~2014-09-22 19:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-22 19:39 Pranith Kumar [this message]
2014-09-22 20:08 ` Peter Zijlstra
2014-09-22 21:42 ` Pranith Kumar
2014-09-23 8:12 ` Peter Zijlstra
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=1411414762-32366-1-git-send-email-bobby.prani@gmail.com \
--to=bobby.prani@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome