aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2007-10-02 11:31:55 -0600
committerAlex Williamson <alex.williamson@hp.com>2007-10-02 11:31:55 -0600
commit3abc3aea3f93a6e14ce080457f1397f250677678 (patch)
tree7b89a7ab6031add1b1d8e6ad75c81d59e257e526 /tools
parentc0cf2ddd9191a34d5cb12e2d9bdb1470c9ced336 (diff)
parentac9ba8d39deffe57bf3068f365e8a079ac74b5e7 (diff)
downloadxen-3abc3aea3f93a6e14ce080457f1397f250677678.tar.gz
xen-3abc3aea3f93a6e14ce080457f1397f250677678.tar.bz2
xen-3abc3aea3f93a6e14ce080457f1397f250677678.zip
merge with xen-unstable.hg (staging)
Diffstat (limited to 'tools')
-rw-r--r--tools/examples/external-device-migrate11
-rw-r--r--tools/flask/libflask/Makefile2
-rw-r--r--tools/flask/libflask/include/flask_op.h2
-rw-r--r--tools/flask/loadpolicy/Makefile11
-rw-r--r--tools/ioemu/vl.c2
-rw-r--r--tools/libxc/xc_hvm_build.c68
-rw-r--r--tools/libxc/xc_private.c6
-rw-r--r--tools/python/xen/util/xsm/acm/acm.py2
-rw-r--r--tools/python/xen/xend/XendDomain.py26
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py10
-rw-r--r--tools/xenstat/xentop/xentop.c32
-rw-r--r--tools/xentrace/xenctx.c55
-rw-r--r--tools/xentrace/xentrace.82
-rw-r--r--tools/xentrace/xentrace_format89
-rw-r--r--tools/xm-test/configure.ac4
-rw-r--r--tools/xm-test/lib/XmTestLib/NetConfig.py2
16 files changed, 191 insertions, 133 deletions
diff --git a/tools/examples/external-device-migrate b/tools/examples/external-device-migrate
index c7c99afec3..a4113483a8 100644
--- a/tools/examples/external-device-migrate
+++ b/tools/examples/external-device-migrate
@@ -16,6 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+set -x
# This script is called by XenD for migration of external devices
# It does not handle the migration of those devices itself, but
@@ -57,11 +58,11 @@ function evaluate_params()
stype=""
while [ $# -ge 1 ]; do
case "$1" in
- -step) step=$2; shift 2;;
- -host) host=$2; shift 2;;
- -domname) domname=$2; shift 2;;
- -type) typ=$2; shift 2;;
- -subtype) stype=$2; shift 2;;
+ -step) step=$2; shift; shift;;
+ -host) host=$2; shift; shift;;
+ -domname) domname=$2; shift; shift;;
+ -type) typ=$2; shift; shift;;
+ -subtype) stype=$2; shift; shift;;
-recover) recover=1; shift;;
-help) ext_dev_migrate_usage; exit 0;;
*) break;;
diff --git a/tools/flask/libflask/Makefile b/tools/flask/libflask/Makefile
index 9c5cb770ff..db57575ea5 100644
--- a/tools/flask/libflask/Makefile
+++ b/tools/flask/libflask/Makefile
@@ -60,6 +60,6 @@ libflask.so.$(MAJOR): libflask.so.$(MAJOR).$(MINOR)
ln -sf $< $@
libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libflask.so.$(MAJOR) -shared -o $@ $^
+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
-include $(DEPS)
diff --git a/tools/flask/libflask/include/flask_op.h b/tools/flask/libflask/include/flask_op.h
index 56cb213d67..4058ea85dc 100644
--- a/tools/flask/libflask/include/flask_op.h
+++ b/tools/flask/libflask/include/flask_op.h
@@ -39,7 +39,7 @@ typedef struct flask_op {
} flask_op_t;
int flask_load(int xc_handle, char *buf, int size);
-int flask_context_to_sid(int xc_handle, char *buf, int size, u_int32_t *sid);
+int flask_context_to_sid(int xc_handle, char *buf, int size, uint32_t *sid);
int flask_sid_to_context(int xc_handle, int sid, char *buf, int size);
int do_flask_op(int xc_handle, flask_op_t *op);
diff --git a/tools/flask/loadpolicy/Makefile b/tools/flask/loadpolicy/Makefile
index 3cad9a4720..19e11dbd9b 100644
--- a/tools/flask/loadpolicy/Makefile
+++ b/tools/flask/loadpolicy/Makefile
@@ -2,11 +2,6 @@ XEN_ROOT=../../..
include $(XEN_ROOT)/tools/Rules.mk
XEN_LIBXC = $(XEN_ROOT)/tools/libxc
-INSTALL = install
-INSTALL_DATA = $(INSTALL) -m0644
-INSTALL_PROG = $(INSTALL) -m0755
-INSTALL_DIR = $(INSTALL) -d -m0755
-
LIBXC_ROOT = $(XEN_ROOT)/tools/libxc
LIBFLASK_ROOT = $(XEN_ROOT)/tools/flask/libflask
@@ -28,13 +23,17 @@ TESTFLAGS= -DTESTING
TESTENV = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
CLIENTS := flask-loadpolicy
+CLIENTS_SRCS := $(patsubst flask-%,%.c,$(CLIENTS))
CLIENTS_OBJS := $(patsubst flask-%,%.o,$(CLIENTS))
.PHONY: all
all: $(CLIENTS)
$(CLIENTS): flask-%: %.o
- $(LINK.o) $< $(LOADLIBES) $(LDLIBS) -L. -lflask -lxenctrl -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) $< $(LOADLIBES) $(LDLIBS) -L. -lflask -lxenctrl -o $@
+
+$(CLIENTS_OBJS): $(CLIENTS_SRCS)
+ $(COMPILE.c) -o $@ $<
.PHONY: clean
clean:
diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c
index 369769090a..f334020768 100644
--- a/tools/ioemu/vl.c
+++ b/tools/ioemu/vl.c
@@ -7102,6 +7102,7 @@ int main(int argc, char **argv)
char qemu_dm_logfilename[128];
const char *direct_pci = NULL;
+#ifndef __sun__
/* Maximise rlimits. Needed where default constraints are tight (*BSD). */
if (getrlimit(RLIMIT_STACK, &rl) != 0) {
perror("getrlimit(RLIMIT_STACK)");
@@ -7125,6 +7126,7 @@ int main(int argc, char **argv)
rl.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_MEMLOCK, &rl) != 0)
perror("setrlimit(RLIMIT_MEMLOCK)");
+#endif
/* Ensure that SIGUSR2 is blocked by default when a new thread is created,
then only the threads that use the signal unblock it -- this fixes a
diff --git a/tools/libxc/xc_hvm_build.c b/tools/libxc/xc_hvm_build.c
index f3a0707a31..cb4bf32fdf 100644
--- a/tools/libxc/xc_hvm_build.c
+++ b/tools/libxc/xc_hvm_build.c
@@ -21,14 +21,6 @@
#define SCRATCH_PFN 0xFFFFF
-/* Need to provide the right flavour of vcpu context for Xen */
-typedef union
-{
- vcpu_guest_context_x86_64_t c64;
- vcpu_guest_context_x86_32_t c32;
- vcpu_guest_context_t c;
-} vcpu_guest_context_either_t;
-
static void build_e820map(void *e820_page, unsigned long long mem_size)
{
struct e820entry *e820entry =
@@ -154,12 +146,11 @@ static int loadelfimage(
static int setup_guest(int xc_handle,
uint32_t dom, int memsize,
- char *image, unsigned long image_size,
- vcpu_guest_context_either_t *ctxt)
+ char *image, unsigned long image_size)
{
xen_pfn_t *page_array = NULL;
unsigned long i, nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
- unsigned long shared_page_nr;
+ unsigned long shared_page_nr, entry_eip;
struct xen_add_to_physmap xatp;
struct shared_info *shared_info;
void *e820_page;
@@ -263,20 +254,20 @@ static int setup_guest(int xc_handle,
xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, shared_page_nr-2);
xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, shared_page_nr);
- free(page_array);
-
- /* Set [er]ip in the way that's right for Xen */
- if ( strstr(caps, "x86_64") )
- {
- ctxt->c64.user_regs.rip = elf_uval(&elf, elf.ehdr, e_entry);
- ctxt->c64.flags = VGCF_online;
- }
- else
+ /* Insert JMP <rel32> instruction at address 0x0 to reach entry point. */
+ entry_eip = elf_uval(&elf, elf.ehdr, e_entry);
+ if ( entry_eip != 0 )
{
- ctxt->c32.user_regs.eip = elf_uval(&elf, elf.ehdr, e_entry);
- ctxt->c32.flags = VGCF_online;
+ char *page0 = xc_map_foreign_range(
+ xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, 0);
+ if ( page0 == NULL )
+ goto error_out;
+ page0[0] = 0xe9;
+ *(uint32_t *)&page0[1] = entry_eip - 5;
+ munmap(page0, PAGE_SIZE);
}
+ free(page_array);
return 0;
error_out:
@@ -290,42 +281,13 @@ static int xc_hvm_build_internal(int xc_handle,
char *image,
unsigned long image_size)
{
- struct xen_domctl launch_domctl;
- vcpu_guest_context_either_t ctxt;
- int rc;
-
if ( (image == NULL) || (image_size == 0) )
{
ERROR("Image required");
- goto error_out;
- }
-
- memset(&ctxt, 0, sizeof(ctxt));
-
- if ( setup_guest(xc_handle, domid, memsize, image, image_size, &ctxt) < 0 )
- {
- goto error_out;
- }
-
- if ( lock_pages(&ctxt, sizeof(ctxt) ) )
- {
- PERROR("%s: ctxt mlock failed", __func__);
- goto error_out;
+ return -1;
}
- memset(&launch_domctl, 0, sizeof(launch_domctl));
- launch_domctl.domain = (domid_t)domid;
- launch_domctl.u.vcpucontext.vcpu = 0;
- set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, &ctxt.c);
- launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
- rc = xc_domctl(xc_handle, &launch_domctl);
-
- unlock_pages(&ctxt, sizeof(ctxt));
-
- return rc;
-
- error_out:
- return -1;
+ return setup_guest(xc_handle, domid, memsize, image, image_size);
}
static inline int is_loadable_phdr(Elf32_Phdr *phdr)
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 18a18f4c65..03d7904d61 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -130,7 +130,8 @@ int lock_pages(void *addr, size_t len)
int e = 0;
#ifndef __sun__
void *laddr = (void *)((unsigned long)addr & PAGE_MASK);
- size_t llen = (len + PAGE_SIZE - 1) & PAGE_MASK;
+ size_t llen = (len + ((unsigned long)addr - (unsigned long)laddr) +
+ PAGE_SIZE - 1) & PAGE_MASK;
e = mlock(laddr, llen);
#endif
return e;
@@ -140,7 +141,8 @@ void unlock_pages(void *addr, size_t len)
{
#ifndef __sun__
void *laddr = (void *)((unsigned long)addr & PAGE_MASK);
- size_t llen = (len + PAGE_SIZE - 1) & PAGE_MASK;
+ size_t llen = (len + ((unsigned long)addr - (unsigned long)laddr) +
+ PAGE_SIZE - 1) & PAGE_MASK;
safe_munlock(laddr, llen);
#endif
}
diff --git a/tools/python/xen/util/xsm/acm/acm.py b/tools/python/xen/util/xsm/acm/acm.py
index 52f6ad6333..d58652e06c 100644
--- a/tools/python/xen/util/xsm/acm/acm.py
+++ b/tools/python/xen/util/xsm/acm/acm.py
@@ -1309,7 +1309,7 @@ def parse_security_label(security_label):
return security_label
def set_security_label(policy, label):
- if label != "" and policy != "":
+ if label and policy and label != "" and policy != "":
return "%s:%s:%s" % (xsconstants.ACM_POLICY_ID, policy, label)
else:
return ""
diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py
index 5e09126bb2..130ae1e8be 100644
--- a/tools/python/xen/xend/XendDomain.py
+++ b/tools/python/xen/xend/XendDomain.py
@@ -51,7 +51,6 @@ from xen.xend.xenstore.xstransact import xstransact
from xen.xend.xenstore.xswatch import xswatch
from xen.util import mkdir
from xen.xend import uuid
-from xen.xend import sxp
xc = xen.lowlevel.xc.xc()
xoptions = XendOptions.instance()
@@ -969,31 +968,6 @@ class XendDomain:
try:
try:
domconfig = XendConfig.XendConfig(sxp_obj = config)
-
- domains = self.list('all')
- domains = map(lambda dom: dom.sxpr(), domains)
- for dom in domains:
- if sxp.child_value(config, 'uuid', None):
- if domconfig['uuid'] == sxp.child_value(dom, 'uuid'):
- if domconfig['name_label'] != sxp.child_value(dom, 'name'):
- raise XendError("Domain UUID '%s' is already used." % \
- domconfig['uuid'])
- else:
- # Update the config for that existing domain
- # because it is same name and same UUID.
- break
- else:
- if domconfig['name_label'] == sxp.child_value(dom, 'name'):
- raise XendError("Domain name '%s' is already used." % \
- domconfig['name_label'])
- else:
- if domconfig['name_label'] == sxp.child_value(dom, 'name'):
- # Overwrite the auto-generated UUID by the UUID
- # of the existing domain. And update the config
- # for that existing domain.
- domconfig['uuid'] = sxp.child_value(dom, 'uuid')
- break
-
dominfo = XendDomainInfo.createDormant(domconfig)
log.debug("Creating new managed domain: %s" %
dominfo.getName())
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 6de4b2ff54..d341176899 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -74,9 +74,15 @@ def create(config):
@return: An up and running XendDomainInfo instance
@raise VmError: Invalid configuration or failure to start.
"""
-
+ from xen.xend import XendDomain
+ domconfig = XendConfig.XendConfig(sxp_obj = config)
+ othervm = XendDomain.instance().domain_lookup_nr(domconfig["name_label"])
+ if othervm is None or othervm.domid is None:
+ othervm = XendDomain.instance().domain_lookup_nr(domconfig["uuid"])
+ if othervm is not None and othervm.domid is not None:
+ raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid))
log.debug("XendDomainInfo.create(%s)", scrub_password(config))
- vm = XendDomainInfo(XendConfig.XendConfig(sxp_obj = config))
+ vm = XendDomainInfo(domconfig)
try:
vm.start()
except:
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 755e322f56..bc703ffae2 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -28,6 +28,7 @@
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
+#include <signal.h>
#if defined(__linux__)
#include <linux/kdev_t.h>
#endif
@@ -1011,6 +1012,13 @@ static void top(void)
free(domains);
}
+static int signal_exit;
+
+void signal_exit_handler(int sig)
+{
+ signal_exit = 1;
+}
+
int main(int argc, char **argv)
{
int opt, optind = 0;
@@ -1102,14 +1110,22 @@ int main(int argc, char **argv)
ch = getch();
} while (handle_key(ch));
} else {
- do {
- gettimeofday(&curtime, NULL);
- top();
- oldtime = curtime;
- if ((!loop) && !(--iterations))
- break;
- sleep(delay);
- } while (1);
+ struct sigaction sa = {
+ .sa_handler = signal_exit_handler,
+ .sa_flags = 0
+ };
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+
+ do {
+ gettimeofday(&curtime, NULL);
+ top();
+ oldtime = curtime;
+ if ((!loop) && !(--iterations))
+ break;
+ sleep(delay);
+ } while (!signal_exit);
}
/* Cleanup occurs in cleanup(), so no work to do here. */
diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 912bcdf937..aa85025cf3 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -21,6 +21,7 @@
#include <argp.h>
#include <signal.h>
#include <string.h>
+#include <inttypes.h>
#include <getopt.h>
#include "xenctrl.h"
@@ -152,9 +153,9 @@ void print_symbol(size_t addr)
return;
if (addr==s->address)
- printf("%s", s->name);
+ printf("%s ", s->name);
else
- printf("%s+%#x", s->name, (unsigned int)(addr - s->address));
+ printf("%s+%#x ", s->name, (unsigned int)(addr - s->address));
}
void read_symbol_table(const char *symtab)
@@ -207,6 +208,46 @@ void read_symbol_table(const char *symtab)
fclose(f);
}
+#if defined(__i386__) || defined(__x86_64__)
+char *flag_values[22][2] =
+{/* clear, set, bit# */
+ { NULL, "c" }, // 0 Carry
+ { NULL, NULL }, // 1
+ { NULL, "p" }, // 2 Parity
+ { NULL, NULL }, // 3
+ { NULL, "a" }, // 4 Adjust
+ { NULL, NULL }, // 5
+ { "nz", "z" }, // 6 Zero
+ { NULL, "s" }, // 7 Sign
+ { NULL, "tf" }, // 8 Trap
+ { NULL, "i" }, // 9 Interrupt (enabled)
+ { NULL, "d=b" }, // 10 Direction
+ { NULL, "o" }, // 11 Overflow
+ { NULL, NULL }, // 12 12+13 == IOPL
+ { NULL, NULL }, // 13
+ { NULL, "nt" }, // 14 Nested Task
+ { NULL, NULL }, // 15
+ { NULL, "rf" }, // 16 Resume Flag
+ { NULL, "v86" }, // 17 Virtual 8086 mode
+ { NULL, "ac" }, // 18 Alignment Check (enabled)
+ { NULL, "vif" }, // 19 Virtual Interrupt (enabled)
+ { NULL, "vip" }, // 20 Virtual Interrupt Pending
+ { NULL, "cid" } // 21 Cpuid Identification Flag
+};
+
+void print_flags(uint64_t flags)
+{
+ int i;
+
+ printf("flags: %08" PRIx64, flags);
+ for (i = 21; i >= 0; i--) {
+ char *s = flag_values[i][(flags >> i) & 1];
+ if (s != NULL)
+ printf(" %s", s);
+ }
+}
+#endif
+
#ifdef __i386__
void print_ctx(vcpu_guest_context_t *ctx1)
{
@@ -214,6 +255,7 @@ void print_ctx(vcpu_guest_context_t *ctx1)
printf("eip: %08x ", regs->eip);
print_symbol(regs->eip);
+ print_flags(regs->eflags);
printf("\n");
printf("esp: %08x\n", regs->esp);
@@ -240,6 +282,7 @@ void print_ctx(vcpu_guest_context_t *ctx1)
printf("rip: %08lx ", regs->rip);
print_symbol(regs->rip);
+ print_flags(regs->rflags);
printf("\n");
printf("rsp: %08lx\n", regs->rsp);
@@ -262,10 +305,10 @@ void print_ctx(vcpu_guest_context_t *ctx1)
printf("r14: %08lx\t", regs->r14);
printf("r15: %08lx\n", regs->r15);
- printf(" cs: %08x\t", regs->cs);
- printf(" ds: %08x\t", regs->ds);
- printf(" fs: %08x\t", regs->fs);
- printf(" gs: %08x\n", regs->gs);
+ printf(" cs: %04x\t", regs->cs);
+ printf(" ds: %04x\t", regs->ds);
+ printf(" fs: %04x\t", regs->fs);
+ printf(" gs: %04x\n", regs->gs);
}
#elif defined(__ia64__)
diff --git a/tools/xentrace/xentrace.8 b/tools/xentrace/xentrace.8
index a5ec5c082d..c84e2e913b 100644
--- a/tools/xentrace/xentrace.8
+++ b/tools/xentrace/xentrace.8
@@ -131,4 +131,4 @@ collects the following events from the trace buffer:
Mark A. Williamson <mark.a.williamson@intel.com>
.SH "SEE ALSO"
-xentrace_cpuinfo(1), xentrace_format(1)
+xentrace_format(1)
diff --git a/tools/xentrace/xentrace_format b/tools/xentrace/xentrace_format
index 8a113aceb3..fe019b08d2 100644
--- a/tools/xentrace/xentrace_format
+++ b/tools/xentrace/xentrace_format
@@ -83,11 +83,24 @@ interrupted = 0
defs = read_defs(arg[0])
-# structure of trace record + prepended CPU id (as output by xentrace):
-# CPU(I) TSC(Q) EVENT(L) D1(L) D2(L) D3(L) D4(L) D5(L)
-# read CPU id separately to avoid structure packing problems on 64-bit arch.
-CPUREC = "I"
-TRCREC = "QLLLLLL"
+# structure of trace record (as output by xentrace):
+# HDR(I) {TSC(Q)} D1(I) D2(I) D3(I) D4(I) D5(I)
+#
+# HDR consists of EVENT:28:, n_data:3:, tsc_in:1:
+# EVENT means Event ID
+# n_data means number of data (like D1, D2, ...)
+# tsc_in means TSC data exists(1) or not(0).
+# if tsc_in == 0, TSC(Q) does not exists.
+#
+# CPU ID exists on trace data of EVENT=0x0001f003
+#
+HDRREC = "I"
+TSCREC = "Q"
+D1REC = "I"
+D2REC = "II"
+D3REC = "III"
+D4REC = "IIII"
+D5REC = "IIIII"
last_tsc = [0]
@@ -96,19 +109,58 @@ i=0
while not interrupted:
try:
i=i+1
- line = sys.stdin.read(struct.calcsize(CPUREC))
+ line = sys.stdin.read(struct.calcsize(HDRREC))
if not line:
break
- cpu = struct.unpack(CPUREC, line)[0]
+ event = struct.unpack(HDRREC, line)[0]
+ n_data = event >> 28 & 0x7
+ tsc_in = event >> 31
+
+ d1 = 0
+ d2 = 0
+ d3 = 0
+ d4 = 0
+ d5 = 0
+
+ tsc = 0
+
+ if tsc_in == 1:
+ line = sys.stdin.read(struct.calcsize(TSCREC))
+ if not line:
+ break
+ tsc = struct.unpack(TSCREC, line)[0]
+
+ if n_data == 1:
+ line = sys.stdin.read(struct.calcsize(D1REC))
+ if not line:
+ break
+ (d1) = struct.unpack(D1REC, line)
+ if n_data == 2:
+ line = sys.stdin.read(struct.calcsize(D2REC))
+ if not line:
+ break
+ (d1, d2) = struct.unpack(D2REC, line)
+ if n_data == 3:
+ line = sys.stdin.read(struct.calcsize(D3REC))
+ if not line:
+ break
+ (d1, d2, d3) = struct.unpack(D3REC, line)
+ if n_data == 4:
+ line = sys.stdin.read(struct.calcsize(D4REC))
+ if not line:
+ break
+ (d1, d2, d3, d4) = struct.unpack(D4REC, line)
+ if n_data == 5:
+ line = sys.stdin.read(struct.calcsize(D5REC))
+ if not line:
+ break
+ (d1, d2, d3, d4, d5) = struct.unpack(D5REC, line)
+
+ # Event field is 28bit of 'uint32_t' in header, not 'long'.
+ event &= 0x0fffffff
+ if event == 0x1f003:
+ cpu = d1
- line = sys.stdin.read(struct.calcsize(TRCREC))
- if not line:
- break
-
- (tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
-
- # Event field is 'uint32_t', not 'long'.
- event &= 0xffffffff
#tsc = (tscH<<32) | tscL
@@ -116,16 +168,17 @@ while not interrupted:
if cpu >= len(last_tsc):
last_tsc += [0] * (cpu - len(last_tsc) + 1)
- elif tsc < last_tsc[cpu]:
+ elif tsc < last_tsc[cpu] and tsc_in == 1:
print "TSC stepped backward cpu %d ! %d %d" % (cpu,tsc,last_tsc[cpu])
# provide relative TSC
- if last_tsc[cpu] > 0:
+ if last_tsc[cpu] > 0 and tsc_in == 1:
reltsc = tsc - last_tsc[cpu]
else:
reltsc = 0
- last_tsc[cpu] = tsc
+ if tsc_in == 1:
+ last_tsc[cpu] = tsc
if mhz:
tsc = tsc / (mhz*1000000.0)
diff --git a/tools/xm-test/configure.ac b/tools/xm-test/configure.ac
index 14aee142b7..bbc639bdb0 100644
--- a/tools/xm-test/configure.ac
+++ b/tools/xm-test/configure.ac
@@ -85,9 +85,9 @@ AC_SUBST(NET_IP_RANGE)
AC_SUBST(NETWORK_ADDRESS)
AC_SUBST(NETMASK)
-DOM0_INTF="vif0.0"
+DOM0_INTF="eth0"
AC_ARG_WITH(dom0-intf,
- [ --with-dom0-intf=intf Set dom0 interface name [[default="vif0.0"]]],
+ [ --with-dom0-intf=intf Set dom0 interface name [[default="eth0"]]],
[ DOM0_INTF="$withval" ])
AC_SUBST(DOM0_INTF)
diff --git a/tools/xm-test/lib/XmTestLib/NetConfig.py b/tools/xm-test/lib/XmTestLib/NetConfig.py
index fe0cfb429f..919af65fdb 100644
--- a/tools/xm-test/lib/XmTestLib/NetConfig.py
+++ b/tools/xm-test/lib/XmTestLib/NetConfig.py
@@ -71,7 +71,7 @@ def getXendNetConfig():
def checkZeroconfAddresses():
# Make sure there aren't existing zeroconf addresses.
- rc, out = traceCommand("ip addr show |grep \"inet 169.254\" | grep -v vif")
+ rc, out = traceCommand("ip addr show |grep \"inet 169.254\" | grep eth0")
if rc == 0:
raise NetworkError("Zeroconf addresses already used: %s" % out)