public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: Erratic gettimeofday() behavior with KVM and newer Linux kernels?
Date: Tue, 19 Jun 2007 10:43:19 +0300	[thread overview]
Message-ID: <46778917.90803@qumranet.com> (raw)
In-Reply-To: <4676F587.8030802-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>

Anthony Liguori wrote:
> In debugging a virtbench bug on KVM, I seemed to uncover some weird 
> behaviors with gettimeofday() and KVM with newer kernels.
>
> The attached program will run a tight loop of code a certain number of 
> times and measure it's duration with gettimeofday().  With a stock 
> ubuntu 2.6.20-15 kernel, I see pretty reasonable behavior in the guest:
>
> ./loop 0
> 0
> ./loop 100
> 0.5
> ./loop 10000
> 0.150
> ./loop 1000000
> 0.15954
>
> Note the format is <secs>.<usecs> so it's behaving quite well.  Now, 
> with a 2.6.22-rc4 kernel, using the same kernel config (saying N to 
> all of the new features), we get:
>
> ./loop 0
> 0.16
> ./loop 100
> 0.0
> ./loop 10000
> 0.0
> ./loop 1000000
> 0.20008
>
> It's pretty erratic.  If I run if a few times at any rate, sometimes I 
> get 0.0 and sometimes I get a more sane result.

I expect the newer kernel is sometimes disqualifying the timestamp 
counter from being used as a clocksource.   Running pinned to a cpu may 
improve things.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-06-19  7:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-18 21:13 Erratic gettimeofday() behavior with KVM and newer Linux kernels? Anthony Liguori
     [not found] ` <4676F587.8030802-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-06-19  7:43   ` Avi Kivity [this message]
     [not found]     ` <46778917.90803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-19 14:14       ` Anthony Liguori
     [not found]         ` <4677E4BF.3060000-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-06-19 14:18           ` Avi Kivity
     [not found]             ` <4677E5B8.3070208-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-19 14:31               ` Anthony Liguori
     [not found]                 ` <4677E8D4.6010904-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-06-19 14:53                   ` Avi Kivity
     [not found]                     ` <4677EDF9.3000202-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-19 15:03                       ` Anthony Liguori
     [not found]                         ` <4677F04F.7070005-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-06-19 15:07                           ` Avi Kivity
     [not found]                             ` <4677F14C.8000701-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-19 15:14                               ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46778917.90803@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox