From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: KVM-Clock Date: Wed, 24 Feb 2016 01:09:20 -0300 Message-ID: <20160224040919.GA10513@amt.cnet> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "kvm@vger.kernel.org" To: Avi Cohen Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49917 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932283AbcBXEJm (ORCPT ); Tue, 23 Feb 2016 23:09:42 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Feb 21, 2016 at 04:57:55PM +0000, Avi Cohen wrote: >=20 > 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 g= reatly appreciated >=20 > Our application is running in a Tenant's Virtual Machine in a data-c= entre. > We have some OAM functions running in the VMs. > One OAM function is to measure one-way delay between VMa and VMb.=20 > One way delay measurement requires that all machines should be synchr= onized 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 f= orce using SR-IOV), I thought to run PTP on the physical machines and t= o 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 h= ost... > My test is very simple - I send a packet from host to the VM, I set t= he host time (tx_time) in the packet. When the guest receives the pack= et it reads its time (rx_time) and calculate the delay as : > Delay =3D rx_time - tx_time > I use the clock_gettime(REALTIME) in the host to set tx-time and in t= he guest to read rx_time.=20 > My questions : > 1. Assuming my HW support the paravirtualization clock requirements -= (see below output of cpuinfo) , In Theory - Is it possible to achiev= e 10s ns accuracy between VM clock and the host clock ?=20 > or I'm too na=EFve and have to abandon the idea to run this timing s= ensitive application on a VM, and instead run it in Linux container f= or example? =20 You need realtime KVM to run a time sensitive application on a VM. Wha= t=20 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).