Eran Rom <eranr <at> il.ibm.com> writes:

> 
> Eran Rom <eranr <at> 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 <sys/time.h>
#include <time.h>

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;
        }
}


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to