[PATCH 2/2] kvm: x86: Track synchronized vCPUs in nr_vcpus_matched_tsc

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

 



Use nr_vcpus_matched_tsc to track the number of vCPUs that have
synchronized TSCs in the current TSC synchronization
generation. Previously, we recorded the number of vCPUs with
synchronized TSCs minus one.

Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
Reviewed-by: Peter Shier <pshier@xxxxxxxxxx>
Reviewed-by: Oliver Upton <oupton@xxxxxxxxxx>
---
 arch/x86/kvm/x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2555ea2cd91e..013265d61363 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1921,7 +1921,7 @@ static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
 	struct kvm_arch *ka = &vcpu->kvm->arch;
 	struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
 
-	vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 ==
+	vcpus_matched = (ka->nr_vcpus_matched_tsc ==
 			 atomic_read(&vcpu->kvm->online_vcpus));
 
 	/*
@@ -2104,7 +2104,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
 	if (matched)
 		kvm->arch.nr_vcpus_matched_tsc++;
 	else
-		kvm->arch.nr_vcpus_matched_tsc = 0;
+		kvm->arch.nr_vcpus_matched_tsc = 1;
 	kvm_track_tsc_matching(vcpu);
 	spin_unlock(&kvm->arch.pvclock_gtod_sync_lock);
 }
@@ -2295,7 +2295,7 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
 	int vclock_mode;
 	bool host_tsc_clocksource, vcpus_matched;
 
-	vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 ==
+	vcpus_matched = (ka->nr_vcpus_matched_tsc ==
 			atomic_read(&kvm->online_vcpus));
 
 	/*
-- 
2.27.0.290.gba653c62da-goog




[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