From 262bbf08f28b9d193657e0b6225ec69584849a7a Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 30 May 2017 18:57:48 -0400 Subject: [PATCH] Fix aarch64 gic default for non-kvm VMs (bz #1449837) Don't run libvirtd in live environment, to avoid network collision (bz #1146232) --- ...ult-GIC-version-for-aarch64-virt-TCG.patch | 122 ++++++++++++++++++ ...se-GICv2-for-aarch64-virt-TCG-guests.patch | 85 ++++++++++++ 0003-gic-Remove-VIR_GIC_VERSION_DEFAULT.patch | 67 ++++++++++ ...-run-if-in-a-Fedora-live-environment.patch | 33 +++++ libvirt.spec | 15 ++- 5 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 0001-tests-Check-default-GIC-version-for-aarch64-virt-TCG.patch create mode 100644 0002-qemu-Use-GICv2-for-aarch64-virt-TCG-guests.patch create mode 100644 0003-gic-Remove-VIR_GIC_VERSION_DEFAULT.patch create mode 100644 0004-daemon-Don-t-run-if-in-a-Fedora-live-environment.patch diff --git a/0001-tests-Check-default-GIC-version-for-aarch64-virt-TCG.patch b/0001-tests-Check-default-GIC-version-for-aarch64-virt-TCG.patch new file mode 100644 index 0000000..3a94b1b --- /dev/null +++ b/0001-tests-Check-default-GIC-version-for-aarch64-virt-TCG.patch @@ -0,0 +1,122 @@ +From: Andrea Bolognani +Date: Fri, 12 May 2017 14:05:55 +0200 +Subject: [PATCH] tests: Check default GIC version for aarch64/virt TCG guests + +Signed-off-by: Andrea Bolognani +(cherry picked from commit b24eaf6210ebaf5dc8d29621063873c8419c517e) +--- + .../qemuxml2argv-aarch64-gic-none-tcg.args | 19 ++++++++++++++++ + .../qemuxml2argv-aarch64-gic-none-tcg.xml | 17 +++++++++++++++ + tests/qemuxml2argvtest.c | 3 +++ + .../qemuxml2xmlout-aarch64-gic-none-tcg.xml | 25 ++++++++++++++++++++++ + tests/qemuxml2xmltest.c | 1 + + 5 files changed, 65 insertions(+) + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml + +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args +new file mode 100644 +index 0000000..975a014 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args +@@ -0,0 +1,19 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-aarch64 \ ++-name guest \ ++-S \ ++-machine virt,accel=tcg,gic-version=3 \ ++-cpu cortex-a57 \ ++-m 1024 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \ ++-nographic \ ++-nodefaults \ ++-monitor unix:/tmp/lib/domain--1-guest/monitor.sock,server,nowait \ ++-no-acpi \ ++-boot c +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.xml +new file mode 100644 +index 0000000..0aa33db +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.xml +@@ -0,0 +1,17 @@ ++ ++ guest ++ 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f ++ 1048576 ++ 1 ++ ++ hvm ++ ++ ++ ++ cortex-a57 ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ +diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c +index 41461ea..a630c3b 100644 +--- a/tests/qemuxml2argvtest.c ++++ b/tests/qemuxml2argvtest.c +@@ -2247,6 +2247,9 @@ mymain(void) + DO_TEST_GIC("aarch64-gic-none-both", GIC_BOTH, + QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACH_VIRT_GIC_VERSION); ++ DO_TEST_GIC("aarch64-gic-none-tcg", GIC_BOTH, ++ QEMU_CAPS_MACHINE_OPT, ++ QEMU_CAPS_MACH_VIRT_GIC_VERSION); + DO_TEST_GIC("aarch64-gic-default", GIC_NONE, + QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT); + DO_TEST_GIC("aarch64-gic-default", GIC_NONE, +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml +new file mode 100644 +index 0000000..69510e2 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml +@@ -0,0 +1,25 @@ ++ ++ guest ++ 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f ++ 1048576 ++ 1048576 ++ 1 ++ ++ hvm ++ ++ ++ ++ ++ ++ ++ cortex-a57 ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ +diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c +index eae999d..aae632a 100644 +--- a/tests/qemuxml2xmltest.c ++++ b/tests/qemuxml2xmltest.c +@@ -1073,6 +1073,7 @@ mymain(void) + DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, NONE); + DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, GIC_V3, NONE); + DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, GIC_BOTH, NONE); ++ DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, GIC_BOTH, NONE); + DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_NONE, NONE); + DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V2, NONE); + DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V3, NONE); diff --git a/0002-qemu-Use-GICv2-for-aarch64-virt-TCG-guests.patch b/0002-qemu-Use-GICv2-for-aarch64-virt-TCG-guests.patch new file mode 100644 index 0000000..5206dc4 --- /dev/null +++ b/0002-qemu-Use-GICv2-for-aarch64-virt-TCG-guests.patch @@ -0,0 +1,85 @@ +From: Andrea Bolognani +Date: Fri, 12 May 2017 13:29:57 +0200 +Subject: [PATCH] qemu: Use GICv2 for aarch64/virt TCG guests + +There are currently some limitations in the emulated GICv3 +that make it unsuitable as a default. Use GICv2 instead. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1450433 + +Signed-off-by: Andrea Bolognani +(cherry picked from commit bc07101a7c2cd2ce07ad1ca28c47e0a7cde5625d) +--- + src/qemu/qemu_domain.c | 23 +++++++++++++++++++++- + .../qemuxml2argv-aarch64-gic-none-tcg.args | 2 +- + .../qemuxml2xmlout-aarch64-gic-none-tcg.xml | 2 +- + 3 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 589eb18..891f825 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -2527,6 +2527,24 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def, + for (version = VIR_GIC_VERSION_LAST - 1; + version > VIR_GIC_VERSION_NONE; + version--) { ++ ++ /* We want to use the highest available GIC version for guests; ++ * however, the emulated GICv3 is currently lacking a MSI controller, ++ * making it unsuitable for the pure PCIe topology we aim for. ++ * ++ * For that reason, we skip this step entirely for TCG guests, ++ * and rely on the code below to pick the default version, GICv2, ++ * which supports all the features we need. ++ * ++ * We'll want to revisit this once MSI support for GICv3 has been ++ * implemented in QEMU. ++ * ++ * See https://bugzilla.redhat.com/show_bug.cgi?id=1414081 */ ++ if (version == VIR_GIC_VERSION_3 && ++ def->virtType == VIR_DOMAIN_VIRT_QEMU) { ++ continue; ++ } ++ + if (virQEMUCapsSupportsGICVersion(qemuCaps, + def->virtType, + version)) { +@@ -2544,8 +2562,11 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def, + + /* Use the default GIC version if no version was specified */ + if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON && +- def->gic_version == VIR_GIC_VERSION_NONE) ++ def->gic_version == VIR_GIC_VERSION_NONE) { ++ VIR_DEBUG("Using GIC version %s (default)", ++ virGICVersionTypeToString(VIR_GIC_VERSION_DEFAULT)); + def->gic_version = VIR_GIC_VERSION_DEFAULT; ++ } + } + + +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args +index 975a014..52b6996 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-tcg.args +@@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \ + /usr/bin/qemu-system-aarch64 \ + -name guest \ + -S \ +--machine virt,accel=tcg,gic-version=3 \ ++-machine virt,accel=tcg \ + -cpu cortex-a57 \ + -m 1024 \ + -smp 1,sockets=1,cores=1,threads=1 \ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml +index 69510e2..a0cd0b7 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-tcg.xml +@@ -9,7 +9,7 @@ + + + +- ++ + + + cortex-a57 diff --git a/0003-gic-Remove-VIR_GIC_VERSION_DEFAULT.patch b/0003-gic-Remove-VIR_GIC_VERSION_DEFAULT.patch new file mode 100644 index 0000000..ed115c0 --- /dev/null +++ b/0003-gic-Remove-VIR_GIC_VERSION_DEFAULT.patch @@ -0,0 +1,67 @@ +From: Andrea Bolognani +Date: Fri, 12 May 2017 14:38:08 +0200 +Subject: [PATCH] gic: Remove VIR_GIC_VERSION_DEFAULT + +The QEMU default is GICv2, and some of the code in libvirt +relies on the exact value. Stop pretending that's not the +case and use GICv2 explicitly where needed. + +Signed-off-by: Andrea Bolognani +(cherry picked from commit 5645badd1fe04fee7237c2f95e7710e978e40770) +--- + src/qemu/qemu_command.c | 6 +++--- + src/qemu/qemu_domain.c | 7 +++---- + src/util/virgic.h | 3 --- + 3 files changed, 6 insertions(+), 10 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 64d2d71..188e273 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -7317,9 +7317,9 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, + goto cleanup; + } + +- /* The default GIC version should not be specified on the +- * QEMU commandline for backwards compatibility reasons */ +- if (def->gic_version != VIR_GIC_VERSION_DEFAULT) { ++ /* The default GIC version (GICv2) should not be specified on ++ * the QEMU commandline for backwards compatibility reasons */ ++ if (def->gic_version != VIR_GIC_VERSION_2) { + if (!virQEMUCapsGet(qemuCaps, + QEMU_CAPS_MACH_VIRT_GIC_VERSION)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 891f825..4a127ce 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -2560,12 +2560,11 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def, + def->features[VIR_DOMAIN_FEATURE_GIC] = VIR_TRISTATE_SWITCH_ON; + } + +- /* Use the default GIC version if no version was specified */ ++ /* Use the default GIC version (GICv2) if no version was specified */ + if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON && + def->gic_version == VIR_GIC_VERSION_NONE) { +- VIR_DEBUG("Using GIC version %s (default)", +- virGICVersionTypeToString(VIR_GIC_VERSION_DEFAULT)); +- def->gic_version = VIR_GIC_VERSION_DEFAULT; ++ VIR_DEBUG("Using GIC version 2 (default)"); ++ def->gic_version = VIR_GIC_VERSION_2; + } + } + +diff --git a/src/util/virgic.h b/src/util/virgic.h +index 1c9efd6..2d77fdd 100644 +--- a/src/util/virgic.h ++++ b/src/util/virgic.h +@@ -35,9 +35,6 @@ typedef enum { + + VIR_ENUM_DECL(virGICVersion); + +-/* Consider GIC v2 the default */ +-# define VIR_GIC_VERSION_DEFAULT VIR_GIC_VERSION_2 +- + typedef enum { + VIR_GIC_IMPLEMENTATION_NONE = 0, + VIR_GIC_IMPLEMENTATION_KERNEL = (1 << 1), diff --git a/0004-daemon-Don-t-run-if-in-a-Fedora-live-environment.patch b/0004-daemon-Don-t-run-if-in-a-Fedora-live-environment.patch new file mode 100644 index 0000000..ee2e14d --- /dev/null +++ b/0004-daemon-Don-t-run-if-in-a-Fedora-live-environment.patch @@ -0,0 +1,33 @@ +From: Cole Robinson +Date: Tue, 30 May 2017 18:35:04 -0400 +Subject: [PATCH] daemon: Don't run if in a Fedora live environment + +Have systemd make libvirtd startup dependent on the kernel commandline +lacking the 'rd.live.image' option, which is used by Fedora live media + +Roundabout way to prevent the 'default' network killing connectivity +of the livecd running in a VM + +https://bugzilla.redhat.com/show_bug.cgi?id=1146232 + +Not upstream, will likely need some kind of different permanent solution +--- + daemon/libvirtd.service.in | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in +index 899abdf..cff2cd2 100644 +--- a/daemon/libvirtd.service.in ++++ b/daemon/libvirtd.service.in +@@ -16,6 +16,11 @@ After=local-fs.target + After=remote-fs.target + Documentation=man:libvirtd(8) + Documentation=http://libvirt.org ++# Prevent libvirtd from starting if running in a Fedora live environment ++# Roundabout way to prevent the 'default' network killing connectivity ++# of the livecd running in a VM ++# https://bugzilla.redhat.com/show_bug.cgi?id=1146232 ++ConditionKernelCommandLine=!rd.live.image + + [Service] + Type=notify diff --git a/libvirt.spec b/libvirt.spec index 253afde..28ccc82 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -227,7 +227,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 3.2.1 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -238,6 +238,14 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz +# Fix aarch64 gic default for non-kvm VMs (bz #1449837) +Patch0001: 0001-tests-Check-default-GIC-version-for-aarch64-virt-TCG.patch +Patch0002: 0002-qemu-Use-GICv2-for-aarch64-virt-TCG-guests.patch +Patch0003: 0003-gic-Remove-VIR_GIC_VERSION_DEFAULT.patch +# Don't run libvirtd in live environment, to avoid network collision (bz +# #1146232) +Patch0004: 0004-daemon-Don-t-run-if-in-a-Fedora-live-environment.patch + Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -2072,6 +2080,11 @@ exit 0 %changelog +* Tue May 30 2017 Cole Robinson - 3.2.1-2 +- Fix aarch64 gic default for non-kvm VMs (bz #1449837) +- Don't run libvirtd in live environment, to avoid network collision (bz + #1146232) + * Wed May 10 2017 Cole Robinson - 3.2.1-1 - Rebased to version 3.2.1