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/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel