From: "H. Peter Anvin" <hpa@zytor.com>
To: Pranith Kumar <bobby.prani@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: cmpxchg_double: Add missing memory clobber
Date: Tue, 6 Oct 2015 13:16:46 -0700 [thread overview]
Message-ID: <56142C2E.20308@zytor.com> (raw)
In-Reply-To: <1444157670-19951-1-git-send-email-bobby.prani@gmail.com>
On 10/06/2015 11:54 AM, Pranith Kumar wrote:
> We are reading from memory locations pointed to by p1 and p2 in the asm
> block. Add a memory clobber flag to make gcc aware of this.
>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
> arch/x86/include/asm/cmpxchg.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
> index 4a2e5bc..3e83949 100644
> --- a/arch/x86/include/asm/cmpxchg.h
> +++ b/arch/x86/include/asm/cmpxchg.h
> @@ -214,7 +214,8 @@ extern void __add_wrong_size(void)
> : "=a" (__ret), "+d" (__old2), \
> "+m" (*(p1)), "+m" (*(p2)) \
> : "i" (2 * sizeof(long)), "a" (__old1), \
> - "b" (__new1), "c" (__new2)); \
> + "b" (__new1), "c" (__new2) \
> + : "memory"); \
> __ret; \
> })
NAK. We already have the "+m" for exactly this reason; adding an
explicit memory clobber should only be used to prevent movement of
*other* memory operations around this one (i.e. a barrier).
-hpa
next prev parent reply other threads:[~2015-10-06 20:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 18:54 [PATCH] x86: cmpxchg_double: Add missing memory clobber Pranith Kumar
2015-10-06 20:16 ` H. Peter Anvin [this message]
2015-10-06 20:29 ` Pranith Kumar
2015-10-06 21:39 ` H. Peter Anvin
2015-10-07 13:00 ` 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=56142C2E.20308@zytor.com \
--to=hpa@zytor.com \
--cc=bobby.prani@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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 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.