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

Re: [Xen-devel] [PATCH] Nested VMX: Allow to set CR4.OSXSAVE if guest has xsave feature

Jan Beulich wrote on 2013-08-23:
>>>> On 23.08.13 at 04:26, Yang Zhang <yang.z.zhang@xxxxxxxxx> wrote:
>>      case MSR_IA32_VMX_CR4_FIXED1:
>> +        data = 0x267ff;
>> +        /* Allow to set OSXSAVE if guest has xsave feature. */
>> +        hvm_cpuid(0x1, &eax, &ebx, &ecx, &edx);
>> +        if ( ecx & cpufeat_mask(X86_FEATURE_XSAVE) )
>> +            data |= X86_CR4_OSXSAVE;
>>          /* allow 0-settings except SMXE */
>> -        data = 0x267ff & ~X86_CR4_SMXE;
>> +        data &= ~X86_CR4_SMXE;
> While fine with me in general, please take the opportunity and
> eliminate the bogus literal 0x267ff (which will then also make it
> unnecessary to explicitly remove X86_CR4_SMXE from the mask, and will
> make obvious that the mask likely is missing X86_CR4_FSGSBASE and
> X86_CR4_SMEP). I also wonder why the OSXSAVE bit needs to be gated by
> a virtual CPUID check, while all other bits
> don't: Is it possible that this code needs a wider overhaul?
Agree. Current nested code seems a little ugly in some logics (not just here, I 
also saw some hack logics in handling interrupt). Since the nested 
virtulization is still not very mature, so my current focus is to improve the 
stability and bug fixing. But for this, I will send out patch to refine them.

Best regards,

Xen-devel mailing list



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