[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 6/6] x86emul: simplify FPU handling asm() constraints



On 06/12/16 14:14, Jan Beulich wrote:
> The memory clobber is rather harsh here.

Does removing it actually make a difference?  I can't spot anything
which could reasonably be reordered around the asm() blocks.

> However, fic.exn_raised may be
> modified as a side effect, so we need to let the compiler know that all
> of "fic" may be changed (preventing it from moving around accesses to
> the exn_raised field).
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -784,7 +784,7 @@ do {
>  })
>  
>  struct fpu_insn_ctxt {
> -    uint8_t insn_bytes;
> +    uint8_t insn_bytes; /* Must be first! */

And one single byte.  The compiler would previously have caught an
accidental breaking of this requirement.

As an alternative, how about using ACCESS_ONCE() to read exn_raised?  It
would allow you to drop the memory clobber and also not generalise the
fic.insn_bytes memory parameter to fic.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.