On 01/07/2019 12:57, Jan Beulich wrote:
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -9124,6 +9126,48 @@ x86_emulate(
>           ASSERT(!state->simd_size);
>           break;
>   
> +    case X86EMUL_OPC_66(0x0f38, 0x82): /* invpcid reg,m128 */
> +        vcpu_must_have(invpcid);
> +        generate_exception_if(ea.type != OP_MEM, EXC_UD);
> +        generate_exception_if(!mode_ring0(), EXC_GP, 0);
> +
> +        if ( (rc = ops->read(ea.mem.seg, ea.mem.off, mmvalp, 16,
> +                             ctxt)) != X86EMUL_OKAY )
> +            goto done;

The actual behaviour in hardware is to not even read the memory operand
if it is unused.  You can demonstrate this by doing an ALL_INC_GLOBAL
flush with a non-canonical memory operand.  In particular, I was
intending to use this behaviour to speed up handling of INV{EPT,VPID}
which trap unconditionally.

However, this is how the instruction is described in the SDM, and
INVPCID should usually execute without trapping, so the unconditional
read should be fine.

Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to