Skip to contentSkip to conversation

kvm masterclock

DISCUSSION Mika Penttilä 2 participants 2 messages Sep 5, 2016 – Sep 6, 2016 KVM

lore
Share & tools
lore
#0 lore raw

While using the master clock among guests, when is it updated? Thought it had to be in

pvclock_gtod_notify() but it only triggers update of :

master_kernel_ns, master_cycle_now

if clocksource changes away from TSC :

      if (gtod->clock.vclock_mode != VCLOCK_TSC &&
            atomic_read(&kvm_guest_has_master_clock) != 0)
                queue_work(system_long_wq, &pvclock_gtod_work);

And gtod work would set KVM_REQ_MASTERCLOCK_UPDATE if queued, which is not the case if always TSC.

So kvm_guest_time_update() always uses same values is use_master_clock ?

Maybe I missed some piece?

--Mika

maintainer
#1 lore raw
Quoted 8 lines · Mika Penttilä

While using the master clock among guests, when is it updated? Thought it had to be in

pvclock_gtod_notify() but it only triggers update of :

master_kernel_ns, master_cycle_now

if clocksource changes away from TSC :

Quoted 7 lines
      if (gtod->clock.vclock_mode != VCLOCK_TSC &&
            atomic_read(&kvm_guest_has_master_clock) != 0)
                queue_work(system_long_wq, &pvclock_gtod_work);

And gtod work would set KVM_REQ_MASTERCLOCK_UPDATE if queued, which is not the case if always TSC.

So kvm_guest_time_update() always uses same values is use_master_clock ?

Yes, if the master clock is in use the kvmclock does _not_ adjust itself and, as a consequence, doesn't follow host NTP adjustments.

Paolo