Sean Christopherson <seanjc@xxxxxxxxxx> 于2023年3月10日周五 23:59写道: > > On Fri, Mar 10, 2023, Robert Hoo wrote: > > Just rename, no functional changes intended. > > > > vmx_umip_emulated() comes from the ancient time when there was a > > No, vmx_umip_emulated() comes from the fact that "cpu_has_vmx_desc()" is > inscrutable for the relevant code. There is zero reason to require that readers > have a priori knowledge of why intercepting descriptor table access instructions > is relevant to handing CR4.UMIP changes. I think this is where comments can play its role. > > If it really bothers someone, we could do Yeah, below also came to my mind, as one option. > > static inline bool cpu_has_vmx_desc(void) > { > return vmcs_config.cpu_based_2nd_exec_ctrl & > SECONDARY_EXEC_DESC; > } > > static inline bool vmx_umip_emulated(void) > { > return cpu_has_vmx_desc(); > } > > but I don't see the point since there is no usage for SECONDARY_EXEC_DESC outside > of UMIP emulation. SECONDARY_EXEC_DESC concerns more than UMIP does. UMIP emulation just leverages part of it. Also, vmx_umip_emulated() == true doesn't necessarily mean, as its name indicates, UMIP-being-emulated, e.g. Host has UMIP capability, then UMIP isn't emulated though vmx_umip_emulated() indicates true.