On Sun, Feb 21, 2016 at 04:57:55PM +0000, Avi Cohen wrote: > > Hello, > Last week I've sent a mail regarding the kvm-clock accuracy. > Now I try to draw-up my question again, any answer/partial/hint is greatly appreciated > > Our application is running in a Tenant's Virtual Machine in a data-centre. > We have some OAM functions running in the VMs. > One OAM function is to measure one-way delay between VMa and VMb. > One way delay measurement requires that all machines should be synchronized to a common central clock. > Accuracy requirement is in order of 10s nano-seconds, hence only the 1588v2/PTP is suitable here. > Since we cannot use HW timestamping in a virtual machine (we cannot force using SR-IOV), I thought to run PTP on the physical machines and to sync the VMs to the host by the kvm-clock. > But now I see that the clock in the VM is far away from the host ( ~ Hundreds of micro-second) , and this before I even run the PTP in the host... > My test is very simple - I send a packet from host to the VM, I set the host time (tx_time) in the packet. When the guest receives the packet it reads its time (rx_time) and calculate the delay as : > Delay = rx_time - tx_time > I use the clock_gettime(REALTIME) in the host to set tx-time and in the guest to read rx_time. > My questions : > 1. Assuming my HW support the paravirtualization clock requirements - (see below output of cpuinfo) , In Theory - Is it possible to achieve 10s ns accuracy between VM clock and the host clock ? > or I'm too naïve and have to abandon the idea to run this timing sensitive application on a VM, and instead run it in Linux container for example? You need realtime KVM to run a time sensitive application on a VM. What are your requirements? RHEL-RT-KVM achieves 20us maximum latency (and that is effectively the best clock resolution you can give to users, irrespective of synchronization between guest clock and host clock). -- 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