lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/10] KVM: VMX: Convert vcpu_vmx.exit_reason to a union
On Fri, Mar 13, 2020 at 03:18:09PM +0100, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@intel.com> writes:
> > diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> > index e64da06c7009..2d9a005d11ab 100644
> > --- a/arch/x86/kvm/vmx/vmx.h
> > +++ b/arch/x86/kvm/vmx/vmx.h
> > @@ -93,6 +93,29 @@ struct pt_desc {
> > struct pt_ctx guest;
> > };
> >
> > +union vmx_exit_reason {
> > + struct {
> > + u32 basic : 16;
> > + u32 reserved16 : 1;
> > + u32 reserved17 : 1;
> > + u32 reserved18 : 1;
> > + u32 reserved19 : 1;
> > + u32 reserved20 : 1;
> > + u32 reserved21 : 1;
> > + u32 reserved22 : 1;
> > + u32 reserved23 : 1;
> > + u32 reserved24 : 1;
> > + u32 reserved25 : 1;
> > + u32 reserved26 : 1;
> > + u32 enclave_mode : 1;
> > + u32 smi_pending_mtf : 1;
> > + u32 smi_from_vmx_root : 1;
> > + u32 reserved30 : 1;
> > + u32 failed_vmentry : 1;
>
> Just wondering, is there any particular benefit in using 'u32' instead
> of 'u16' here?

Not that I know of. Paranoia that the compiler will do something weird?

> > + };
> > + u32 full;
> > +};
> > +
> > /*
> > * The nested_vmx structure is part of vcpu_vmx, and holds information we need
> > * for correct emulation of VMX (i.e., nested VMX) on this vcpu.
> > @@ -263,7 +286,7 @@ struct vcpu_vmx {
> > int vpid;
> > bool emulation_required;
> >
> > - u32 exit_reason;
> > + union vmx_exit_reason exit_reason;
> >
> > /* Posted interrupt descriptor */
> > struct pi_desc pi_desc;
>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> --
> Vitaly
>

\
 
 \ /
  Last update: 2020-03-17 06:28    [W:2.212 / U:1.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site