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

Re: [Xen-devel] [PATCH v2 5/9] x86/vmx: Improvements to LBR MSR handling



>>> On 08.06.18 at 20:48, <andrew.cooper3@xxxxxxxxxx> wrote:
> @@ -3106,14 +3104,13 @@ static int vmx_msr_write_intercept(unsigned int msr, 
> uint64_t msr_content)
>              for ( ; (rc == 0) && lbr->count; lbr++ )
>                  for ( i = 0; (rc == 0) && (i < lbr->count); i++ )
>                      if ( (rc = vmx_add_guest_msr(v, lbr->base + i)) == 0 )
> -                    {
>                          vmx_clear_msr_intercept(v, lbr->base + i, 
> VMX_MSR_RW);
> -                        if ( lbr_tsx_fixup_needed )
> -                            v->arch.hvm_vmx.lbr_fixup_enabled |= 
> FIXUP_LBR_TSX;
> -                        if ( bdw_erratum_bdf14_fixup_needed )
> -                            v->arch.hvm_vmx.lbr_fixup_enabled |=
> -                                FIXUP_BDW_ERRATUM_BDF14;
> -                    }
> +
> +            v->arch.hvm_vmx.lbr_flags |= LBR_MSRS_INSERTED;
> +            if ( lbr_tsx_fixup_needed )
> +                v->arch.hvm_vmx.lbr_flags |= LBR_FIXUP_TSX;
> +            if ( bdw_erratum_bdf14_fixup_needed )
> +                v->arch.hvm_vmx.lbr_flags |= LBR_FIXUP_BDF14;

Note how the setting of the flags previously depended on
vmx_add_guest_msr() having returned success at least once.

> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
> @@ -156,7 +156,12 @@ struct arch_vmx_struct {
>      /* Are we emulating rather than VMENTERing? */
>      uint8_t              vmx_emulate;
>  
> -    uint8_t              lbr_fixup_enabled;
> +    /* Flags for LBR MSRs in the load/save lists. */
> +#define LBR_MSRS_INSERTED  (1u << 0)
> +#define LBR_FIXUP_TSX      (1u << 1)
> +#define LBR_FIXUP_BDF14    (1u << 2)
> +#define LBR_FIXUP_MASK     (LBR_FIXUP_TSX | LBR_FIXUP_BDF14)
> +    uint8_t              lbr_flags;

I'm not overly happy with these getting moved to a non-private header,
but I assume you need to use the new flag in vmcs.c in a later patch.
Let's hope no other LBR_-prefixed names appear elsewhere in the code.


Jan



_______________________________________________
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®.