@@ -1968,10 +1968,7 @@ static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs)
static inline void vpid_sync_vcpu_single(int vpid)
{
- if (vpid == 0)
- return;
-
- if (cpu_has_vmx_invvpid_single())
+ if (cpu_has_vmx_invvpid_single())
__invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vpid, 0);
}
@@ -1983,6 +1980,9 @@ static inline void vpid_sync_vcpu_global(void)
static inline void vpid_sync_context(int vpid)
{
+ if (vpid == 0)
+ return;
+
if (cpu_has_vmx_invvpid_single())
vpid_sync_vcpu_single(vpid);
else
When vpids are not supported or disabled, vpid_sync_context is just a no-op including single-context type or global-context type. we can just return in vpid_sync_context when vpid==0. Signed-off-by: Peng Hao <peng.hao2@zte.com.cn> --- arch/x86/kvm/vmx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)