WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Rik van Riel <riel@xxxxxxxxxx>
Subject: Re: [Xen-devel] ANOUNCEMENT: Debian packages for xen built on 2004-08-19 bk source
From: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Date: Thu, 26 Aug 2004 13:47:48 +0100
Cc: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, Brian Wolfe <brianw@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxxx, Ian.Pratt@xxxxxxxxxxxx
Delivery-date: Thu, 26 Aug 2004 14:03:39 +0100
Envelope-to: steven.hand@xxxxxxxxxxxx
In-reply-to: Your message of "Thu, 26 Aug 2004 06:38:28 EDT." <Pine.LNX.4.44.0408260636370.23532-100000@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
> > 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