On 20/10/17 15:24, Jan Beulich wrote:
> They're being zeroed a few lines down when non-null selectors are being
> found in the respective registers.
>
> Signed-off-by: Jan Beulich <jbeul...@suse.com>

Given that this is within an cpu_has_fsgsbase conditional, there is a
moderate chance that the conditional is more overhead than the
rd{fs,gs}base instruction alone.

ISTR Andy Lutomirsky finding that they were actually very efficient
instructions.

I'm not sure which is the better option here, but I'm not aversed to the
change, so Acked-by: Andrew Cooper <andrew.coop...@citrix.com>

>
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -1449,10 +1449,11 @@ static void save_segments(struct vcpu *v
>  
>      if ( cpu_has_fsgsbase && !is_pv_32bit_vcpu(v) )
>      {
> -        v->arch.pv_vcpu.fs_base = __rdfsbase();
> +        if ( !(regs->fs & ~3) )
> +            v->arch.pv_vcpu.fs_base = __rdfsbase();
>          if ( v->arch.flags & TF_kernel_mode )
>              v->arch.pv_vcpu.gs_base_kernel = __rdgsbase();
> -        else
> +        else if ( !(regs->gs & ~3) )
>              v->arch.pv_vcpu.gs_base_user = __rdgsbase();
>      }
>  
>
>
>


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

Reply via email to