tools/tests: Introduce a test for acquire_resource
PATCH 1/1 tools/tests: Introduce a test for acquire_resource
For now, simply try to map 40 frames of grant table. This catches most of the basic errors with resource sizes found and fixed through the 4.15 dev window.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Oleksandr <[email protected]>
Fails against current staging:
XENMEM_acquire_resource tests
Test x86 PV
d7: grant table
Fail: Map 7 - Argument list too long
Test x86 PVH
d8: grant table
Fail: Map 7 - Argument list too long
The fix has already been posted:
[PATCH v9 01/11] xen/memory: Fix mapping grant tables with XENMEM_acquire_resource
and the fixed run is:
XENMEM_acquire_resource tests
Test x86 PV
d7: grant table
Test x86 PVH
d8: grant table
ARM folk: would you mind testing this? I'm pretty sure the create parameters are suitable, but I don't have any way to test this.
I've got more plans for this, but insufficient time right now.
--- tools/tests/Makefile | 1 + tools/tests/resource/.gitignore | 1 + tools/tests/resource/Makefile | 40 ++++++++++ tools/tests/resource/test-resource.c | 138 +++++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 tools/tests/resource/.gitignore create mode 100644 tools/tests/resource/Makefile create mode 100644 tools/tests/resource/test-resource.c
tools/tests/Makefile +1 -0
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk SUBDIRS-y := +SUBDIRS-y := resource SUBDIRS-$(CONFIG_X86) += cpu-policy SUBDIRS-$(CONFIG_X86) += mce-test ifneq ($(clang),y)
tools/tests/resource/.gitignore new file +1 -0
@@ -0,0 +1 @@ +test-resource
tools/tests/resource/Makefile new file +40 -0
@@ -0,0 +1,40 @@ +XEN_ROOT = $(CURDIR)/../../.. +include $(XEN_ROOT)/tools/Rules.mk + +TARGET := test-resource + +.PHONY: all +all: $(TARGET) + +.PHONY: run +run: $(TARGET) + ./$(TARGET) + +.PHONY: clean +clean: + $(RM) -f -- *.o .*.d .*.d2 $(TARGET) + +.PHONY: distclean +distclean: clean + $(RM) -f -- *~ + +.PHONY: install +install: all + +.PHONY: uninstall +uninstall: + +CFLAGS += -Werror -D__XEN_TOOLS__ +CFLAGS += $(CFLAGS_xeninclude) +CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenforeginmemory) +CFLAGS += $(APPEND_CFLAGS) + +LDFLAGS += $(LDLIBS_libxenctrl) +LDFLAGS += $(LDLIBS_libxenforeignmemory) +LDFLAGS += $(APPEND_LDFLAGS) + +test-resource: test-resource.o + $(CC) $(LDFLAGS) -o $@ $< + +-include $(DEPS_INCLUDE)
tools/tests/resource/test-resource.c new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
2.11.0
Andrew Cooper writes ("[PATCH for-4.15] tools/tests: Introduce a test for acquire_resource"):
Quoted 2 lines
For now, simply try to map 40 frames of grant table. This catches most of the basic errors with resource sizes found and fixed through the 4.15 dev window.
FTAOD
Hi Andrew.
[Sorry for the possible format issues]
Quoted 39 lines · Andrew Cooper
For now, simply try to map 40 frames of grant table. This catches most of the
basic errors with resource sizes found and fixed through the 4.15 dev window.Signed-off-by Andrew Cooper <[email protected]>---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Oleksandr <[email protected]>Fails against current staging:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Fail: Map 7 - Argument list too long
Test x86 PVH
d8: grant table
Fail: Map 7 - Argument list too longThe fix has already been posted:
[PATCH v9 01/11] xen/memory: Fix mapping grant tables withXENMEM_acquire_resourceand the fixed run is:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Test x86 PVH
d8: grant table
Quoted 4 lines
ARM folk: would you mind testing this? I'm pretty sure the create parameters
are suitable, but I don't have any way to test this.
Yes, as it was agreed on IRC, I will test this today's evening and inform about the results)
Quoted 229 lines
I've got more plans for this, but insufficient time right now.
--- tools/tests/Makefile | 1 + tools/tests/resource/.gitignore | 1 + tools/tests/resource/Makefile | 40 ++++++++++ tools/tests/resource/test-resource.c | 138 +++++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 tools/tests/resource/.gitignore create mode 100644 tools/tests/resource/Makefile create mode 100644 tools/tests/resource/test-resource.ctools/tests/Makefile +1
-0@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk SUBDIRS-y := +SUBDIRS-y := resource SUBDIRS-$(CONFIG_X86) += cpu-policy SUBDIRS-$(CONFIG_X86) += mce-test ifneq ($(clang),y)tools/tests/resource/.gitignore new file +1
-0@@ -0,0 +1 @@ +test-resourcetools/tests/resource/Makefile new file +40
-0@@ -0,0 +1,40 @@ +XEN_ROOT = $(CURDIR)/../../.. +include $(XEN_ROOT)/tools/Rules.mk + +TARGET := test-resource + +.PHONY: all +all: $(TARGET) + +.PHONY: run +run: $(TARGET) + ./$(TARGET) + +.PHONY: clean +clean: + $(RM) -f -- *.o .*.d .*.d2 $(TARGET) + +.PHONY: distclean +distclean: clean + $(RM) -f -- *~ + +.PHONY: install +install: all + +.PHONY: uninstall +uninstall: + +CFLAGS += -Werror -D__XEN_TOOLS__ +CFLAGS += $(CFLAGS_xeninclude) +CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenforeginmemory) +CFLAGS += $(APPEND_CFLAGS) + +LDFLAGS += $(LDLIBS_libxenctrl) +LDFLAGS += $(LDLIBS_libxenforeignmemory) +LDFLAGS += $(APPEND_LDFLAGS) + +test-resource: test-resource.o + $(CC) $(LDFLAGS) -o $@ $< + +-include $(DEPS_INCLUDE)tools/tests/resource/test-resource.c new file +37
-0@@ -0,0 +1,138 @@ +#include <err.h> +#include <errno.h> +#include <error.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> + +#include <xenctrl.h> +#include <xenforeignmemory.h> +#include <xendevicemodel.h> +#include <xen-tools/libs.h> + +static unsigned int nr_failures; +#define fail (fmt, ...) \ +({ \ + nr_failures++; \ + (void)printf(fmt, ##__VA_ARGS__); \ +}) + +static xc_interface *xch; +static xenforeignmemory_handle *fh; +static xendevicemodel_handle *dh; + +static void test_gnttab (uint32_t domid,unsigned int nr_frames) +{ +xenforeignmemory_resource_handle *res; +void *addr =NULL ; +size_t size; +int rc; + +printf (" d%u: grant table\n" , domid); + + rc =xenforeignmemory_resource_size ( + fh, domid, XENMEM_resource_grant_table, + XENMEM_resource_grant_table_id_shared, &size); +if ( rc ) + return fail(" Fail: Get size: %d - %s\n", errno,strerror(errno));
tools/tests/resource/test-resource.c new file +101
-1+ +if ( (size >>XC_PAGE_SHIFT ) != nr_frames ) +return fail (" Fail: Get size: expected %u frames, got %zu\n" , + nr_frames, size >>XC_PAGE_SHIFT ); + + res =xenforeignmemory_map_resource ( + fh, domid, XENMEM_resource_grant_table, + XENMEM_resource_grant_table_id_shared,0 , size >>XC_PAGE_SHIFT , + &addr,PROT_READ |PROT_WRITE ,0 ); +if ( !res ) +return fail (" Fail: Map %d - %s\n" , errno,strerror (errno)); + + rc =xenforeignmemory_unmap_resource (fh, res); +if ( rc ) +return fail (" Fail: Unmap %d - %s\n" , errno,strerror (errno)); +} + +static void test_domain_configurations (void ) +{ +static struct test { +const char *name; +struct xen_domctl_createdomain create; + } tests[] = { +#if defined(__x86_64__) || defined(__i386__) + { + .name ="x86 PV" , + .create = { + .max_vcpus =2 , + .max_grant_frames =40 , + }, + }, + { + .name ="x86 PVH" , + .create = { + .flags = XEN_DOMCTL_CDF_hvm, + .max_vcpus =2 , + .max_grant_frames =40 , + .arch = { + .emulation_flags =XEN_X86_EMU_LAPIC , + }, + }, + }, +#elif defined(__aarch64__) || defined(__arm__) + { + .name ="ARM" , + .create = { + .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap, + .max_vcpus =2 , + .max_grant_frames =40 , + }, + }, +#endif + }; + +for (unsigned int i =0 ; i <ARRAY_SIZE (tests); ++i ) + { +struct test *t = &tests[i]; +uint32_t domid =0 ; +int rc; + +printf ("Test %s\n" , t->name); + + rc =xc_domain_create (xch, &domid, &t->create); +if ( rc ) + { +if ( errno ==EINVAL || errno ==EOPNOTSUPP ) +printf (" Skip: %d - %s\n" , errno,strerror (errno)); +else +fail (" Domain create failure: %d - %s\n" , + errno,strerror (errno)); +continue ; + } + +test_gnttab (domid, t->create.max_grant_frames); + + rc =xc_domain_destroy (xch, domid); +if ( rc ) +fail (" Failed to destroy domain: %d - %s\n" , + errno,strerror (errno)); + } +} + +int main (int argc,char **argv) +{ +printf ("XENMEM_acquire_resource tests\n" ); + + xch =xc_interface_open (NULL ,NULL ,0 ); + fh =xenforeignmemory_open (NULL ,0 ); + dh =xendevicemodel_open (NULL ,0 ); + +if ( !xch ) +err (1 ,"xc_interface_open" ); +if ( !fh ) +err (1 ,"xenforeignmemory_open" ); +if ( !dh ) +err (1 ,"xendevicemodel_open" ); + +test_domain_configurations (); + +return !!nr_failures; +} --2.11.0
Signature · 3 lines
Regards, Oleksandr Tyshchenko
On 04.02.21 15:29, Oleksandr Tyshchenko wrote:
Hi Andrew
Quoted 49 lines
Hi Andrew.
[Sorry for the possible format issues]On Tue, Feb 2, 2021 at 9:10 PM Andrew Cooper <[email protected] <mailto:[email protected]>> wrote:
For now, simply try to map 40 frames of grant table. This catches most of the
basic errors with resource sizes found and fixed through the 4.15 dev window.Signed-off-by Andrew Cooper <[email protected]<mailto:[email protected]>>
---
CC: Ian Jackson <[email protected] <mailto:[email protected]>>
CC: Wei Liu <[email protected] <mailto:[email protected]>>
CC: Jan Beulich <[email protected] <mailto:[email protected]>>
CC: Roger Pau Monné <[email protected] <mailto:[email protected]>>
CC: Wei Liu <[email protected] <mailto:[email protected]>>
CC: Stefano Stabellini <[email protected] <mailto:[email protected]>>
CC: Julien Grall <[email protected] <mailto:[email protected]>>
CC: Volodymyr Babchuk <[email protected] <mailto:[email protected]>>
CC: Oleksandr <[email protected] <mailto:[email protected]>>Fails against current staging:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Fail: Map 7 - Argument list too long
Test x86 PVH
d8: grant table
Fail: Map 7 - Argument list too longThe fix has already been posted:
[PATCH v9 01/11] xen/memory: Fix mapping grant tables withXENMEM_acquire_resourceand the fixed run is:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Test x86 PVH
d8: grant table
Quoted 5 lines
ARM folk: would you mind testing this? I'm pretty sure the create parameters
are suitable, but I don't have any way to test this.Yes, as it was agreed on IRC, I will test this today's evening and inform about the results)
OK, well, I decided to test right away because going to be busy in the evening)
I am based on:
9dc687f x86/debug: fix page-overflow bug in dbg_rw_guest_mem
I noticed the error during building this test in my Yocto environment on Arm:
/media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.2.0/ld: test-resource.o: undefined reference to symbol 'xendevicemodel_open@@VERS_1.0' /media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.2.0/ld: /media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/git/tools/tests/resource/../../../tools/libs/devicemodel/libxendevicemodel.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:38: recipe for target 'test-resource' failed
I didn't investigate whether it is related or not. I just added as following:
tools/tests/resource/Makefile +0 -0
@@ -32,6 +32,7 @@ CFLAGS += $(APPEND_CFLAGS)
LDFLAGS += $(LDLIBS_libxenctrl)
LDFLAGS += $(LDLIBS_libxenforeignmemory)
+LDFLAGS += $(LDLIBS_libxendevicemodel)
LDFLAGS += $(APPEND_LDFLAGS)
test-resource: test-resource.o
I got the following result without and with "[PATCH v9 01/11] xen/memory: Fix mapping grant tables with XENMEM_acquire_resource"
root@generic-armv8-xt-dom0:~# test-resource XENMEM_acquire_resource tests Test ARM d3: grant table xenforeignmemory: error: ioctl failed: Invalid argument Fail: Get size: 22 - Invalid argument
Quoted 240 lines
I've got more plans for this, but insufficient time right now. --- tools/tests/Makefile | 1 + tools/tests/resource/.gitignore | 1 + tools/tests/resource/Makefile | 40 ++++++++++ tools/tests/resource/test-resource.c | 138 +++++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 tools/tests/resource/.gitignore create mode 100644 tools/tests/resource/Makefile create mode 100644 tools/tests/resource/test-resource.c diff --git a/tools/tests/Makefile b/tools/tests/Makefile index fc9b715951..c45b5fbc1d 100644 --- a/tools/tests/Makefile +++ b/tools/tests/Makefile @@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk SUBDIRS-y := +SUBDIRS-y := resource SUBDIRS-$(CONFIG_X86) += cpu-policy SUBDIRS-$(CONFIG_X86) += mce-test ifneq ($(clang),y) diff --git a/tools/tests/resource/.gitignore b/tools/tests/resource/.gitignore new file mode 100644 index 0000000000..4872e97d4b --- /dev/null +++ b/tools/tests/resource/.gitignore @@ -0,0 +1 @@ +test-resource diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile new file mode 100644 index 0000000000..8a3373e786 --- /dev/null +++ b/tools/tests/resource/Makefile @@ -0,0 +1,40 @@ +XEN_ROOT = $(CURDIR)/../../.. +include $(XEN_ROOT)/tools/Rules.mk + +TARGET := test-resource + +.PHONY: all +all: $(TARGET) + +.PHONY: run +run: $(TARGET) + ./$(TARGET) + +.PHONY: clean +clean: + $(RM) -f -- *.o .*.d .*.d2 $(TARGET) + +.PHONY: distclean +distclean: clean + $(RM) -f -- *~ + +.PHONY: install +install: all + +.PHONY: uninstall +uninstall: + +CFLAGS += -Werror -D__XEN_TOOLS__ +CFLAGS += $(CFLAGS_xeninclude) +CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenforeginmemory) +CFLAGS += $(APPEND_CFLAGS) + +LDFLAGS += $(LDLIBS_libxenctrl) +LDFLAGS += $(LDLIBS_libxenforeignmemory) +LDFLAGS += $(APPEND_LDFLAGS) + +test-resource: test-resource.o + $(CC) $(LDFLAGS) -o $@ $< + +-include $(DEPS_INCLUDE) diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c new file mode 100644 index 0000000000..81a2a5cd12 --- /dev/null +++ b/tools/tests/resource/test-resource.c @@ -0,0 +1,138 @@ +#include <err.h> +#include <errno.h> +#include <error.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> + +#include <xenctrl.h> +#include <xenforeignmemory.h> +#include <xendevicemodel.h> +#include <xen-tools/libs.h> + +static unsigned int nr_failures; +#define fail(fmt, ...) \ +({ \ + nr_failures++; \ + (void)printf(fmt, ##__VA_ARGS__); \ +}) + +static xc_interface *xch; +static xenforeignmemory_handle *fh; +static xendevicemodel_handle *dh; + +static void test_gnttab(uint32_t domid, unsigned int nr_frames) +{ + xenforeignmemory_resource_handle *res; + void *addr = NULL; + size_t size; + int rc; + + printf(" d%u: grant table\n", domid); + + rc = xenforeignmemory_resource_size( + fh, domid, XENMEM_resource_grant_table, + XENMEM_resource_grant_table_id_shared, &size); + if ( rc ) + return fail(" Fail: Get size: %d - %s\n", errno, strerror(errno)); + + if ( (size >> XC_PAGE_SHIFT) != nr_frames ) + return fail(" Fail: Get size: expected %u frames, got %zu\n", + nr_frames, size >> XC_PAGE_SHIFT); + + res = xenforeignmemory_map_resource( + fh, domid, XENMEM_resource_grant_table, + XENMEM_resource_grant_table_id_shared, 0, size >> XC_PAGE_SHIFT, + &addr, PROT_READ | PROT_WRITE, 0); + if ( !res ) + return fail(" Fail: Map %d - %s\n", errno, strerror(errno)); + + rc = xenforeignmemory_unmap_resource(fh, res); + if ( rc ) + return fail(" Fail: Unmap %d - %s\n", errno, strerror(errno)); +} + +static void test_domain_configurations(void) +{ + static struct test { + const char *name; + struct xen_domctl_createdomain create; + } tests[] = { +#if defined(__x86_64__) || defined(__i386__) + { + .name = "x86 PV", + .create = { + .max_vcpus = 2, + .max_grant_frames = 40, + }, + }, + { + .name = "x86 PVH", + .create = { + .flags = XEN_DOMCTL_CDF_hvm, + .max_vcpus = 2, + .max_grant_frames = 40, + .arch = { + .emulation_flags = XEN_X86_EMU_LAPIC, + }, + }, + }, +#elif defined(__aarch64__) || defined(__arm__) + { + .name = "ARM", + .create = { + .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap, + .max_vcpus = 2, + .max_grant_frames = 40, + }, + }, +#endif + }; + + for ( unsigned int i = 0; i < ARRAY_SIZE(tests); ++i ) + { + struct test *t = &tests[i]; + uint32_t domid = 0; + int rc; + + printf("Test %s\n", t->name); + + rc = xc_domain_create(xch, &domid, &t->create); + if ( rc ) + { + if ( errno == EINVAL || errno == EOPNOTSUPP ) + printf(" Skip: %d - %s\n", errno, strerror(errno)); + else + fail(" Domain create failure: %d - %s\n", + errno, strerror(errno)); + continue; + } + + test_gnttab(domid, t->create.max_grant_frames); + + rc = xc_domain_destroy(xch, domid); + if ( rc ) + fail(" Failed to destroy domain: %d - %s\n", + errno, strerror(errno)); + } +} + +int main(int argc, char **argv) +{ + printf("XENMEM_acquire_resource tests\n"); + + xch = xc_interface_open(NULL, NULL, 0); + fh = xenforeignmemory_open(NULL, 0); + dh = xendevicemodel_open(NULL, 0); + + if ( !xch ) + err(1, "xc_interface_open"); + if ( !fh ) + err(1, "xenforeignmemory_open"); + if ( !dh ) + err(1, "xendevicemodel_open"); + + test_domain_configurations(); + + return !!nr_failures; +} -- 2.11.0Signature · 3 lines
Regards, Oleksandr Tyshchenko
Signature · 3 lines
Regards, Oleksandr Tyshchenko
Quoted 86 lines · Oleksandr
Quoted 50 lines
Hi Andrew.
[Sorry for the possible format issues]On Tue, Feb 2, 2021 at 9:10 PM Andrew Cooper <[email protected] <mailto:[email protected]>> wrote:
For now, simply try to map 40 frames of grant table. This catches most of the
basic errors with resource sizes found and fixed through the 4.15 dev window.Signed-off-by Andrew Cooper <[email protected]<mailto:[email protected]>>
---
CC: Ian Jackson <[email protected] <mailto:[email protected]>>
CC: Wei Liu <[email protected] <mailto:[email protected]>>
CC: Jan Beulich <[email protected] <mailto:[email protected]>>
CC: Roger Pau Monné <[email protected] <mailto:[email protected]>>
CC: Wei Liu <[email protected] <mailto:[email protected]>>
CC: Stefano Stabellini <[email protected] <mailto:[email protected]>>
CC: Julien Grall <[email protected] <mailto:[email protected]>>
CC: Volodymyr Babchuk <[email protected] <mailto:[email protected]>>
CC: Oleksandr <[email protected] <mailto:[email protected]>>Fails against current staging:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Fail: Map 7 - Argument list too long
Test x86 PVH
d8: grant table
Fail: Map 7 - Argument list too longThe fix has already been posted:
[PATCH v9 01/11] xen/memory: Fix mapping grant tables withXENMEM_acquire_resourceand the fixed run is:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Test x86 PVH
d8: grant tableQuoted 6 lines
ARM folk: would you mind testing this? I'm pretty sure the create parameters
are suitable, but I don't have any way to test this.Yes, as it was agreed on IRC, I will test this today's evening and inform about the results)
OK, well, I decided to test right away because going to be busy in the evening)
I am based on:
9dc687f x86/debug: fix page-overflow bug indbg_rw_guest_memI noticed the error during building this test in my Yocto environment on Arm:
/media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.2.0/ld:
test-resource.o: undefined reference to symbol
'xendevicemodel_open@@VERS_1.0' /media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.2.0/ld:
/media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/git/tools/tests/resource/../../../tools/libs/devicemodel/libxendevicemodel.so.1:
error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:38: recipe for target 'test-resource' failedI didn't investigate whether it is related or not. I just added as following:
tools/tests/resource/Makefile +0
-0@@ -32,6 +32,7 @@ CFLAGS += $(APPEND_CFLAGS)
Quoted 8 lines
LDFLAGS += $(LDLIBS_libxenctrl)
LDFLAGS += $(LDLIBS_libxenforeignmemory)
+LDFLAGS += $(LDLIBS_libxendevicemodel)
LDFLAGS += $(APPEND_LDFLAGS)
test-resource: test-resource.o
Urgh yes - I didn't fully strip out the libxendevicemodel uses. I'll fix that, rather than having this test link against a library which it doesn't use (yet).
Quoted 11 lines
I got the following result without and with "[PATCH v9 01/11] xen/memory: Fix mapping grant tables with
XENMEM_acquire_resource"root@generic-armv8-xt-dom0:~# test-resource XENMEM_acquire_resource tests Test ARM d3: grant table xenforeignmemory: error: ioctl failed: Invalid argument Fail: Get size: 22 - Invalid argument
Ah yes - you also need a bugfix in the dom0 kernel. "xen/privcmd: allow fetching resource sizes" which is in mainline, and also backported to the LTS trees.
However, this did get past the bit I wasn't sure about for ARM, which is good.
~Andrew
Hi Andrew
Quoted 100 lines · Andrew Cooper
Quoted 83 lines · Oleksandr
Quoted 49 lines
Hi Andrew.
[Sorry for the possible format issues]On Tue, Feb 2, 2021 at 9:10 PM Andrew Cooper <[email protected] <mailto:[email protected]>> wrote:
For now, simply try to map 40 frames of grant table. This catches most of the
basic errors with resource sizes found and fixed through the 4.15 dev window.Signed-off-by Andrew Cooper <[email protected]<mailto:[email protected]>>
---
CC: Ian Jackson <[email protected] <mailto:[email protected]>>
CC: Wei Liu <[email protected] <mailto:[email protected]>>
CC: Jan Beulich <[email protected] <mailto:[email protected]>>
CC: Roger Pau Monné <[email protected] <mailto:[email protected]>>
CC: Wei Liu <[email protected] <mailto:[email protected]>>
CC: Stefano Stabellini <[email protected] <mailto:[email protected]>>
CC: Julien Grall <[email protected] <mailto:[email protected]>>
CC: Volodymyr Babchuk <[email protected] <mailto:[email protected]>>
CC: Oleksandr <[email protected] <mailto:[email protected]>>Fails against current staging:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Fail: Map 7 - Argument list too long
Test x86 PVH
d8: grant table
Fail: Map 7 - Argument list too longThe fix has already been posted:
[PATCH v9 01/11] xen/memory: Fix mapping grant tables withXENMEM_acquire_resourceand the fixed run is:
XENMEM_acquire_resourcetests
Test x86 PV
d7: grant table
Test x86 PVH
d8: grant tableQuoted 5 lines
ARM folk: would you mind testing this? I'm pretty sure the create parameters
are suitable, but I don't have any way to test this.Yes, as it was agreed on IRC, I will test this today's evening and inform about the results)
OK, well, I decided to test right away because going to be busy in the evening)
I am based on:
9dc687f x86/debug: fix page-overflow bug indbg_rw_guest_memI noticed the error during building this test in my Yocto environment on Arm:
/media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.2.0/ld: test-resource.o: undefined reference to symbol 'xendevicemodel_open@@VERS_1.0' /media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/8.2.0/ld: /media/b/build/build/tmp/work/x86_64-xt-linux/dom0-image-thin-initramfs/1.0-r0/repo/build/tmp/work/aarch64-poky-linux/xen/4.14.0+gitAUTOINC+e00e0f38c3-r0/git/tools/tests/resource/../../../tools/libs/devicemodel/libxendevicemodel.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:38: recipe for target 'test-resource' failedI didn't investigate whether it is related or not. I just added as following:
tools/tests/resource/Makefile +1
-0@@ -32,6 +32,7 @@ CFLAGS += $(APPEND_CFLAGS) LDFLAGS += $(LDLIBS_libxenctrl) LDFLAGS += $(LDLIBS_libxenforeignmemory) +LDFLAGS += $(LDLIBS_libxendevicemodel) LDFLAGS += $(APPEND_LDFLAGS)Quoted 2 lines
test-resource: test-resource.o
Urgh yes - I didn't fully strip out the libxendevicemodel uses. I'll fix that, rather than having this test link against a library which it doesn't use (yet).
Quoted 10 lines
I got the following result without and with "[PATCH v9 01/11] xen/memory: Fix mapping grant tables with
XENMEM_acquire_resource"root@generic-armv8-xt-dom0:~# test-resource XENMEM_acquire_resource tests Test ARM d3: grant table xenforeignmemory: error: ioctl failed: Invalid argument Fail: Get size: 22 - Invalid argument
Quoted 1 line
Ah yes - you also need a bugfix in the dom0 kernel. "xen/privcmd: allow fetching resource sizes" which is in mainline, and also backported to the LTS trees.
Well, my dom0 Linux is old)
uname -a
Linux generic-armv8-xt-dom0 4.14.75-ltsi-yocto-tiny #1 SMP PREEMPT Thu Nov 5 10:52:32 UTC 2020 aarch64 GNU/Linux so I use ported "xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE".
I didn't find "xen/privcmd: allow fetching resource sizes" for my Linux version, so I backported it by myself.
So, with "[PATCH v9 01/11] xen/memory: Fix mapping grant tables with XENMEM_acquire_resource"
root@generic-armv8-xt-dom0:~# test-resource XENMEM_acquire_resource tests Test ARM d7: grant table (XEN) grant_table.c:1854:d0v1 Expanding d7 grant table from 1 to 32 frames (XEN) grant_table.c:1854:d0v1 Expanding d7 grant table from 32 to 40 frames
[I didn't test without your patch]
Hope that helps.
Quoted 4 lines
However, this did get past the bit I wasn't sure about for ARM, which is good.
~Andrew
Signature · 3 lines
Regards, Oleksandr Tyshchenko
Quoted 39 lines · Oleksandr
Quoted 14 lines · Andrew Cooper
Quoted 5 lines · Oleksandr
I got the following result without and with "[PATCH v9 01/11] xen/memory: Fix mapping grant tables with
XENMEM_acquire_resource"Quoted 7 lines
root@generic-armv8-xt-dom0:~# test-resource XENMEM_acquire_resource tests Test ARM d3: grant table xenforeignmemory: error: ioctl failed: Invalid argument Fail: Get size: 22 - Invalid argumentQuoted 3 lines
Ah yes - you also need a bugfix in the dom0 kernel. "xen/privcmd:
allow fetching resource sizes" which is in mainline, and also backported to the LTS trees.Well, my dom0 Linux is old)
uname -a
Linux generic-armv8-xt-dom0 4.14.75-ltsi-yocto-tiny #1 SMP PREEMPT Thu Nov 5 10:52:32 UTC 2020 aarch64 GNU/Linux
so I use ported "xen/privcmd: addIOCTL_PRIVCMD_MMAP_RESOURCE". I didn't find "xen/privcmd: allow fetching resource sizes" for my Linux version, so I backported it by myself.So, with "[PATCH v9 01/11] xen/memory: Fix mapping grant tables with
XENMEM_acquire_resource"root@generic-armv8-xt-dom0:~# test-resource XENMEM_acquire_resource tests Test ARM d7: grant table (XEN) grant_table.c:1854:d0v1 Expanding d7 grant table from 1 to 32 frames (XEN) grant_table.c:1854:d0v1 Expanding d7 grant table from 32 to 40 frames
Quoted 4 lines
[I didn't test without your patch]
Hope that helps.
Yup - fantastic thankyou.
~Andrew