On 09/10/2017 00:35, Jim Mattson wrote:
> If it were me, I'd apply De Morgan to that expression, but the logic looks 
> fine.
> 
> Reviewed-by: Jim Mattson <[email protected]>

I'm okay with the way Wanpeng wrote it, but as a follow up this:

        if (!cpu_has_vmx_ept() ||
            !cpu_has_vmx_ept_4levels() ||
            !cpu_has_vmx_ept_mt_wb()) {
                enable_ept = 0;
                enable_unrestricted_guest = 0;
                enable_ept_ad_bits = 0;
        }

can be reduced to just "enable_ept = 0".

Paolo

> On Sat, Oct 7, 2017 at 7:35 PM, Wanpeng Li <[email protected]> wrote:
>> From: Wanpeng Li <[email protected]>
>>
>> SDM mentioned:
>>
>>  "If either the “unrestricted guest” VM-execution control or the “mode-based
>>   execute control for EPT” VM- execution control is 1, the “enable EPT”
>>   VM-execution control must also be 1."
>>
>> However, we can still observe unrestricted_guest is Y after inserting the 
>> kvm-intel.ko
>> w/ ept=N. It depends on later starts a guest in order that the function
>> vmx_compute_secondary_exec_control() can be executed, then both the module 
>> parameter
>> and exec control fields will be amended.
>>
>> This patch fixes it by amending module parameter immediately during vmcs 
>> data setup.
>>
>> Cc: Paolo Bonzini <[email protected]>
>> Cc: Radim Krčmář <[email protected]>
>> Signed-off-by: Wanpeng Li <[email protected]>
>> ---
>>  arch/x86/kvm/vmx.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 244e366..3e664ca 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -6737,7 +6737,7 @@ static __init int hardware_setup(void)
>>         if (!cpu_has_vmx_ept_ad_bits() || !enable_ept)
>>                 enable_ept_ad_bits = 0;
>>
>> -       if (!cpu_has_vmx_unrestricted_guest())
>> +       if (!cpu_has_vmx_unrestricted_guest() || !enable_ept)
>>                 enable_unrestricted_guest = 0;
>>
>>         if (!cpu_has_vmx_flexpriority())
>> --
>> 2.7.4
>>

Reply via email to