From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Tiejun Chen <tiejun.chen@windriver.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/1] powerpc: add "memory" attribute for mfmsr()
Date: Tue, 10 Jul 2012 18:19:58 +1000 [thread overview]
Message-ID: <1341908398.2561.15.camel@pasglop> (raw)
In-Reply-To: <1341907153-20516-1-git-send-email-tiejun.chen@windriver.com>
On Tue, 2012-07-10 at 15:59 +0800, Tiejun Chen wrote:
> Add "memory" attribute in inline assembly language as a compiler
> barrier to make sure 4.6.x GCC don't reorder mfmsr().
Out of curiosity, did you see a case where it was re-ordered
improperly ?
Cheers,
Ben.
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
> arch/powerpc/include/asm/reg.h | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> index 559da19..578e5a0 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -1016,7 +1016,8 @@
> /* Macros for setting and retrieving special purpose registers */
> #ifndef __ASSEMBLY__
> #define mfmsr() ({unsigned long rval; \
> - asm volatile("mfmsr %0" : "=r" (rval)); rval;})
> + asm volatile("mfmsr %0" : "=r" (rval) : \
> + : "memory"); rval;})
> #ifdef CONFIG_PPC_BOOK3S_64
> #define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \
> : : "r" (v) : "memory")
next prev parent reply other threads:[~2012-07-10 8:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 7:59 [PATCH 1/1] powerpc: add "memory" attribute for mfmsr() Tiejun Chen
2012-07-10 8:19 ` Benjamin Herrenschmidt [this message]
2012-07-10 8:22 ` tiejun.chen
2012-07-10 8:27 ` tiejun.chen
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=1341908398.2561.15.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=tiejun.chen@windriver.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;
as well as URLs for NNTP newsgroup(s).