[PATCH v2 11/11] KVM: add pvclock to a list of stable clocks.

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

 



This means allow to L2 guests to use masterclock when
L1 has a stable pvclock (currenly, kvm-clock)

Signed-off-by: Denis Plotnikov <dplotnikov@xxxxxxxxxxxxx>
---
 arch/x86/kernel/pvclock.c |  1 +
 arch/x86/kvm/x86.c        | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index c73e5a5..d6bef69 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -73,6 +73,7 @@ u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src)
 
 	return flags & valid_flags;
 }
+EXPORT_SYMBOL(pvclock_read_flags);
 
 static atomic64_t clocksource_stable = ATOMIC64_INIT(0);
 
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ce491bb..9b0f306 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1311,9 +1311,17 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns)
 }
 
 #ifdef CONFIG_X86_64
+static bool pvclock_stable(void)
+{
+	return !!(pvclock_read_flags(&pvclock_pvti_cpu0_va()->pvti)
+		& PVCLOCK_TSC_STABLE_BIT);
+}
+
 static bool clocksource_stable(void)
 {
-	return get_tk_mono_clock_mode() == VCLOCK_TSC;
+	return get_tk_mono_clock_mode() == VCLOCK_TSC ||
+		(get_tk_mono_clock_mode() == VCLOCK_PVCLOCK
+		&& pvclock_stable());
 }
 
 static bool clocksource_stability_check(void)
-- 
2.7.4




[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