Optional unit test tools for VMware tools support
cover Optional unit test tools for VMware tools support
As I was finishing up "Add limited support of VMware's hyper-call", I noticed that there was no command line support to access the new features. Do to timing I decided to not delay the patch set any longer, but send it out with out these optional unit test tools.
Since you need "Add limited support of VMware's hyper-call" patch before you can apply this, I made it an RFC.
Current plan is to include them as v3 of the "Xen VMware tools support". I am posting them sooner in order to speed things along.
Don Slutz (3):
Add xen-hvm-param
Add xen-vmware-guestinfo
Add xen-list-vmware-guestinfo
.gitignore | 3 + tools/misc/Makefile | 13 ++- tools/misc/xen-hvm-param.c | 154 +++++++++++++++++++++++++++++++++ tools/misc/xen-list-vmware-guestinfo.c | 88 +++++++++++++++++++ tools/misc/xen-vmware-guestinfo.c | 97 +++++++++++++++++++++ 5 files changed, 353 insertions(+), 2 deletions(-) create mode 100644 tools/misc/xen-hvm-param.c create mode 100644 tools/misc/xen-list-vmware-guestinfo.c create mode 100644 tools/misc/xen-vmware-guestinfo.c
Signature · 1 line
1.8.4
RFC PATCH 1/3 Add xen-hvm-param
A tool to get and set hvm param.
--- .gitignore | 1 + tools/misc/Makefile | 7 ++- tools/misc/xen-hvm-param.c | 154 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 tools/misc/xen-hvm-param.c
.gitignore +1 -0
@@ -179,6 +179,7 @@ tools/misc/xen-tmem-list-parse tools/misc/xenperf tools/misc/xenpm tools/misc/xen-hvmctx +tools/misc/xen-hvm-param tools/misc/gtraceview tools/misc/gtracestat tools/misc/xenlockprof
tools/misc/Makefile +5 -2
@@ -10,7 +10,7 @@ CFLAGS += $(CFLAGS_libxenstore) HDRS = $(wildcard *.h) TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov -TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump +TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvm-param xen-hvmcrash xen-lowmemd xen-mfndump TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y)
@@ -22,7 +22,7 @@ INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xenpm xen-tmem-list-parse gtraceview \ gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov -INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvm-param xen-hvmcrash xen-lowmemd xen-mfndump INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool INSTALL_SBIN := $(INSTALL_SBIN-y)
@@ -57,6 +57,9 @@ clean: xen-hvmctx: xen-hvmctx.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-hvm-param: xen-hvm-param.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + xen-hvmcrash: xen-hvmcrash.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
tools/misc/xen-hvm-param.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
1.8.4
Re: [RFC][PATCH v1 1/3] Add xen-hvm-param
Quoted 155 lines · Don Slutz
A tool to get and set hvm param.
Signed-off-by Don Slutz <[email protected]>--- .gitignore | 1 + tools/misc/Makefile | 7 ++- tools/misc/xen-hvm-param.c | 154 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 tools/misc/xen-hvm-param.c.gitignore +1
-0@@ -179,6 +179,7 @@ tools/misc/xen-tmem-list-parse tools/misc/xenperf tools/misc/xenpm tools/misc/xen-hvmctx +tools/misc/xen-hvm-param tools/misc/gtraceview tools/misc/gtracestat tools/misc/xenlockproftools/misc/Makefile +5
-2@@ -10,7 +10,7 @@ CFLAGS += $(CFLAGS_libxenstore) HDRS = $(wildcard *.h) TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov -TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump +TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvm-param xen-hvmcrash xen-lowmemd xen-mfndump TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y)@@ -22,7 +22,7 @@ INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xenpm xen-tmem-list-parse gtraceview \ gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov -INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvm-param xen-hvmcrash xen-lowmemd xen-mfndump INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool INSTALL_SBIN := $(INSTALL_SBIN-y)@@ -57,6 +57,9 @@ clean: xen-hvmctx: xen-hvmctx.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-hvm-param: xen-hvm-param.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + xen-hvmcrash: xen-hvmcrash.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)tools/misc/xen-hvm-param.c new file +95
-0@@ -0,0 +1,154 @@ +/* +* tools/misc/xen-hvm-param.c +* +* Copyright (C) 2014 Verizon Corporation +* +* This file is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License Version 2 (GPLv2) +* as published by the Free Software Foundation. +* +* This file is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. <http://www.gnu.org/licenses/>. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <err.h> + +#include <xenctrl.h> + + +int +main (int argc,char **argv) +{ +xc_interface *xch; +int domid; +int param; +int ret =0 ; +int i; +char hvm_param_name[HVM_NR_PARAMS ][80 ]; + +unsigned long hvm_param =-1 ; + +if ( (argc <3 ) || (argc >4 ) ) +errx (1 ,"usage: %s domid param [new]" , argv[0 ]); + +for (i =0 ; i <HVM_NR_PARAMS ; i++) +snprintf (hvm_param_name[i],sizeof (hvm_param_name[i]),"Unknown %d" , i); +snprintf (hvm_param_name[HVM_PARAM_CALLBACK_IRQ ], +sizeof (hvm_param_name[HVM_PARAM_CALLBACK_IRQ ]),"Callback_Irq" ); +snprintf (hvm_param_name[HVM_PARAM_STORE_PFN ], +sizeof (hvm_param_name[HVM_PARAM_STORE_PFN ]),"Store_Pfn" ); +snprintf (hvm_param_name[HVM_PARAM_STORE_EVTCHN ], +sizeof (hvm_param_name[HVM_PARAM_STORE_EVTCHN ]),"Store_Evtchn" ); +snprintf (hvm_param_name[HVM_PARAM_PAE_ENABLED ], +sizeof (hvm_param_name[HVM_PARAM_PAE_ENABLED ]),"Pae_Enabled" ); +snprintf (hvm_param_name[HVM_PARAM_IOREQ_PFN ], +sizeof (hvm_param_name[HVM_PARAM_IOREQ_PFN ]),"Ioreq_Pfn" ); +snprintf (hvm_param_name[HVM_PARAM_BUFIOREQ_PFN ], +sizeof (hvm_param_name[HVM_PARAM_BUFIOREQ_PFN ]),"Bufioreq_Pfn" ); +snprintf (hvm_param_name[HVM_PARAM_VIRIDIAN ], +sizeof (hvm_param_name[HVM_PARAM_VIRIDIAN ]),"Viridian" ); +snprintf (hvm_param_name[HVM_PARAM_TIMER_MODE ], +sizeof (hvm_param_name[HVM_PARAM_TIMER_MODE ]),"Timer_Mode" ); +snprintf (hvm_param_name[HVM_PARAM_HPET_ENABLED ], +sizeof (hvm_param_name[HVM_PARAM_HPET_ENABLED ]),"Hpet_Enabled" ); +snprintf (hvm_param_name[HVM_PARAM_IDENT_PT ], +sizeof (hvm_param_name[HVM_PARAM_IDENT_PT ]),"Ident_Pt" ); +snprintf (hvm_param_name[HVM_PARAM_DM_DOMAIN ], +sizeof (hvm_param_name[HVM_PARAM_DM_DOMAIN ]),"Dm_Domain" ); +snprintf (hvm_param_name[HVM_PARAM_ACPI_S_STATE ], +sizeof (hvm_param_name[HVM_PARAM_ACPI_S_STATE ]),"Acpi_S_State" ); +snprintf (hvm_param_name[HVM_PARAM_VM86_TSS ], +sizeof (hvm_param_name[HVM_PARAM_VM86_TSS ]),"Vm86_Tss" ); +snprintf (hvm_param_name[HVM_PARAM_VPT_ALIGN ], +sizeof (hvm_param_name[HVM_PARAM_VPT_ALIGN ]),"Vpt_Align" ); +snprintf (hvm_param_name[HVM_PARAM_CONSOLE_PFN ], +sizeof (hvm_param_name[HVM_PARAM_CONSOLE_PFN ]),"Console_Pfn" ); +snprintf (hvm_param_name[HVM_PARAM_CONSOLE_EVTCHN ], +sizeof (hvm_param_name[HVM_PARAM_CONSOLE_EVTCHN ]),"Console_Evtchn" ); +snprintf (hvm_param_name[HVM_PARAM_ACPI_IOPORTS_LOCATION ], +sizeof (hvm_param_name[HVM_PARAM_ACPI_IOPORTS_LOCATION ]), +"Acpi_Ioports_Location" ); +snprintf (hvm_param_name[HVM_PARAM_MEMORY_EVENT_CR0 ], +sizeof (hvm_param_name[HVM_PARAM_MEMORY_EVENT_CR0 ]),"Memory_Event_Cr0" ); +snprintf (hvm_param_name[HVM_PARAM_MEMORY_EVENT_CR3 ], +sizeof (hvm_param_name[HVM_PARAM_MEMORY_EVENT_CR3 ]),"Memory_Event_Cr3" ); +snprintf (hvm_param_name[HVM_PARAM_MEMORY_EVENT_CR4 ], +sizeof (hvm_param_name[HVM_PARAM_MEMORY_EVENT_CR4 ]),"Memory_Event_Cr4" ); +snprintf (hvm_param_name[HVM_PARAM_MEMORY_EVENT_INT3 ], +sizeof (hvm_param_name[HVM_PARAM_MEMORY_EVENT_INT3 ]),"Memory_Event_Int3" ); +snprintf (hvm_param_name[HVM_PARAM_NESTEDHVM ], +sizeof (hvm_param_name[HVM_PARAM_NESTEDHVM ]),"Nestedhvm" ); +snprintf (hvm_param_name[HVM_PARAM_MEMORY_EVENT_SINGLE_STEP ], +sizeof (hvm_param_name[HVM_PARAM_MEMORY_EVENT_SINGLE_STEP ]), +"Memory_Event_Single_Step" ); +snprintf (hvm_param_name[HVM_PARAM_BUFIOREQ_EVTCHN ], +sizeof (hvm_param_name[HVM_PARAM_BUFIOREQ_EVTCHN ]),"Bufioreq_Evtchn" ); +snprintf (hvm_param_name[HVM_PARAM_PAGING_RING_PFN ], +sizeof (hvm_param_name[HVM_PARAM_PAGING_RING_PFN ]),"Paging_Ring_Pfn" ); +snprintf (hvm_param_name[HVM_PARAM_ACCESS_RING_PFN ], +sizeof (hvm_param_name[HVM_PARAM_ACCESS_RING_PFN ]),"Access_Ring_Pfn" ); +snprintf (hvm_param_name[HVM_PARAM_SHARING_RING_PFN ], +sizeof (hvm_param_name[HVM_PARAM_SHARING_RING_PFN ]),"Sharing_Ring_Pfn" );
tools/misc/xen-hvm-param.c line 105
Quoted 10 lines
tools/misc/xen-hvm-param.c new file +10
-0+snprintf (hvm_param_name[HVM_PARAM_VMWARE_HW ], +sizeof (hvm_param_name[HVM_PARAM_VMWARE_HW ]),"Vmware_Hw" ); +snprintf (hvm_param_name[HVM_PARAM_VMPORT_BUILD_NUMBER_TIME ], +sizeof (hvm_param_name[HVM_PARAM_VMPORT_BUILD_NUMBER_TIME ]), +"Vmport_Build_Number_Time" ); +snprintf (hvm_param_name[HVM_PARAM_VMPORT_BUILD_NUMBER_VALUE ], +sizeof (hvm_param_name[HVM_PARAM_VMPORT_BUILD_NUMBER_VALUE ]), +"Vmport_Build_Number_Value" ); +snprintf (hvm_param_name[HVM_PARAM_VMPORT_RESET_TIME ], +sizeof (hvm_param_name[HVM_PARAM_VMPORT_RESET_TIME ]),"Vmport_Reset_Time" );
Surely all these snprintfs can be replaced with some compiler magic, to vastly reduce its complexity.
static const char * hvm_param_names[] =
{
"Callback_Irq",
"Store_Pfn",
...
};static const char *hvm_param_name(unsigned int param)
{
return param < ARRAY_SIZE(hvm_param_names) ? hvm_param_names[param]
: "Unknown";
}
It might also be nice to have a "dump all" option.
~Andrew
Quoted 49 lines
tools/misc/xen-hvm-param.c new file +49
-0+ + xch =xc_interface_open (0 ,0 ,0 ); +if ( !xch ) +err (1 ,"failed to open control interface" ); + + domid =atoi (argv[1 ]); + param =atoi (argv[2 ]); + + ret =xc_get_hvm_param (xch, domid, param, &hvm_param); +if ( ret ) +err (1 ,"failed to get hvm param %d for domid %d" , param, domid); +else + { +if ( argc ==4 ) + { +long new =strtol (argv[3 ],NULL ,0 ); + + ret =xc_set_hvm_param (xch, domid, param, new); +if ( ret ) +err (1 ,"failed to set hvm param %d for domid %d" , param, domid); +else if ( (param >=0 ) && (param <HVM_NR_PARAMS ) ) +printf ("hvm_param(%s)=0x%lx(%ld) was 0x%lx(%ld)\n" , + hvm_param_name[param], new, new, hvm_param, hvm_param); +else +printf ("hvm_param(%d)=0x%lx(%ld) was 0x%lx(%ld)\n" , + param, new, new, hvm_param, hvm_param); + } +else + { +if ( (param >=0 ) && (param <HVM_NR_PARAMS ) ) +printf ("hvm_param(%s)=0x%lx(%ld)\n" , hvm_param_name[param], hvm_param, + hvm_param); +else +printf ("hvm_param(%d)=0x%lx(%ld)\n" , param, hvm_param, hvm_param); + } + } +xc_interface_close (xch); + +return ret; +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Re: [RFC][PATCH v1 1/3] Add xen-hvm-param
Quoted 5 lines · Andrew Cooper
Quoted 4 lines · Don Slutz
A tool to get and set hvm param.
Signed-off-by Don Slutz <[email protected]>---
...
Quoted 15 lines
tools/misc/xen-hvm-param.c line 105
Quoted 5 lines
tools/misc/xen-hvm-param.c new file +5
-0+snprintf (hvm_param_name[HVM_PARAM_VMPORT_BUILD_NUMBER_VALUE ], +sizeof (hvm_param_name[HVM_PARAM_VMPORT_BUILD_NUMBER_VALUE ]), +"Vmport_Build_Number_Value" ); +snprintf (hvm_param_name[HVM_PARAM_VMPORT_RESET_TIME ], +sizeof (hvm_param_name[HVM_PARAM_VMPORT_RESET_TIME ]),"Vmport_Reset_Time" );Surely all these snprintfs can be replaced with some compiler magic, to vastly reduce its complexity.
static const char * hvm_param_names[] =
{ "Callback_Irq", "Store_Pfn", ... };
Quoted 5 lines
static const char *hvm_param_name(unsigned int param)
{
return param <ARRAY_SIZE(hvm_param_names)? hvm_param_names[param]
: "Unknown";
}
There might be. I just went with the fastest way to do this (an emacs macro...)
Quoted 2 lines
It might also be nice to have a "dump all" option.
Yes. How about if only domain id specified, all are dumpped?
-Don Slutz
Quoted 3 lines
~Andrew
RFC PATCH 2/3 Add xen-vmware-guestinfo
In reply to Don SlutzA tool to get and set VMware guestinfo
--- .gitignore | 1 + tools/misc/Makefile | 7 ++- tools/misc/xen-vmware-guestinfo.c | 97 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 tools/misc/xen-vmware-guestinfo.c
.gitignore +1 -0
@@ -180,6 +180,7 @@ tools/misc/xenperf tools/misc/xenpm tools/misc/xen-hvmctx tools/misc/xen-hvm-param +tools/misc/xen-vmware-guestinfo tools/misc/gtraceview tools/misc/gtracestat tools/misc/xenlockprof
tools/misc/Makefile +5 -2
@@ -10,7 +10,7 @@ CFLAGS += $(CFLAGS_libxenstore) HDRS = $(wildcard *.h) TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov -TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvm-param xen-hvmcrash xen-lowmemd xen-mfndump +TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvm-param xen-vmware-guestinfo xen-hvmcrash xen-lowmemd xen-mfndump TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y)
@@ -22,7 +22,7 @@ INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xenpm xen-tmem-list-parse gtraceview \ gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov -INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvm-param xen-hvmcrash xen-lowmemd xen-mfndump +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvm-param xen-vmware-guestinfo xen-hvmcrash xen-lowmemd xen-mfndump INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool INSTALL_SBIN := $(INSTALL_SBIN-y)
@@ -60,6 +60,9 @@ xen-hvmctx: xen-hvmctx.o xen-hvm-param: xen-hvm-param.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-vmware-guestinfo: xen-vmware-guestinfo.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + xen-hvmcrash: xen-hvmcrash.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
tools/misc/xen-vmware-guestinfo.c new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
1.8.4
RFC PATCH 3/3 Add xen-list-vmware-guestinfo
In reply to Don SlutzA tool to list currently set VMware guestinfo
--- .gitignore | 1 + tools/misc/Makefile | 7 ++- tools/misc/xen-list-vmware-guestinfo.c | 88 ++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 tools/misc/xen-list-vmware-guestinfo.c
.gitignore +1 -0
@@ -181,6 +181,7 @@ tools/misc/xenpm tools/misc/xen-hvmctx tools/misc/xen-hvm-param tools/misc/xen-vmware-guestinfo +tools/misc/xen-list-vmware-guestinfo tools/misc/gtraceview tools/misc/gtracestat tools/misc/xenlockprof
tools/misc/Makefile +5 -2
@@ -10,7 +10,7 @@ CFLAGS += $(CFLAGS_libxenstore) HDRS = $(wildcard *.h) TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov -TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvm-param xen-vmware-guestinfo xen-hvmcrash xen-lowmemd xen-mfndump +TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvm-param xen-vmware-guestinfo xen-list-vmware-guestinfo xen-hvmcrash xen-lowmemd xen-mfndump TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y)
@@ -22,7 +22,7 @@ INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xenpm xen-tmem-list-parse gtraceview \ gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov -INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvm-param xen-vmware-guestinfo xen-hvmcrash xen-lowmemd xen-mfndump +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvm-param xen-vmware-guestinfo xen-list-vmware-guestinfo xen-hvmcrash xen-lowmemd xen-mfndump INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool INSTALL_SBIN := $(INSTALL_SBIN-y)
@@ -63,6 +63,9 @@ xen-hvm-param: xen-hvm-param.o xen-vmware-guestinfo: xen-vmware-guestinfo.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) +xen-list-vmware-guestinfo: xen-list-vmware-guestinfo.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS) + xen-hvmcrash: xen-hvmcrash.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
tools/misc/xen-list-vmware-guestinfo.c new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
1.8.4