From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: x86: fix rdrand asm()
Date: Wed, 25 Sep 2013 17:06:41 +0100 [thread overview]
Message-ID: <CE68C8A1.5F110%keir.xen@gmail.com> (raw)
In-Reply-To: <5243218C02000078000F66E5@nat28.tlf.novell.com>
On 25/09/2013 16:46, "Jan Beulich" <JBeulich@suse.com> wrote:
> Just learned the hard way that at least for non-volatile asm()s gcc
> indeed does what the documentation says: It may move it across jumps
> (i.e. ahead of the cpu_has() check). While the documentation claims
> that this can also happen for volatile asm()s, if that was the case
> we'd have many more problems in our code (and e,g, Linux would too).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/include/asm-x86/random.h
> +++ b/xen/include/asm-x86/random.h
> @@ -8,7 +8,7 @@ static inline unsigned int arch_get_rand
> unsigned int val = 0;
>
> if ( cpu_has(¤t_cpu_data, X86_FEATURE_RDRAND) )
> - asm ( ".byte 0x0f,0xc7,0xf0" : "+a" (val) );
> + __asm__ __volatile__ ( ".byte 0x0f,0xc7,0xf0" : "+a" (val) );
Although not consistently applied, we use 'asm volatile' rather than
'__asm__ __volatile__' generally. So we should here. Apart from that
Acked-by: Keir Fraser <keir@xen.org>
> return val;
> }
>
>
>
prev parent reply other threads:[~2013-09-25 16:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 15:46 x86: fix rdrand asm() Jan Beulich
2013-09-25 15:52 ` Andrew Cooper
2013-09-25 15:57 ` Jan Beulich
2013-09-25 16:06 ` Keir Fraser [this message]
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=CE68C8A1.5F110%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xenproject.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.