Skip to contentSkip to conversation

xen-tools: Load xen related kernel modules during system boot

PATCH Superseded Kamil Dziezyk 3 participants 9 messages Dec 9, 2021 – Dec 21, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 xen-tools: Load xen related kernel modules during system boot

This patch changes the location of xen.conf file, that contains list of kernel modules to be loaded during system boot, to "${nonarch_libdir}".

Previous path based on "${systemd_unitdir}" was not considered by default by systemd-modules-load.service.

---
 recipes-extended/xen/xen-tools.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-extended/xen/xen-tools.inc +2 -2
index d831941..17ef0f7 100644
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
     "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
     ${sysconfdir}/default/xencommons \
     ${sysconfdir}/init.d/xencommons \
     ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
     ${systemd_unitdir}/system/proc-xen.mount \
     ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
     ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,7 @@ SYSTEMD_SERVICE:${PN}-xendomains = "xendomains.service"
 
 EXTRA_OECONF += " \
     --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
+    --with-systemd-modules-load=${nonarch_libdir}/modules-load.d \
     --with-initddir=${INIT_D_DIR} \
     --with-sysconfig-leaf-dir=default \
     --with-system-qemu=${bindir}/qemu-system-i386 \
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/3 xen: Clear TUNE_CCARGS for Xen build for aarch64 machines

Xen build may fail for arm machines that have enabled extra flags, that can be enabled only for specific architecture version, e.g. armv8-2a.

---
 recipes-extended/xen/xen.inc | 5 +++++
 1 file changed, 5 insertions(+)
recipes-extended/xen/xen.inc +5 -0
index d3c7a7d..9ac82ef 100644
@@ -102,6 +102,11 @@ EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
 #   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.
 TUNE_CCARGS:x86-64=""
 
+# - The Xen build for aarch64 systems with HVM-mode enabled may include
+#   architecture specific flags '-march=*' which causes build failure, so clear
+#   TUNE_CCARGS on aarch64 to prevent that.
+TUNE_CCARGS:aarch64=""
+
 # - 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
Signature · 1 line
2.17.1
#2 lore raw

Re: [meta-virtualization][PATCH v2 2/3] xen: Clear TUNE_CCARGS for Xen build for aarch64 machines

Quoted 3 lines · Kamil Dziezyk

Xen build may fail for arm machines that have enabled extra flags, that can be enabled only for specific architecture version, e.g. armv8-2a.

Apologies for being slow to review this one.

From looking at "bitbake -e xen" for an example Raspberry Pi 4 aarch64 build configuration, the major variables that this affects looks like: CPP, CXX and EXTRA_CFLAGS_XEN_TOOLS.
So is it the xen recipe or the xen-tools recipe that this patch is intended to fix the build for? (or both?)

I can't immediately tell what compilation this fixes, but: I think that this change is probably OK for the hypervisor case, since TUNE_CCARGS is already excluded from the definition of CC for aarch64 for the hypervisor build, but for the tools it will affect the compiler flags, so:

Do you really intend to drop all "-mcpu" and "-march" C compiler flags from the Xen tools build, for any aarch64 MACHINEs? Should your MACHINEs actually populate TUNE_CCARGS with those flags if they are not wanted for userspace software? -- or is there a problem that is specifically being encountered with the Xen tools software build? If so, I'd like to know a bit more about that -- and then this workaround may be OK if we can confirm that it doesn't negatively affect the MACHINEs that we care about, which include QemuArm64 and the Rpi4 as a reference platform.

As an aside, I would like to remove the similar x86 logic from this recipe where TUNE_CCARGS is cleared to address the hvmloader build, and fix that in a better way. (That will be separate to this work.)

The comment that is being added refers to "HVM-mode": is that term still accurate for Xen on Arm?

The subject line for this patch should indicate both "xen" and "xen-tools", since this modifies xen.inc which is included by both recipes. I would encourage you to CC both myself and Doug on future posts of Xen-related patches, please.

thanks

Christopher

Quoted 40 lines
---
 recipes-extended/xen/xen.inc | 5 +++++
 1 file changed, 5 insertions(+)
recipes-extended/xen/xen.inc +2 -0
index d3c7a7d..9ac82ef 100644
@@ -102,6 +102,11 @@ EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
 #   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.
 TUNE_CCARGS:x86-64=""
 
+# - The Xen build for aarch64 systems with HVM-mode enabled may include
+#   architecture specific flags '-march=*' which causes build failure, so

clear

recipes-extended/xen/xen.inc +3 -0
+#   TUNE_CCARGS on aarch64 to prevent that.
+TUNE_CCARGS:aarch64=""
+
 # - 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
--
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#6973):
https://lists.yoctoproject.org/g/meta-virtualization/message/6973
Mute This Topic: https://lists.yoctoproject.org/mt/87611981/3619036
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Re: [PATCH v2 2/3] xen: Clear TUNE_CCARGS for Xen build for aarch64 machines

Hi Cristopher,

Thanks for your comments.

My intention was to clear TUNE_CCARGS only for hypervisor compilation, so I will move this change to "xen-hypervisor.inc", to not impact "xen-tools".

An example of a machine this patch will fix the compilation is N1SDP from the meta-arm layer.

Quoted 8 lines

| cc1: error: switch '-mcpu=generic' conflicts with '-march=armv8.2-a+crypto' switch [-Werror] | cc1: all warnings being treated as errors

In the next version of this patch, I will reword that comment regarding "HVM-mode", because it's not accurate for Xen on Arm.

Thanks,

Kamil

#4 lore raw

PATCH v2 3/3 grub-efi: Add xen_boot support when 'xen' is in DISTRO_FEATURES for aarch64

In reply to Kamil Dziezyk
---
 recipes-bsp/grub/grub-efi_%.bbappend | 1 +
 recipes-bsp/grub/grub-efi_xen.inc    | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 recipes-bsp/grub/grub-efi_%.bbappend
 create mode 100644 recipes-bsp/grub/grub-efi_xen.inc
recipes-bsp/grub/grub-efi_%.bbappend new file +1 -0
new file mode 100644
index 0000000..df2b688
@@ -0,0 +1 @@
+require ${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${BPN}_xen.inc', '', d)}
recipes-bsp/grub/grub-efi_xen.inc new file +1 -0
new file mode 100644
index 0000000..5aa0958
@@ -0,0 +1 @@
+GRUB_BUILDIN:append:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' xen_boot', '', d)}"
Signature · 1 line
2.17.1
#5 lore raw

Re: [meta-virtualization][PATCH v2 3/3] grub-efi: Add xen_boot support when 'xen' is in DISTRO_FEATURES for aarch64

Quoted 2 lines · Kamil Dziezyk

I think this might be better changed in the grub-efi recipe in OE core instead, where the GRUB recipe maintainer can review it?

Should this xen_boot build-in feature be enabled for more architectures than just aarch64?

Christopher

Quoted 40 lines
---
 recipes-bsp/grub/grub-efi_%.bbappend | 1 +
 recipes-bsp/grub/grub-efi_xen.inc    | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 recipes-bsp/grub/grub-efi_%.bbappend
 create mode 100644 recipes-bsp/grub/grub-efi_xen.inc
recipes-bsp/grub/grub-efi_%.bbappend new file +1 -0
new file mode 100644
index 0000000..df2b688
@@ -0,0 +1 @@
+require ${@bb.utils.contains('DISTRO_FEATURES', 'xen', '${BPN}_xen.inc',

'', d)}

recipes-bsp/grub/grub-efi_xen.inc new file +1 -0
new file mode 100644
index 0000000..5aa0958
@@ -0,0 +1 @@
+GRUB_BUILDIN:append:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES',

'xen', ' xen_boot', '', d)}"
--
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#6974):
https://lists.yoctoproject.org/g/meta-virtualization/message/6974
Mute This Topic: https://lists.yoctoproject.org/mt/87611988/3619037
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw

Re: [PATCH v2 3/3] grub-efi: Add xen_boot support when 'xen' is in DISTRO_FEATURES for aarch64

Hi Cristopher,

'xen_boot' build-in feature is valid only for aarch64 architecture.

Sure, I will send this change to the OE core mailing list.

Thanks,

Kamil

#7 lore raw
In reply to Kamil Dziezyk

v2 looks good to me, but I'd like to get an Ack from Christopher before merging.

Bruce

Quoted 49 lines · Kamil Dziezyk

This patch changes the location of xen.conf file, that contains list of kernel modules to be loaded during system boot, to "${nonarch_libdir}".

Previous path based on "${systemd_unitdir}" was not considered by default by systemd-modules-load.service.

---
 recipes-extended/xen/xen-tools.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-extended/xen/xen-tools.inc +2 -3
index d831941..17ef0f7 100644
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
     "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
     ${sysconfdir}/default/xencommons \
     ${sysconfdir}/init.d/xencommons \
     ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
     ${systemd_unitdir}/system/proc-xen.mount \
     ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
     ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,7 @@ SYSTEMD_SERVICE:${PN}-xendomains = "xendomains.service"
 
 EXTRA_OECONF += " \
     --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
+    --with-systemd-modules-load=${nonarch_libdir}/modules-load.d \
     --with-initddir=${INIT_D_DIR} \
     --with-sysconfig-leaf-dir=default \
     --with-system-qemu=${bindir}/qemu-system-i386 \
--

2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6972): https://lists.yoctoproject.org/g/meta-virtualization/message/6972
Mute This Topic: https://lists.yoctoproject.org/mt/87611978/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

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
#8 lore raw
Quoted 3 lines · Bruce Ashfield

v2 looks good to me, but I'd like to get an Ack from Christopher before merging.

Ack, this looks good - thanks for making the change, Kamil.

Christopher

Quoted 67 lines

Bruce

Quoted 2 lines · Kamil Dziezyk

This patch changes the location of xen.conf file, that contains list of

kernel

Quoted 3 lines

modules to be loaded during system boot, to "${nonarch_libdir}".

Previous path based on "${systemd_unitdir}" was not considered by

default by

Review

Quoted 8 lines

systemd-modules-load.service.

---
 recipes-extended/xen/xen-tools.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/recipes-extended/xen/xen-tools.inc

recipes-extended/xen/xen-tools.inc SYSTEMD_SERVICE:${PN}-xendomains =

Quoted 16 lines

index d831941..17ef0f7 100644

recipes-extended/xen/xen-tools.inc +1 -1
@@ -653,10 +653,10 @@ FILES:${PN}-xm = "\
     "
 
 FILES:${PN}-xencommons += "\
+    ${nonarch_libdir}/modules-load.d/xen.conf \
     ${sysconfdir}/default/xencommons \
     ${sysconfdir}/init.d/xencommons \
     ${sysconfdir}/xen/scripts/launch-xenstore \
-    ${systemd_unitdir}/modules-load.d/xen.conf \
     ${systemd_unitdir}/system/proc-xen.mount \
     ${systemd_unitdir}/system/xen-qemu-dom0-disk-backend.service \
     ${systemd_unitdir}/system/xenconsoled.service \
@@ -744,7 +744,7 @@ SYSTEMD_SERVICE:${PN}-xendomains =

"xendomains.service"

Quoted 12 lines
recipes-extended/xen/xen-tools.inc +1 -2
 EXTRA_OECONF += " \
     --with-systemd=${systemd_unitdir}/system \
-    --with-systemd-modules-load=${systemd_unitdir}/modules-load.d \
+    --with-systemd-modules-load=${nonarch_libdir}/modules-load.d \
     --with-initddir=${INIT_D_DIR} \
     --with-sysconfig-leaf-dir=default \
     --with-system-qemu=${bindir}/qemu-system-i386 \
--

2.17.1

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#6972):

https://lists.yoctoproject.org/g/meta-virtualization/message/6972

Quoted 3 lines

Mute This Topic: https://lists.yoctoproject.org/mt/87611978/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub

[[email protected]]

Quoted 2 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