From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: guest gettimeofday behavior Date: Tue, 7 Jul 2009 17:12:16 -0300 Message-ID: <20090707201216.GA9129@amt.cnet> References: <4A4730B9.1090902@redhat.com> <4A49B6A5.4090801@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Eran Rom , Glauber de Oliveira Costa Return-path: Received: from mx2.redhat.com ([66.187.237.31]:50733 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751793AbZGGUMg (ORCPT ); Tue, 7 Jul 2009 16:12:36 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jul 07, 2009 at 09:58:46AM +0000, Eran Rom wrote: > Eran Rom il.ibm.com> writes: > > > > > Eran Rom il.ibm.com> writes: > > > > Still getting a misbehaving clock: > > guest uses kvmclock with kernel 2.6.27 > > host kernel is 2.6.27 with kvm-qemu-87 & kvm-kmod-87 > > > > getting: > > ... > > now = 2128043797 > > now = 2138048010 > > now = 18446744071562636328 > > Eran, This was happening with kvmclock back then when it did not handle cpu frequency changes. What are the details of the host hw? Glauber, any clues? > Below is the exact code used. > Also, I use a script in the host to run this code in a loop for 5 minutes, each > time in a newly launched guest. This happens on average once every 10 executions. > > Thanks very much, > Eran > > #include > #include > > int main(int argc, char **argv) > { > int seconds; > unsigned long long now, goal; > struct timeval time1, time2; > > if (argc != 2) > return; > > seconds = atoi(argv[1]); > > gettimeofday(&time1, NULL); > now = ((time1.tv_sec) * 1000000) + time1.tv_usec; > goal = now + (seconds * 1000000); > while (now < goal) { > sleep(10); > gettimeofday(&time2, NULL); > now = (time2.tv_sec * 1000000) + time2.tv_usec; > } > }