|
Pablo Greco |
40546a |
From 77404a4f0ff85fbc0a2c24afc736ffbd8b82ef4d Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <77404a4f0ff85fbc0a2c24afc736ffbd8b82ef4d@dist-git>
|
|
Pablo Greco |
40546a |
From: Laine Stump <laine@laine.org>
|
|
Pablo Greco |
40546a |
Date: Mon, 8 Apr 2019 10:57:31 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] qemu_hotplug: remove erroneous call to
|
|
Pablo Greco |
40546a |
qemuDomainDetachExtensionDevice()
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
qemuDomainDetachControllerDevice() calls
|
|
Pablo Greco |
40546a |
qemuDomainDetachExtensionDevice() when the controller type is
|
|
Pablo Greco |
40546a |
PCI. This is incorrect in multiple ways:
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
* Any code that tears down a device should be in the
|
|
Pablo Greco |
40546a |
qemuDomainRemove*Device() function (which is called after libvirt
|
|
Pablo Greco |
40546a |
gets a DEVICE_DELETED event from qemu indicating that the guest is
|
|
Pablo Greco |
40546a |
finished with the device on its end. The qemuDomainDetach*Device()
|
|
Pablo Greco |
40546a |
functions should only contain code that ensures the requested
|
|
Pablo Greco |
40546a |
operation is valid, and sends the command to qemu to initiate the
|
|
Pablo Greco |
40546a |
unplug.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
* qemuDomainDetachExtensionDevice() is a function that applies to
|
|
Pablo Greco |
40546a |
devices that plug into a PCI slot, *not* necessarily PCI controllers
|
|
Pablo Greco |
40546a |
(which is what's being checked in the offending code). The proper
|
|
Pablo Greco |
40546a |
way to check for this would be to see if the DeviceInfo for the
|
|
Pablo Greco |
40546a |
controller device had a PCI address, not to check if the controller
|
|
Pablo Greco |
40546a |
is a PCI controller (the code being removed was doing the latter).
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
* According to commit 1d1e264f1 that added this code (and other
|
|
Pablo Greco |
40546a |
support for hotplugging zPCI devices on s390), it's not necessary to
|
|
Pablo Greco |
40546a |
explicitly detach the zPCI device when unplugging a PCI device. To
|
|
Pablo Greco |
40546a |
quote:
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
There's no need to implement hot unplug for zPCI as QEMU
|
|
Pablo Greco |
40546a |
implements an unplug callback which will unplug both PCI and
|
|
Pablo Greco |
40546a |
zPCI device in a cascaded way.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
and the evidence bears this out - all the other uses of
|
|
Pablo Greco |
40546a |
qemuDomainDetachExtensionDevice() (except one, which I believe is
|
|
Pablo Greco |
40546a |
also in error, and is being removed in a separate patch) are only to
|
|
Pablo Greco |
40546a |
remove the zPCI extension device in cases where it was successfully
|
|
Pablo Greco |
40546a |
added, but there was some other failure later in the hotplug process
|
|
Pablo Greco |
40546a |
(so there was no regular PCI device to remove and trigger removal of
|
|
Pablo Greco |
40546a |
the zPCI extension device).
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
* PCI controllers are not hot pluggable, so this is dead code
|
|
Pablo Greco |
40546a |
anyway. (The only controllers that can currently be
|
|
Pablo Greco |
40546a |
hotplugged/unplugged are SCSI controllers).
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
(cherry picked from commit 143291698358f5a1e693c768893d89038420af25)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Conflicts:
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
* src/qemu/qemu_hotplug.c
|
|
Pablo Greco |
40546a |
+ the code dealing with entering and exiting the monitor is
|
|
Pablo Greco |
40546a |
quite a bit different because we don't have backported
|
|
Pablo Greco |
40546a |
qemuDomainDeleteDevice() downstream
|
|
Pablo Greco |
40546a |
- missing 4cd13478ac33
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <20190408085732.28684-15-abologna@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Laine Stump <laine@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/qemu/qemu_hotplug.c | 6 ------
|
|
Pablo Greco |
40546a |
1 file changed, 6 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
Pablo Greco |
40546a |
index 8394efa739..f16213c6e0 100644
|
|
Pablo Greco |
40546a |
--- a/src/qemu/qemu_hotplug.c
|
|
Pablo Greco |
40546a |
+++ b/src/qemu/qemu_hotplug.c
|
|
Pablo Greco |
40546a |
@@ -5077,17 +5077,11 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
|
|
Pablo Greco |
40546a |
qemuDomainMarkDeviceForRemoval(vm, &detach->info);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
qemuDomainObjEnterMonitor(driver, vm);
|
|
Pablo Greco |
40546a |
- if (detach->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
|
|
Pablo Greco |
40546a |
- qemuDomainDetachExtensionDevice(priv->mon, &detach->info)) {
|
|
Pablo Greco |
40546a |
- goto exit_monitor;
|
|
Pablo Greco |
40546a |
- }
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
|
|
Pablo Greco |
40546a |
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- exit_monitor:
|
|
Pablo Greco |
40546a |
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|