[PATCH] kvm/x86 : simplify the handle of invvpid function

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

 



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@xxxxxxxxxx>
---
 arch/x86/kvm/vmx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 1689f43..b76a18d 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -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
-- 
1.8.3.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux