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

Re: [Xen-devel] [PATCH 2/9] x86/vmx: Internal cleanup for MSR load/save infrastructure



>>> On 22.05.18 at 13:20, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -1292,48 +1292,50 @@ static int vmx_msr_entry_key_cmp(const void *key, 
> const void *elt)
>  struct vmx_msr_entry *vmx_find_msr(uint32_t msr, enum vmx_msr_list_type type)
>  {
>      struct vcpu *curr = current;
> -    unsigned int msr_count;
> -    struct vmx_msr_entry *msr_area = NULL;
> +    struct arch_vmx_struct *arch_vmx = &curr->arch.hvm_vmx;

In the interest of code volume reduction - why the arch_ prefix? There's
no arch_-less vmx anywhere afaict.

> +    struct vmx_msr_entry *start = NULL;
> +    unsigned int total;
>  
>      switch ( type )
>      {
>      case VMX_MSR_HOST:
> -        msr_count = curr->arch.hvm_vmx.host_msr_count;
> -        msr_area = curr->arch.hvm_vmx.host_msr_area;
> +        start    = arch_vmx->host_msr_area;
> +        total    = arch_vmx->host_msr_count;
>          break;
>  
>      case VMX_MSR_GUEST:
> -        msr_count = curr->arch.hvm_vmx.msr_count;
> -        msr_area = curr->arch.hvm_vmx.msr_area;
> +        start    = arch_vmx->msr_area;
> +        total    = arch_vmx->msr_count;
>          break;
>  
>      default:
>          ASSERT_UNREACHABLE();
>      }
>  
> -    if ( msr_area == NULL )
> +    if ( !start )
>          return NULL;
>  
> -    return bsearch(&msr, msr_area, msr_count, sizeof(struct vmx_msr_entry),
> +    return bsearch(&msr, start, total, sizeof(struct vmx_msr_entry),

sizeof(*start) ?

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