Skip to content

Commit

Permalink
tools/tests: Drop obsolete mce-test infrastructure
Browse files Browse the repository at this point in the history
mce-test has a test suite, but it depends on xend, needs to run in-tree, and
requires manual setup of at least one guest, and manual parameters to pass
into cases.  Drop the test infrasturcture.

Move the one useful remaining item, xen-mceinj, into misc/, fixing some minor
style issues as it goes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
  • Loading branch information
andyhhp committed Jul 9, 2021
1 parent 2c7242b commit 79ca512
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 1,138 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ tools/tests/x86_emulator/test_x86_emulator
tools/tests/x86_emulator/x86_emulate
tools/tests/x86_emulator/xop*.[ch]
tools/tests/xenstore/xs-test
tools/tests/mce-test/tools/xen-mceinj
tools/tests/vpci/list.h
tools/tests/vpci/vpci.[hc]
tools/tests/vpci/test_vpci
Expand Down
1 change: 1 addition & 0 deletions tools/misc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
xen-access
xen-mceinj
xen-memshare
xen-ucode
xen-vmtrace
4 changes: 4 additions & 0 deletions tools/misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
INSTALL_SBIN-$(CONFIG_X86) += xen-hvmcrash
INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx
INSTALL_SBIN-$(CONFIG_X86) += xen-lowmemd
INSTALL_SBIN-$(CONFIG_X86) += xen-mceinj
INSTALL_SBIN-$(CONFIG_X86) += xen-memshare
INSTALL_SBIN-$(CONFIG_X86) += xen-mfndump
INSTALL_SBIN-$(CONFIG_X86) += xen-ucode
Expand Down Expand Up @@ -97,6 +98,9 @@ xen-memshare: xen-memshare.o
xen-vmtrace: xen-vmtrace.o
$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)

xen-mceinj: xen-mceinj.o
$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)

xenperf: xenperf.o
$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)

Expand Down
32 changes: 19 additions & 13 deletions tools/tests/mce-test/tools/xen-mceinj.c → tools/misc/xen-mceinj.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static void err(xc_interface *xc_handle, const char *fmt, ...)
va_list args;

va_start(args, fmt);
if (vasprintf(&buf, fmt, args) < 0)
if ( vasprintf(&buf, fmt, args) < 0 )
abort();
perror(buf);
va_end(args);
Expand Down Expand Up @@ -173,7 +173,7 @@ static unsigned int mca_cpuinfo(xc_interface *xc_handle)
mc.cmd = XEN_MC_physcpuinfo;
mc.interface_version = XEN_MCA_INTERFACE_VERSION;

if (!xc_mca_op(xc_handle, &mc))
if ( !xc_mca_op(xc_handle, &mc) )
return mc.u.mc_physcpuinfo.ncpus;
else
return 0;
Expand All @@ -187,9 +187,9 @@ static int inject_cmci(xc_interface *xc_handle, unsigned int cpu_nr)
memset(&mc, 0, sizeof(struct xen_mc));

nr_cpus = mca_cpuinfo(xc_handle);
if (!nr_cpus)
if ( !nr_cpus )
err(xc_handle, "Failed to get mca_cpuinfo");
if (cpu_nr >= nr_cpus)
if ( cpu_nr >= nr_cpus )
err(xc_handle, "-c %u is larger than %u", cpu_nr, nr_cpus - 1);

mc.cmd = XEN_MC_inject_v2;
Expand Down Expand Up @@ -284,7 +284,7 @@ static int add_msr_intpose(xc_interface *xc_handle,
flush_msr_inj(xc_handle);
init_msr_inj();
}
count= msr_inj.mcinj_count;
count = msr_inj.mcinj_count;

if ( !count )
{
Expand Down Expand Up @@ -422,7 +422,7 @@ static long xs_get_dom_mem(int domid)
if (!memstr || !plen)
return -1;

mem = atoll(memstr)*1024;
mem = atoll(memstr) * 1024;
free(memstr);

return mem;
Expand Down Expand Up @@ -474,17 +474,20 @@ int main(int argc, char *argv[])
cpu_nr = 0;

init_msr_inj();
xc_handle = xc_interface_open(0, 0, 0);
if ( !xc_handle ) {
xc_handle = xc_interface_open(NULL, NULL, 0);
if ( !xc_handle )
{
Lprintf("Failed to get xc interface");
exit(EXIT_FAILURE);
}

while ( 1 ) {
while ( 1 )
{
c = getopt_long(argc, argv, "c:Dd:t:hp:l", opts, &opt_index);
if ( c == -1 )
break;
switch ( c ) {
switch ( c )
{
case 'D':
dump=1;
break;
Expand Down Expand Up @@ -516,23 +519,26 @@ int main(int argc, char *argv[])
}
}

if ( domid != DOMID_XEN ) {
if ( domid != DOMID_XEN )
{
max_gpa = xs_get_dom_mem(domid);
Lprintf("get domain %d max gpa is: 0x%lx", domid, max_gpa);
if ( gaddr >= max_gpa )
err(xc_handle, "Fail: gaddr exceeds max_gpa 0x%lx", max_gpa);
}
Lprintf("get gaddr of error inject is: 0x%lx", gaddr);

if ( dump ) {
if ( dump )
{
if ( domid == DOMID_XEN )
Lprintf("Xen: gaddr=0x%lx", gaddr);
else
Lprintf("Dom%d: gaddr=0x%lx", domid, gaddr);
goto out;
}

if ( type < 0 || type >= MCE_TABLE_SIZE ) {
if ( type < 0 || type >= MCE_TABLE_SIZE )
{
err(xc_handle, "Unsupported error type");
goto out;
}
Expand Down
1 change: 0 additions & 1 deletion tools/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
SUBDIRS-y :=
SUBDIRS-y += resource
SUBDIRS-$(CONFIG_X86) += cpu-policy
SUBDIRS-$(CONFIG_X86) += mce-test
SUBDIRS-$(CONFIG_X86) += tsx
ifneq ($(clang),y)
SUBDIRS-$(CONFIG_X86) += x86_emulator
Expand Down
12 changes: 0 additions & 12 deletions tools/tests/mce-test/Makefile

This file was deleted.

75 changes: 0 additions & 75 deletions tools/tests/mce-test/README

This file was deleted.

73 changes: 0 additions & 73 deletions tools/tests/mce-test/cases/srao_llc/dom0/cases.sh

This file was deleted.

0 comments on commit 79ca512

Please sign in to comment.