RE: KVM-Clock

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

 



>> The requirement is that the guest VM will be synced to the host clock - I'm not talking on real-time in the meaning of speed, but I need that the guest clock will measure the exact delay between packet transmission from the host to the packet received in the guest. 

>This makes no sense - if you want a "reliable clock synchronized up to X microseconds", then you have to take into account any possible delay incurred by scheduling (as scheduling determines how reliable a clock read can be) into the clock reliability calculation.

I understand the scheduling latency , anyway my clock is totally not in sync. Actually - I see about 800ms delay in the guest clock relative to the host clock , also call clock_settime (any_time)  in the host and did not see any impact on the guest host.
Also I've looked in the code in kvm_guest_time_update and I think that the clock is not updated because  use_master_clock  is false - how can I enable master_clock in KVM ?


>> My problem now is that sometimes when I receive the packet in the guest I calculate a negative delay because my clock in the guest is in delay relative to the host clock.

>Use the guest TSC and host TSC values (rdtsc in both).

>Then subtract from host TSC timestamps the tsc_offset value. 

>You'll get a "perfect" synchronized RDTSC clock. 

>To find out the tsc_offset value, enable kvm_write_tsc_offset tracepoint in the host (before the particular guest boots).

Do u mean that in the host/guest  I will not call clock_gettime   but:

In host :  tx_time =  tsc_to_ns   *  (rdtsc () - tsc_offset)
In guest : rx_time = tsc_to_ns * rdtsc()
                   Delay = rx_time - tx_time 

How to  enable kvm_write_tsc_offset ?
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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