From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eran Rom Subject: Re: guest gettimeofday behavior Date: Tue, 7 Jul 2009 09:58:46 +0000 (UTC) Message-ID: References: <4A4730B9.1090902@redhat.com> <4A49B6A5.4090801@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from main.gmane.org ([80.91.229.2]:35337 "EHLO ciao.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754120AbZGGJ66 (ORCPT ); Tue, 7 Jul 2009 05:58:58 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MO7Ry-0002Fb-HN for kvm@vger.kernel.org; Tue, 07 Jul 2009 09:59:01 +0000 Received: from nesher3.haifa.il.ibm.com ([192.114.107.4]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 Jul 2009 09:58:58 +0000 Received: from eranr by nesher3.haifa.il.ibm.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 Jul 2009 09:58:58 +0000 Sender: kvm-owner@vger.kernel.org List-ID: 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 > 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; } }