Sean Christopherson <seanjc@xxxxxxxxxx> 于2023年3月11日周六 00:12写道: > > On Fri, Mar 10, 2023, Robert Hoo wrote: > > Remove the unnecessary cpu_has_vmx_desc() check for emulating UMIP. > > It's not unnecessary. See commit 64f7a11586ab ("KVM: vmx: update sec exec controls > for UMIP iff emulating UMIP"). Dropping the check will cause KVM to execute > > secondary_exec_controls_clearbit(vmx, SECONDARY_EXEC_DESC); > > on CPUs that don't have SECONDARY_VM_EXEC_CONTROL. Sorry I don't follow you. My point is that, given it has passed kvm_is_valid_cr4() (in kvm_set_cr4()), we can assert boot_cpu_has(X86_FEATURE_UMIP) and vmx_umip_emulated() must be at least one true. Therefore when !boot_cpu_has(X86_FEATURE_UMIP), vmx_umip_emulated() must be true, therefore checking it is redundant. Do you mean other call path other than kvm_set_cr4() --> vmx_set_cr4()? i.e. vmx_set_cr0() --> vmx_set_cr4()? nested_... --> vmx_set_cr4()? Emm, they seem don't go through kvm_is_valid_cr4() firstly.