qemu-kvm/kvm-x86-cpuhp-refuse-cpu-hot-unplug-request-earlier-if-n.patch
Danilo C. L. de Paula 88e6244f97 * Thu Oct 08 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 5.1.0-13.el8_3
- kvm-x86-lpc9-let-firmware-negotiate-CPU-hotplug-with-SMI.patch [bz#1846886]
- kvm-x86-cpuhp-prevent-guest-crash-on-CPU-hotplug-when-br.patch [bz#1846886]
- kvm-x86-cpuhp-refuse-cpu-hot-unplug-request-earlier-if-n.patch [bz#1846886]
- Resolves: bz#1846886
  (Guest hit soft lockup or reboots if hotplug vcpu under ovmf)
2020-10-08 16:47:39 -04:00

69 lines
2.8 KiB
Diff

From 77c5df3ab28f294f7b21d33a2f6116b0889292ed Mon Sep 17 00:00:00 2001
From: Igor Mammedov <imammedo@redhat.com>
Date: Mon, 5 Oct 2020 15:27:03 -0400
Subject: [PATCH 3/3] x86: cpuhp: refuse cpu hot-unplug request earlier if not
supported
RH-Author: Igor Mammedov <imammedo@redhat.com>
Message-id: <20201005152703.1555401-4-imammedo@redhat.com>
Patchwork-id: 98551
O-Subject: [RHEL-AV-8.3.0 qemu-kvm PATCH 3/3] x86: cpuhp: refuse cpu hot-unplug request earlier if not supported
Bugzilla: 1846886
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1846886
BRANCH: rhel-av-8.3.0
UPSTREAM: Merged
BREW: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=31759628
Upstream commit: b48ad7c02ba7
CPU hot-unplug with SMM requires firmware participation to prevent
guest crash (i.e. CPU can be removed only after OS _and_ firmware
were prepared for the action).
Previous patches introduced ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT
feature bit, which is advertised by firmware when it has support
for CPU hot-unplug. Use it to check if guest is able to handle
unplug and make device_del fail gracefully if hot-unplug feature
hasn't been negotiated.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200923094650.1301166-4-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/acpi/ich9.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 37286a03288..f6c6c6a916a 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -475,6 +475,18 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
!lpc->pm.cpu_hotplug_legacy) {
+ uint64_t negotiated = lpc->smi_negotiated_features;
+
+ if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) &&
+ !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) {
+ error_setg(errp, "cpu hot-unplug with SMI wasn't enabled "
+ "by firmware");
+ error_append_hint(errp, "update machine type to a version having "
+ "x-smi-cpu-hotunplug=on and firmware that "
+ "supports CPU hot-unplug with SMM");
+ return;
+ }
+
acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp_state,
dev, errp);
} else {
--
2.27.0