From a9595f021e726b216626bb21274c11c62c4d638d Mon Sep 17 00:00:00 2001 From: "Danilo C. L. de Paula" Date: Wed, 23 Jan 2019 17:22:30 +0000 Subject: [PATCH] * Wed Jan 23 2019 Danilo Cesar Lemes de Paula - 3.1.0-6.el8 - kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch [bz#1653114] - kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch [bz#1668205] - Resolves: bz#1653114 (Incorrect NUMA nodes passed to qemu-kvm guest in ibm,max-associativity-domains property) - Resolves: bz#1668205 (Guest quit with error when hotunplug cpu) --- ...ignore-ESRCH-in-qemu_cpu_kick_thread.patch | 62 ++++++++ ...x-associativity-domains-property-num.patch | 149 ++++++++++++++++++ qemu-kvm.spec | 14 +- 3 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch create mode 100644 kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch diff --git a/kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch b/kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch new file mode 100644 index 0000000..fe79e80 --- /dev/null +++ b/kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch @@ -0,0 +1,62 @@ +From 5f57f764ebb7451c71ffa04130ad2f2e4cb531e8 Mon Sep 17 00:00:00 2001 +From: Laurent Vivier +Date: Wed, 23 Jan 2019 09:15:22 +0000 +Subject: [PATCH 2/2] cpus: ignore ESRCH in qemu_cpu_kick_thread() + +RH-Author: Laurent Vivier +Message-id: <20190123091522.17581-1-lvivier@redhat.com> +Patchwork-id: 84092 +O-Subject: [RHEL-8.0/AV qemu-kvm PATCH v2] cpus: ignore ESRCH in qemu_cpu_kick_thread() +Bugzilla: 1668205 +RH-Acked-by: Paolo Bonzini +RH-Acked-by: Thomas Huth +RH-Acked-by: Serhii Popovych +RH-Acked-by: Laszlo Ersek + +We can have a race condition between qemu_cpu_kick_thread() and +qemu_kvm_cpu_thread_fn() when we hotunplug a CPU. In this case, +qemu_cpu_kick_thread() can try to kick a thread that is exiting. +pthread_kill() returns an error and qemu is stopped by an exit(1). + + qemu:qemu_cpu_kick_thread: No such process + +We can ignore safely this error. + +Signed-off-by: Laurent Vivier +Signed-off-by: Paolo Bonzini +(cherry picked from commit e9979ef245549b8e1fd240ec9937271c7fda0b57) +Signed-off-by: Laurent Vivier + +BRANCH: rhel8/master-3.1.0 +BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1668205 +BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19905615 +UPSTREAM: In maintainer pull request + git://github.com/bonzini/qemu.git tags/for-upstream +TEST: Upstream version tested by QE +--- +v2: add BRANCH: tag to make happy virt-ci-maint-team + + cpus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Signed-off-by: Danilo C. L. de Paula +--- + cpus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cpus.c b/cpus.c +index 0ddeeef..4717490 100644 +--- a/cpus.c ++++ b/cpus.c +@@ -1778,7 +1778,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu) + } + cpu->thread_kicked = true; + err = pthread_kill(cpu->thread->thread, SIG_IPI); +- if (err) { ++ if (err && err != ESRCH) { + fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); + exit(1); + } +-- +1.8.3.1 + diff --git a/kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch b/kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch new file mode 100644 index 0000000..bf01cdf --- /dev/null +++ b/kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch @@ -0,0 +1,149 @@ +From f39913b42600b838c415f6fb561be940bea265dd Mon Sep 17 00:00:00 2001 +From: Serhii Popovych +Date: Wed, 9 Jan 2019 13:31:49 +0000 +Subject: [PATCH 1/2] spapr: Fix ibm, max-associativity-domains property number + of nodes + +RH-Author: Serhii Popovych +Message-id: <1547040709-797-1-git-send-email-spopovyc@redhat.com> +Patchwork-id: 83920 +O-Subject: [RHEL-8.0 qemu-kvm PATCH v2] spapr: Fix ibm, max-associativity-domains property number of nodes +Bugzilla: 1653114 +RH-Acked-by: Laurent Vivier +RH-Acked-by: David Gibson +RH-Acked-by: Thomas Huth + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1653114 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=19727263 +Branch: rhel8/master-3.1.0 +Upstream: Merged +Testing: Build and boot tested on rhel-7.6 with steps described in + comment 0. Issue no longer reproducible. + +Laurent Vivier reported off by one with maximum number of NUMA nodes +provided by qemu-kvm being less by one than required according to +description of "ibm,max-associativity-domains" property in LoPAPR. + +It appears that I incorrectly treated LoPAPR description of this +property assuming it provides last valid domain (NUMA node here) +instead of maximum number of domains. + + ### Before hot-add + + (qemu) info numa + 3 nodes + node 0 cpus: 0 + node 0 size: 0 MB + node 0 plugged: 0 MB + node 1 cpus: + node 1 size: 1024 MB + node 1 plugged: 0 MB + node 2 cpus: + node 2 size: 0 MB + node 2 plugged: 0 MB + + $ numactl -H + available: 2 nodes (0-1) + node 0 cpus: 0 + node 0 size: 0 MB + node 0 free: 0 MB + node 1 cpus: + node 1 size: 999 MB + node 1 free: 658 MB + node distances: + node 0 1 + 0: 10 40 + 1: 40 10 + + ### Hot-add + + (qemu) object_add memory-backend-ram,id=mem0,size=1G + (qemu) device_add pc-dimm,id=dimm1,memdev=mem0,node=2 + (qemu) [ 87.704898] pseries-hotplug-mem: Attempting to hot-add 4 ... + + [ 87.705128] lpar: Attempting to resize HPT to shift 21 + ... + + ### After hot-add + + (qemu) info numa + 3 nodes + node 0 cpus: 0 + node 0 size: 0 MB + node 0 plugged: 0 MB + node 1 cpus: + node 1 size: 1024 MB + node 1 plugged: 0 MB + node 2 cpus: + node 2 size: 1024 MB + node 2 plugged: 1024 MB + + $ numactl -H + available: 2 nodes (0-1) + ^^^^^^^^^^^^^^^^^^^^^^^^ + Still only two nodes (and memory hot-added to node 0 below) + node 0 cpus: 0 + node 0 size: 1024 MB + node 0 free: 1021 MB + node 1 cpus: + node 1 size: 999 MB + node 1 free: 658 MB + node distances: + node 0 1 + 0: 10 40 + 1: 40 10 + +After fix applied numactl(8) reports 3 nodes available and memory +plugged into node 2 as expected. + +>From David Gibson: +------------------ + Qemu makes a distinction between "non NUMA" (nb_numa_nodes == 0) and + "NUMA with one node" (nb_numa_nodes == 1). But from a PAPR guests's + point of view these are equivalent. I don't want to present two + different cases to the guest when we don't need to, so even though the + guest can handle it, I'd prefer we put a '1' here for both the + nb_numa_nodes == 0 and nb_numa_nodes == 1 case. + +This consolidates everything discussed previously on mailing list. + +Fixes: da9f80fbad21 ("spapr: Add ibm,max-associativity-domains property") +Reported-by: Laurent Vivier +Signed-off-by: Serhii Popovych + +Signed-off-by: David Gibson +Reviewed-by: Greg Kurz +Reviewed-by: Laurent Vivier +(cherry picked from commit 3908a24fcb83913079d315de0ca6d598e8616dbb) +Signed-off-by: Serhii Popovych +--- +v2: + Rebased against rhel8/qemu-kvm-3.1.0 for RHEL Advanced Virtualization + product. + + Added "Brach:" tag to commint message as suggested by Laurent Vivier. + + hw/ppc/spapr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Signed-off-by: Danilo C. L. de Paula +--- + hw/ppc/spapr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c +index d5d2eb4..bd2abb7 100644 +--- a/hw/ppc/spapr.c ++++ b/hw/ppc/spapr.c +@@ -1033,7 +1033,7 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt) + cpu_to_be32(0), + cpu_to_be32(0), + cpu_to_be32(0), +- cpu_to_be32(nb_numa_nodes ? nb_numa_nodes - 1 : 0), ++ cpu_to_be32(nb_numa_nodes ? nb_numa_nodes : 1), + }; + + _FDT(rtas = fdt_add_subnode(fdt, 0, "rtas")); +-- +1.8.3.1 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index f285fc6..5b8b7f0 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -68,7 +68,7 @@ Obsoletes: %1-rhev Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 3.1.0 -Release: 5%{?dist} +Release: 6%{?dist} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 15 License: GPLv2 and GPLv2+ and CC-BY @@ -154,6 +154,10 @@ Patch34: kvm-aarch64-Add-virt-rhel8.0.0-machine-type-for-ARM.patch Patch35: kvm-aarch64-Set-virt-rhel8.0.0-max_cpus-to-512.patch # For bz#1656504 - Machine types for qemu-kvm based on rebase to qemu-3.1 (aarch64) Patch36: kvm-aarch64-Use-256MB-ECAM-region-by-default.patch +# For bz#1653114 - Incorrect NUMA nodes passed to qemu-kvm guest in ibm,max-associativity-domains property +Patch37: kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch +# For bz#1668205 - Guest quit with error when hotunplug cpu +Patch38: kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch BuildRequires: zlib-devel BuildRequires: glib2-devel @@ -1001,6 +1005,14 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Wed Jan 23 2019 Danilo Cesar Lemes de Paula - 3.1.0-6.el8 +- kvm-spapr-Fix-ibm-max-associativity-domains-property-num.patch [bz#1653114] +- kvm-cpus-ignore-ESRCH-in-qemu_cpu_kick_thread.patch [bz#1668205] +- Resolves: bz#1653114 + (Incorrect NUMA nodes passed to qemu-kvm guest in ibm,max-associativity-domains property) +- Resolves: bz#1668205 + (Guest quit with error when hotunplug cpu) + * Mon Jan 21 2019 Danilo Cesar Lemes de Paula - 3.1.0-5.el8 - kvm-virtio-Helper-for-registering-virtio-device-types.patch [bz#1648023] - kvm-virtio-Provide-version-specific-variants-of-virtio-P.patch [bz#1648023]