[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 4/4] tools/misc: Test for fault injection
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Julien Grall <julien@xxxxxxx> CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> CC: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> RFC: This wants expanding to a few more "default" configurations, and then some thought needs putting torwards automating it. --- tools/misc/.gitignore | 1 + tools/misc/Makefile | 5 +++++ tools/misc/xen-fault-ttl.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 tools/misc/xen-fault-ttl.c diff --git a/tools/misc/.gitignore b/tools/misc/.gitignore index c5fe2cfccd..8d117c3b7d 100644 --- a/tools/misc/.gitignore +++ b/tools/misc/.gitignore @@ -1 +1,2 @@ +xen-fault-ttl xen-ucode diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 7d37f297a9..5c1ed9a284 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -9,6 +9,7 @@ CFLAGS += $(CFLAGS_libxenctrl) CFLAGS += $(CFLAGS_libxenguest) CFLAGS += $(CFLAGS_xeninclude) CFLAGS += $(CFLAGS_libxenstore) +CFLAGS += -Wno-declaration-after-statement # Everything to be installed in regular bin/ INSTALL_BIN-$(CONFIG_X86) += xen-cpuid @@ -25,6 +26,7 @@ INSTALL_SBIN-$(CONFIG_X86) += xen-lowmemd INSTALL_SBIN-$(CONFIG_X86) += xen-mfndump INSTALL_SBIN-$(CONFIG_X86) += xen-ucode INSTALL_SBIN += xencov +INSTALL_SBIN += xen-fault-ttl INSTALL_SBIN += xenhypfs INSTALL_SBIN += xenlockprof INSTALL_SBIN += xenperf @@ -76,6 +78,9 @@ distclean: clean xen-cpuid: xen-cpuid.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS) +xen-fault-ttl: xen-fault-ttl.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS) + xen-hvmctx: xen-hvmctx.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) diff --git a/tools/misc/xen-fault-ttl.c b/tools/misc/xen-fault-ttl.c new file mode 100644 index 0000000000..e7953443da --- /dev/null +++ b/tools/misc/xen-fault-ttl.c @@ -0,0 +1,56 @@ +#include <stdio.h> +#include <err.h> +#include <string.h> +#include <errno.h> + +#include <xenctrl.h> + +int main(int argc, char **argv) +{ + int rc; + xc_interface *xch = xc_interface_open(NULL, NULL, 0); + + if ( !xch ) + err(1, "xc_interface_open"); + + struct xen_domctl_createdomain create = { + .fault_ttl = 1, + .flags = (XEN_DOMCTL_CDF_hvm | + XEN_DOMCTL_CDF_hap), + .max_vcpus = 1, + .max_evtchn_port = -1, + .max_grant_frames = 64, + .max_maptrack_frames = 1024, + .arch = { + .emulation_flags = XEN_X86_EMU_LAPIC, + }, + }; + uint32_t domid = 0; + + for ( rc = 1; rc && errno == ENOMEM; create.fault_ttl++ ) + rc = xc_domain_create(xch, &domid, &create); + + if ( rc == 0 ) + { + printf("Created d%u with fault_ttl of %u\n", domid, create.fault_ttl); + + xc_domain_destroy(xch, domid); + } + else + printf("Domain creation failed: %d: %s\n", + -errno, strerror(errno)); + + xc_interface_close(xch); + + return 0; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |