From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: x86: fix rdrand asm()
Date: Wed, 25 Sep 2013 16:52:35 +0100 [thread overview]
Message-ID: <524306C3.2090102@citrix.com> (raw)
In-Reply-To: <5243218C02000078000F66E5@nat28.tlf.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 1179 bytes --]
On 25/09/13 16:46, Jan Beulich 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) );
Any reason for using the double underscore versions? They have
identical meanings, and the prevailing style does appear to be without.
Either way,
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> return val;
> }
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 2114 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-09-25 15:52 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 [this message]
2013-09-25 15:57 ` Jan Beulich
2013-09-25 16:06 ` Keir Fraser
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=524306C3.2090102@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--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 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).