Skip to contentSkip to conversation

Xen and XTF build fixes series

PATCH In review Christopher Clark 2 participants 6 messages Jul 8, 2021 – Jul 14, 2021

lore
Share & tools
lore
#0 lore raw

v2 cover Xen and XTF build fixes series

Pull in updates from upstream Xen and XTF for GCC 11 and fix passing compiler flags for the Xen hypervisor, tools and test framework.

Changes since v1:
- for Xen 4.14, drop the previous cherry-picked compiler fix patch via an update of SRCREV to the current tip of stable-4.14
- add a patch to drop an unnecessary compiler flag override for the Arm 32-bit Xen tools build

Christopher Clark (4):
xen, xen-tools: apply upstream fixes for gcc11 compilation xen, xen-tools: fix build and passing of CFLAGS via Xen vars
xtf: fix build with gcc11 SRCREV and specifying linker
xen-tools: remove Arm 32-bit compiler flags override

 ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
 ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
 recipes-extended/xen/xen-hypervisor.inc       |   3 +-
 recipes-extended/xen/xen-tools.inc            |   6 +-
 recipes-extended/xen/xen-tools_4.14.bb        |   3 +-
 recipes-extended/xen/xen-tools_4.15.bb        |   1 +
 recipes-extended/xen/xen-tools_git.bb         |   1 +
 recipes-extended/xen/xen.inc                  |  13 +-
 recipes-extended/xen/xen_4.14.bb              |   2 +-
 recipes-extended/xen/xen_4.15.bb              |   1 +
 recipes-extended/xen/xen_git.bb               |   1 +
 recipes-extended/xen/xtf_git.bb               |   3 +-
 12 files changed, 167 insertions(+), 11 deletions(-)
 create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
 create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/4 xen, xen-tools: apply upstream fixes for gcc11 compilation

Apply patches for the tools and hypervisor to Xen 4.15 and the git recipe and uprev Xen 4.14 to latest stable revision. Retire the previous -Wno-vla-parameter workaround.

---
 ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
 ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
 recipes-extended/xen/xen-tools.inc            |   5 +-
 recipes-extended/xen/xen-tools_4.14.bb        |   3 +-
 recipes-extended/xen/xen-tools_4.15.bb        |   1 +
 recipes-extended/xen/xen-tools_git.bb         |   1 +
 recipes-extended/xen/xen_4.14.bb              |   2 +-
 recipes-extended/xen/xen_4.15.bb              |   1 +
 recipes-extended/xen/xen_git.bb               |   1 +
 9 files changed, 152 insertions(+), 6 deletions(-)
 create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
 create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch new file +33 -0
new file mode 100644
index 0000000..2e3b1a6
@@ -0,0 +1,33 @@
+From 5d3e4ebb5c71477d74a0c503438545a0126d3863 Mon Sep 17 00:00:00 2001
+From: Anthony PERARD <[email protected]>
+Date: Tue, 1 Jun 2021 16:41:47 +0100
+Subject: [PATCH] libs/foreignmemory: Fix osdep_xenforeignmemory_map prototype
+
+Commit cf8c4d3d13b8 made some preparation to have one day
+variable-length-array argument, but didn't declare the array in the
+function prototype the same way as in the function definition. And now
+GCC 11 complains about it.
+
+Fixes: cf8c4d3d13b8 ("tools/libs/foreignmemory: pull array length argument to map forward")
+Signed-off-by: Anthony PERARD <[email protected]>
+Reviewed-by: Jan Beulich <[email protected]>
+---
+ tools/libs/foreignmemory/private.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h
+index 1ee3626dd2..5bb0cefb09 100644
+--- a/tools/libs/foreignmemory/private.h
++++ b/tools/libs/foreignmemory/private.h
+@@ -32,7 +32,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem);
+ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
+                                  uint32_t dom, void *addr,
+                                  int prot, int flags, size_t num,
+-                                 const xen_pfn_t arr[num], int err[num]);
++                                 const xen_pfn_t arr[/*num*/], int err[/*num*/]);
+ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
+                                  void *addr, size_t num);
+ 
+-- 
+2.25.1
+
recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch new file +111 -0

111 lines not on this page · raw message

recipes-extended/xen/xen-tools.inc +1 -4
index e939c45..3560e79 100644
@@ -725,12 +725,9 @@ do_configure() {
     do_configure_common
 }
 
-# Workaround when compiling with gcc-11
-EXTRA_CFLAGS_XEN_TOOLS_append = " -Wno-vla-parameter"
-
 do_compile() {
     cd ${S}
-    oe_runmake tools EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" PYTHON="${PYTHON}"
+    oe_runmake tools PYTHON="${PYTHON}"
 }
 
 do_install() {
recipes-extended/xen/xen-tools_4.14.bb +2 -1
index 10982a2..6fd6f7f 100644
@@ -1,4 +1,4 @@
-SRCREV ?= "ad844aa352559a8b1f36e391a27d9d7dbddbdc36"
+SRCREV ?= "b6a8c4f72def4d1135ff42660a86276ce2565c8c"
 
 XEN_REL ?= "4.14"
 XEN_BRANCH ?= "stable-${XEN_REL}"
@@ -8,6 +8,7 @@ SRC_URI = " \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
     file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \
     file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \
+    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen-tools_4.15.bb +1 -0
index 314dc52..f3f9cd3 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
+    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen-tools_git.bb +1 -0
index 0188bdd..0b2dce9 100644
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
+    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen_4.14.bb +1 -1
index 653e3b6..0dd9d3c 100644
@@ -1,4 +1,4 @@
-SRCREV ?= "ad844aa352559a8b1f36e391a27d9d7dbddbdc36"
+SRCREV ?= "b6a8c4f72def4d1135ff42660a86276ce2565c8c"
 
 XEN_REL ?= "4.14"
 XEN_BRANCH ?= "stable-${XEN_REL}"
recipes-extended/xen/xen_4.15.bb +1 -0
index 2842c0a..d0aa176 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
recipes-extended/xen/xen_git.bb +1 -0
index eaf3956..7ce7228 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/4 xen, xen-tools: fix build and passing of CFLAGS via Xen vars

In reply to Christopher Clark

Ensure that the Xen build system variables EXTRA_CFLAGS_XEN_CORE and EXTRA_CFLAGS_XEN_TOOLS are passed into the compile steps.

Update the hypervisor compilation to avoid passing in most compile flags from the build environment via EXTRA_CFLAGS_XEN_CORE -- prefer the compiler defaults and the flags set by the Xen build system, so only the debug prefix flags are provided.

Observeration derived from the prior commit e99974aa, so:

---
 recipes-extended/xen/xen-hypervisor.inc |  3 ++-
 recipes-extended/xen/xen-tools.inc      |  3 ++-
 recipes-extended/xen/xen.inc            | 12 ++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)
recipes-extended/xen/xen-hypervisor.inc +2 -1
index 916bd3c..9b96d91 100644
@@ -49,7 +49,8 @@ do_configure() {
 }
 
 do_compile() {
-    oe_runmake xen PYTHON="${PYTHON}"
+    oe_runmake xen PYTHON="${PYTHON}" \
+                   EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}"
 }
 
 do_install() {
recipes-extended/xen/xen-tools.inc +2 -1
index 3560e79..2930097 100644
@@ -727,7 +727,8 @@ do_configure() {
 
 do_compile() {
     cd ${S}
-    oe_runmake tools PYTHON="${PYTHON}"
+    oe_runmake tools PYTHON="${PYTHON}" \
+                     EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}"
 }
 
 do_install() {
recipes-extended/xen/xen.inc +10 -2
index 2fbdb3a..5aa2d5a 100644
@@ -92,6 +92,16 @@ export LDFLAGS=""
 
 # Pass through the Yocto distro compiler flags via the Xen-provided variables.
 # Special handling:
+# - The Yocto distro compiler flags are typically set to be appropriate for
+#   user-space software rather than for generation of a hypervisor binary, so
+#   only pass the debug prefix map to the hypervisor build:
+EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
+
+# - The Xen tools build for x86 systems with HVM-mode enabled includes hvmloader
+#   which fails to build when "-m64" is included in flags set via the
+#   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.
+TUNE_CCARGS_x86-64=""
+
 # - Yocto supplies the _FORTIFY_SOURCE flag via CC/CPP/CXX but then passes the
 #   optimization -O via C*FLAGS which is problematic when the CFLAGS are cleared
 #   within the build because compilation fails with the compiler stating
@@ -102,12 +112,10 @@ export LDFLAGS=""
 #   explicitly clears CFLAGS to ensure that, so such options must not be passed
 #   in via the tool variable. hvmloader is required to run HVM-mode guest VMs.
 CC="${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_CORE="${HOST_CC_ARCH} ${CFLAGS}"
 EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}"
 # 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed
 # in CC to ensure that configure can compile binaries for the right arch.
 CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_CORE_arm="${SECURITY_CFLAGS} ${CFLAGS}"
 EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}"
 
 # There are no Xen-provided variables for C++, so append to the tool variables:
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/4 xtf: fix build with gcc11 SRCREV and specifying linker

In reply to Christopher Clark

Newer XTF revision works around GCC 11.1 issue 99578 and supplying the correct linker to use fixes the build.

---
 recipes-extended/xen/xtf_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
recipes-extended/xen/xtf_git.bb +2 -1
index 3580324..bf7470e 100644
@@ -6,7 +6,7 @@ LICENSE = "BSD-2-Clause"
 # https://static.sched.com/hosted_files/xendeveloperanddesignsummit2017/79/xtf.pdf
 
 SRC_URI = "git://xenbits.xen.org/xtf"
-SRCREV = "b0bc49846c154b79243f39d461a4515804bcaf53"
+SRCREV = "3e800027016ea4eb19887bf626b46f45fc43fa5d"
 
 COMPATIBLE_HOST = '(x86_64.*).*-linux'
 
@@ -32,6 +32,7 @@ RDEPENDS_${PN} = " \
 do_compile() {
     oe_runmake CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
                CPP="${CPP}" \
+               LD="${LD}" \
                OBJCOPY="${OBJCOPY}" \
                PYTHON="${PYTHON}"
     # switch the shebang to python3
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 4/4 xen-tools: remove Arm 32-bit compiler flags override

In reply to Christopher Clark

The SECURITY_FLAGS are already passed into the tools build in HOST_CC_ARCH so this separate case override is not needed.

---
 recipes-extended/xen/xen.inc | 1 -
 1 file changed, 1 deletion(-)
recipes-extended/xen/xen.inc +0 -1
index 5aa2d5a..3438034 100644
@@ -116,7 +116,6 @@ EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}"
 # 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed
 # in CC to ensure that configure can compile binaries for the right arch.
 CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}"
 
 # There are no Xen-provided variables for C++, so append to the tool variables:
 CPP_append = " ${CPPFLAGS}"
Signature · 1 line
2.25.1
#5 lore raw
In reply to Christopher Clark

I haven't heard any objections, so this is now merged to master.

Bruce

Quoted 35 lines · Christopher Clark

Pull in updates from upstream Xen and XTF for GCC 11 and fix passing compiler flags for the Xen hypervisor, tools and test framework.

Changes since v1:
- for Xen 4.14, drop the previous cherry-picked compiler fix patch via an update of SRCREV to the current tip of stable-4.14
- add a patch to drop an unnecessary compiler flag override for the Arm 32-bit Xen tools build

Christopher Clark (4):
xen, xen-tools: apply upstream fixes for gcc11 compilation xen, xen-tools: fix build and passing of CFLAGS via Xen vars
xtf: fix build with gcc11 SRCREV and specifying linker
xen-tools: remove Arm 32-bit compiler flags override

 ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
 ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
 recipes-extended/xen/xen-hypervisor.inc       |   3 +-
 recipes-extended/xen/xen-tools.inc            |   6 +-
 recipes-extended/xen/xen-tools_4.14.bb        |   3 +-
 recipes-extended/xen/xen-tools_4.15.bb        |   1 +
 recipes-extended/xen/xen-tools_git.bb         |   1 +
 recipes-extended/xen/xen.inc                  |  13 +-
 recipes-extended/xen/xen_4.14.bb              |   2 +-
 recipes-extended/xen/xen_4.15.bb              |   1 +
 recipes-extended/xen/xen_git.bb               |   1 +
 recipes-extended/xen/xtf_git.bb               |   3 +-
 12 files changed, 167 insertions(+), 11 deletions(-)
 create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
 create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch

--
2.25.1

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II