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

Re: [Xen-devel] [PATCH v1 1/6] vmx: add struct vmx_msr_policy



On Tue, 2017-07-04 at 07:57 -0600, Jan Beulich wrote:
> > > > On 26.06.17 at 12:44, <sergey.dyasli@xxxxxxxxxx> wrote:
> > 
> > --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
> > +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
> > @@ -562,6 +562,350 @@ void vmx_domain_flush_pml_buffers(struct domain *d);
> >  
> >  void vmx_domain_update_eptp(struct domain *d);
> >  
> > +union vmx_pin_based_exec_control_bits {
> > +    uint32_t raw;
> > +    struct {
> > +        bool ext_intr_exiting:1;
> > +        uint32_t             :2;  /* 1:2 reserved */
> > +        bool      nmi_exiting:1;
> > +        uint32_t             :1;  /* 4 reserved */
> > +        bool     virtual_nmis:1;
> > +        bool    preempt_timer:1;
> > +        bool posted_interrupt:1;
> > +        uint32_t             :24; /* 8:31 reserved */
> 
> This mixture of bool and uint32_t worries me - I don't think the
> resulting layout is well defined. Yes, you put suitable
> BUILD_BUG_ON()s in place to catch possible issues, but anyway.

It was Andrew's suggestion to use bool because "It avoids subtle bugs like
foo.exec_only = (a & EXEC) truncating to zero". In the end it doesn't matter
which types are being used for bitfields, the layout depends only on the width.

-- 
Thanks,
Sergey
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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