All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/kvm: fix condition to update kvm master clocks
@ 2016-05-26 14:49 Roman Kagan
  2016-05-26 20:19 ` Radim Krčmář
  2016-05-29 23:38 ` Marcelo Tosatti
  0 siblings, 2 replies; 20+ messages in thread
From: Roman Kagan @ 2016-05-26 14:49 UTC (permalink / raw)
  To: kvm
  Cc: Denis V. Lunev, Roman Kagan, Owen Hofmann, Paolo Bonzini,
	Marcelo Tosatti

The condition to schedule per-VM master clock updates is inversed; as a
result the master clocks are never updated and the kvm_clock drift WRT
host's NTP-disciplined clock (which was the motivation to introduce this
machinery in the first place) still remains.

Fix it, and reword the comment to make it more apparent what the desired
behavior is.

Cc: Owen Hofmann <osh@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
---
 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 c805cf4..d8f591c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5810,10 +5810,10 @@ static int pvclock_gtod_notify(struct notifier_block *nb, unsigned long unused,
 
 	update_pvclock_gtod(tk);
 
-	/* disable master clock if host does not trust, or does not
-	 * use, TSC clocksource
+	/* only schedule per-VM master clock updates if the host uses TSC and
+	 * there's at least one VM in need of an update
 	 */
-	if (gtod->clock.vclock_mode != VCLOCK_TSC &&
+	if (gtod->clock.vclock_mode == VCLOCK_TSC &&
 	    atomic_read(&kvm_guest_has_master_clock) != 0)
 		queue_work(system_long_wq, &pvclock_gtod_work);
 
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-06-21 21:29 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-26 14:49 [PATCH] x86/kvm: fix condition to update kvm master clocks Roman Kagan
2016-05-26 20:19 ` Radim Krčmář
2016-05-27 17:28   ` Roman Kagan
2016-05-27 18:11     ` Radim Krčmář
2016-05-27 18:46       ` Roman Kagan
2016-05-27 19:29         ` Radim Krčmář
2016-05-29 23:38 ` Marcelo Tosatti
2016-06-09  3:27   ` Marcelo Tosatti
2016-06-09  3:45     ` Marcelo Tosatti
2016-06-09 12:09     ` Roman Kagan
2016-06-09 18:25       ` Marcelo Tosatti
2016-06-09 19:19         ` Roman Kagan
2016-06-13 17:07         ` Roman Kagan
2016-06-14 22:11           ` Marcelo Tosatti
2016-06-13 17:19         ` Roman Kagan
2016-06-17 22:21           ` Marcelo Tosatti
2016-06-20 17:22             ` Roman Kagan
2016-06-20 21:29               ` Marcelo Tosatti
2016-06-21 14:40                 ` Roman Kagan
2016-06-21 21:28                   ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.