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] Xen automated testing framework

To: Paul Larson <plars@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Xen automated testing framework
From: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Date: Sat, 22 Jan 2005 08:38:08 +0000
Cc: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxxx>, Li Ge <lge@xxxxxxxxxx>, David Barrera <dbarrera@xxxxxxxxxx>, Ian.Pratt@xxxxxxxxxxxx
Delivery-date: Sat, 22 Jan 2005 08:40:24 +0000
Envelope-to: xen+James.Bulpin@xxxxxxxxxxxx
In-reply-to: Your message of "Fri, 21 Jan 2005 17:07:15 CST." <1106348835.8950.253.camel@xxxxxxxxxxxxxxxxxxxxx>
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
> On Fri, 2005-01-21 at 22:58 +0000, Ian Pratt wrote:
> > It would be great if someone with spare machines could run these
> > benchmarks on the nightly snapshots and record the results. Running
> > various milestones since the 2.0 (or even 1.2) release would be good too
> > for comparison. 
> We'll have some machines doing that once we get a workable tool in
> place.  The tool is the first priority so that hopefully even more
> people could do this if interested.
> 
> We'd also like to add tests to this as development goes forward.  So, if
> anyone has xen-specific tests, feel free to send them my way!  I'd like
> to start putting together a testsuite for this at some point.

One area where it would be useful to have specific tests is to
exercise the various mechanisms for accessing thread local
storage that have been used by different versions of
libc. Ideally, these tests would be run simultaneously in two
domains running on the same CPU, to ensure everything gets
context switched OK. I've appended a little test written by Keir
that exercises fs/gs with segments from an LDT. We should
probably augment it with tests that use set_thread_area.

Has LTP already got tests that exercise NPTL? Running these in
two domains on the same CPU may be sufficient. 

Another area where it would be worth writing Xen specific tests
is to test time by comparing the progress of gettimeofday against
the cycle counter to ensure that it progresses monotonically and
'smoothly' when the domain is running, and to compare it against
the RTC to check the rate. I've previously posted a test that
does part of this.

Ian

--

#include <stdio.h>
#include <stdlib.h>


/* Structure passed on `modify_ldt' call.  */
struct modify_ldt_ldt_s
{
    unsigned int entry_number;
    unsigned long int base_addr;
    unsigned int limit;
    unsigned int seg_32bit:1;
    unsigned int contents:2;
    unsigned int read_exec_only:1;
    unsigned int limit_in_pages:1;
    unsigned int seg_not_present:1;
    unsigned int useable:1;
    unsigned int empty:25;
};

static void DO_CLEAR_LDT(unsigned int nr)
{
    int rc;
    struct modify_ldt_ldt_s ldt_entry = { 
        nr, (unsigned long)0, 0,
        0, 0, 0, 0, 0, 0, 0 
    };

    __asm__ __volatile__ (
        "int $0x80" : "=&a" (rc) : "0" (123), "b" (1), 
        "c" (&ldt_entry), "d" (sizeof(ldt_entry)));

    if (rc != 0)
    {
        printf("Urk! %d\n", rc);
        exit(0);
    }
}

static void DO_MODIFY_LDT(void *descr, unsigned int nr)
{
    int rc;
    struct modify_ldt_ldt_s ldt_entry = { 
        nr, (unsigned long)descr, 0xfffff /* 4GB in pages */,
        1, 0, 0, 1, 0, 1, 0 
    };

    printf("Setting LDT entry...\n");

    __asm__ __volatile__ (
        "int $0x80" : "=&a" (rc) : "0" (123), "b" (1), 
        "c" (&ldt_entry), "d" (sizeof(ldt_entry)));

    if (rc != 0)
    {
        printf("Urk! %d\n", rc);
        exit(0);
    }

    printf("LDT entry set.\nLoading FS...\n");

    __asm__ __volatile__ ("movw %w0, %%fs" : : "q" (nr * 8 + 7));

    printf("FS loaded.\n");
}

unsigned long segment [8192] = { 0xaaaaaaaa };

int main(int argc, char **argv)
{
    int i = 0, nr;
    unsigned long foo, fs, gs;

    memset(segment, 0xaa, sizeof(segment));

    if ( argc != 2 )
    {
        printf("Usage: %s <entry number>\n", argv[0]);
        return 0;
    }

    nr = atoi(argv[1]);
    printf("Going for desc %d\n", nr);

    DO_MODIFY_LDT(segment, nr); 
    __asm__ __volatile__ ("movl %%fs:(%0),%0" : "=&a" (foo) : "0" (0) );
    printf("Found %08lx\n", foo);

    while ( 1 )
    {
        usleep(10000);

        __asm__ __volatile__ (
            "pushl %%fs; pushl %%gs; popl %%eax; popl %%ebx"
            : "=a" (gs), "=b" (fs) );

//        if ( ((fs&0xffff) != (nr*8+7)) )
            printf("Urkle! %08lx %08lx\n", fs, gs);

        DO_CLEAR_LDT(nr);
        
        if ( i++ == 100 )
        {
            i = 0;
            printf("."); fflush(stdout);
        }
    }

    return 0;
}



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel