[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 1/3] Nested VMX: Check VMX capability before read VMX related MSRs.
>>> On 10.09.13 at 08:14, Yang Zhang <yang.z.zhang@xxxxxxxxx> wrote: > + /* > + * Those MSRs available only when bit 55 of > + * MSR_IA32_VMX_BASIC is set. > + */ > + rdmsrl(MSR_IA32_VMX_BASIC, data); > + if ( msr >= MSR_IA32_VMX_TRUE_PINBASED_CTLS && > + msr <= MSR_IA32_VMX_TRUE_ENTRY_CTLS && Doing this with a range check is pretty odd - neither the lower nor the upper bound are really meant to be boundaries. I'd prefer if you did this with a switch statement, enumerating all four MSRs. The compiler can then still convert that to a range comparison. And that way you can also more the rdmsrl() out of the fast path. Which makes me ask - wouldn't it be better to read this MSR into a global variable once at boot time, and then use that variable instead of reading the MSR over and over? Jan > + !(data & VMX_BASIC_DEFAULT1_ZERO) ) > + return 0; > + _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |