We need to write the wall clock MSR every time we use it, to ensure we get the updated value. This allows the guest OSv to track the time of the host correctly.
Signed-off-by: Rick Payne <ri...@rossfell.co.uk> --- drivers/kvmclock.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/kvmclock.cc b/drivers/kvmclock.cc index 68389dfb..2e182954 100644 --- a/drivers/kvmclock.cc +++ b/drivers/kvmclock.cc @@ -50,11 +50,8 @@ static u8 get_pvclock_flags() kvmclock::kvmclock() : _pvclock(get_pvclock_flags()) { - auto wall_time_msr = (_new_kvmclock_msrs) ? - msr::KVM_WALL_CLOCK_NEW : msr::KVM_WALL_CLOCK; _wall = new pvclock_wall_clock; memset(_wall, 0, sizeof(*_wall)); - processor::wrmsr(wall_time_msr, mmu::virt_to_phys(_wall)); } void kvmclock::init_on_cpu() @@ -79,6 +76,9 @@ bool kvmclock::probe() u64 kvmclock::wall_clock_boot() { + auto wall_time_msr = (_new_kvmclock_msrs) ? + msr::KVM_WALL_CLOCK_NEW : msr::KVM_WALL_CLOCK; + processor::wrmsr(wall_time_msr, mmu::virt_to_phys(_wall)); return _pvclock.wall_clock_boot(_wall); } -- 2.17.1 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.