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

Re: [Xen-devel] [PATCH 3/3] x86/HVM: hvmemul_cmpxchg() should also use known_gla()



> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: 13 November 2018 10:15
> To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Paul Durrant
> <Paul.Durrant@xxxxxxxxxx>; Wei Liu <wei.liu2@xxxxxxxxxx>
> Subject: [PATCH 3/3] x86/HVM: hvmemul_cmpxchg() should also use
> known_gla()
> 
> To be consistent with the write and rmw cases the mapping approach
> should not be used when the guest linear address translation is known.
> This in particular excludes the discard-write case from bypassing the
> emulation path. This also means that now EFLAGS should actually get
> properly updated, despite the discarded write portion of the memory
> access.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
> Without "make hvmemul_map_linear_addr() honor p2m_ioreq_server" this
> also helps the p2m_ioreq_server case.
> 
> TBD: While hvmemul_do_io() takes care of p2m_ioreq_server, I don't see
>      it taking care of p2m_is_discard_write() types. Am I overlooking
>      something?

If such an access gets to hvmemul_do_io() I would have thought it should fall 
through to the null_handler case, which will sink the write.

> 
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -1472,9 +1472,12 @@ static int hvmemul_cmpxchg(
>      else if ( hvmemul_ctxt->seg_reg[x86_seg_ss].dpl == 3 )
>          pfec |= PFEC_user_mode;
> 
> -    mapping = hvmemul_map_linear_addr(addr, bytes, pfec, hvmemul_ctxt);
> -    if ( IS_ERR(mapping) )
> -        return ~PTR_ERR(mapping);
> +    if ( !known_gla(addr, bytes, pfec) )
> +    {
> +        mapping = hvmemul_map_linear_addr(addr, bytes, pfec,
> hvmemul_ctxt);
> +        if ( IS_ERR(mapping) )
> +            return ~PTR_ERR(mapping);
> +    }
> 
>      if ( !mapping )
>      {
> 
> 
> 


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

 


Rackspace

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