[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] ANOUNCEMENT: Debian packages for xen built on 2004-08-19 bk source



> > Running rpm under FC2 in a XenU domain seems to work fine for me,
> > so I think it might be something more subtle. 
> 
> It works sometimes, but not all the time.
> 
> It appears that the timer ticks don't always run, or
> at least the wall clock can just stop for a while.

I've seen it stop for a handfull of microseconds when Xen is
doing its occasional resynchronisation with the RTC, but nothing
significant (this sort of thing happens normally if you are
running NTP anyhow). BTW: are you running NTP in dom0, or is Xen
running off the RTC?

[Xen/Linux 2.6 used to have a number of time problems, which
caused me to write the appended little program to help figure out
what was going in. I've just run it on our 2.6.7 and it doesn't
print anything, which is a good sign that gettimeofday is OK.]

> Of course, vmstat crashes with a divide by zero too,
> since xen guests don't increment idle time and vmstat
> ends up doing a divide by zero.  I'll figure out how
> Xen timing works and will post a patch, if I've got
> the time this week.

In 2.6, it looks like we're not accounting time spent in the idle
task, which is a bug (it works OK under 2.4).

The vmstat from RH9 is at least smart enough not to divide by
zero, though...

Ian



#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>

/**************************************************************************/


/* rpcc: get full 64-bit Pentium TSC value */
static __inline__ unsigned long long int rpcc(void) 
{
    unsigned int __h, __l;
    __asm__ __volatile__ ("rdtsc" :"=a" (__l), "=d" (__h));
    return (((unsigned long long)__h) << 32) + __l;
}


/*
 * find_cpu_speed:
 *   Interrogates /proc/cpuinfo for the processor clock speed.
 * 
 *   Returns: speed of processor in MHz, rounded down to nearest whole MHz.
 */
#define MAX_LINE_LEN 50
int find_cpu_speed(void)
{
    FILE *f;
    char s[MAX_LINE_LEN], *a, *b;

    if ( (f = fopen("/proc/cpuinfo", "r")) == NULL ) goto out;

    while ( fgets(s, MAX_LINE_LEN, f) )
    {
        if ( strstr(s, "cpu MHz") )
        {
            /* Find the start of the speed value, and stop at the dec point. */
            if ( !(a=strpbrk(s,"0123456789")) || !(b=strpbrk(a,".")) ) break;
            *b = '\0';
            fclose(f);
            return(atoi(a));
        }
    }

 out:
    fprintf(stderr, "find_cpu_speed: error parsing /proc/cpuinfo for cpu MHz");
    exit(1);
}

int mhz;


main()
{
    int stride;
    unsigned long long start=0,stop=0, last=0, now, gt_firsteventtime;
    unsigned long long xnow, xlast, skip;
    unsigned long long firsteventtime=0, lasteventtime, lastfirsteventtime = 0;
    struct timeval a,b;
    int count=0, okcount=0;

    /* Required in order to print intermediate results at fixed period. */
    mhz = find_cpu_speed();
    printf("CPU speed = %d MHz\n", mhz);

    start = rpcc();
    while(1)
    {
        gettimeofday(&a, NULL);
        xnow = rpcc();

        if(xnow < xlast)
            printf("** %lld %lld **\n", xnow, xlast);

        now = (((long long)a.tv_sec) * 1000000) + a.tv_usec;

        if(now<last)
        {
            printf("backwards!\n");
            exit(-1);
        }

        if(now==last) 
        {
            count++;
            lasteventtime = rpcc();
            if( firsteventtime == 0 ) 
            {
                firsteventtime = lasteventtime;
                gt_firsteventtime = now;
                skip = (xnow-xlast)/mhz;
            }

        }

        if(now>last)
        {
            if(count>5)
            {
                printf("[%lld.%lld %lld] duplicates= % 5d (% 5lldus)\t prev OK= 
% 6d\t fe %lldus (d=%lldus) skip = %lld\n",
                       gt_firsteventtime/1000000,gt_firsteventtime%1000000,
                       firsteventtime,
                       count, (lasteventtime-firsteventtime)/mhz,
                       okcount,(firsteventtime-start)/mhz,
                       (firsteventtime-lastfirsteventtime)/mhz,
                       skip);
                okcount = 0;
                lastfirsteventtime = firsteventtime;
            }
            count = 0;
            firsteventtime = 0;
            okcount++;
        }
        
        last = now;
        xlast = xnow;
    }



}


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.