[PATCH v2 0/1] qemuProcessRefreshCPU: skip 'host-model' code

changes in v2: - resending only patch 5/5 - changed the 'if' placement to qemuProcessRefreshCPU as suggested by Jiri Denemark - changed the commit msg to reflect the new intention of the patch link to v1: https://www.redhat.com/archives/libvir-list/2020-May/msg01049.html Daniel Henrique Barboza (1): qemuProcessRefreshCPU: skip 'host-model' logic for pSeries guests src/qemu/qemu_process.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.26.2

Commit v3.10.0-182-g237f045d9a ("qemu: Ignore fallback CPU attribute on reconnect") forced CPU 'fallback' to ALLOW, regardless of user choice. This fixed a situation in which guests created with older Libvirt versions, which used CPU mode 'host-model' in runtime, would fail to launch in a newer Libvirt if the fallback was set to FORBID. This would lead to a scenario where the CPU was translated to 'host-model' to 'custom', but then the FORBID setting would make the translation process fail. PSeries can operate with 'host-model' in runtime due to specific PPC64 mechanics regarding compatibility mode. The update() implementation of the cpuDriverPPC64 driver is a NO-OP if CPU mode is 'host-model', and the driver does not implement translate(). The commit mentioned above is causing PSeries guests to get their 'fallback' setting to ALLOW, overwriting user choice, exposing a design problem in qemuProcessRefreshCPU() - for PSeries guests, handling 'host-model' as it is being done does not apply. All other cpuArchDrivers implements update() and changes guest mode to VIR_CPU_MODE_CUSTOM, meaning that PSeries is currently the only exception to this logic. Let's make it official. https://bugzilla.redhat.com/show_bug.cgi?id=1660711 Suggested-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- src/qemu/qemu_process.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a1ef1d42b0..999e576e5b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7775,6 +7775,15 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, * running domain. */ if (vm->def->cpu->mode == VIR_CPU_MODE_HOST_MODEL) { + /* + * PSeries domains are able to run with host-model CPU by design, + * even on Libvirt newer than 2.3, never replacing host-model with + * custom in the virCPUUpdate() call. It is not needed to call + * virCPUUpdate() and qemuProcessUpdateCPU() in this case. + */ + if (qemuDomainIsPSeries(vm->def)) + return 0; + if (!(hostmig = virCPUCopyMigratable(host->arch, host))) return -1; -- 2.26.2

On Mon, May 25, 2020 at 09:39:45 -0300, Daniel Henrique Barboza wrote:
Commit v3.10.0-182-g237f045d9a ("qemu: Ignore fallback CPU attribute on reconnect") forced CPU 'fallback' to ALLOW, regardless of user choice. This fixed a situation in which guests created with older Libvirt versions, which used CPU mode 'host-model' in runtime, would fail to launch in a newer Libvirt if the fallback was set to FORBID. This would lead to a scenario where the CPU was translated to 'host-model' to 'custom', but then the FORBID setting would make the translation process fail.
PSeries can operate with 'host-model' in runtime due to specific PPC64 mechanics regarding compatibility mode. The update() implementation of the cpuDriverPPC64 driver is a NO-OP if CPU mode is 'host-model', and the driver does not implement translate(). The commit mentioned above is causing PSeries guests to get their 'fallback' setting to ALLOW, overwriting user choice, exposing a design problem in qemuProcessRefreshCPU() - for PSeries guests, handling 'host-model' as it is being done does not apply.
All other cpuArchDrivers implements update() and changes guest mode to VIR_CPU_MODE_CUSTOM, meaning that PSeries is currently the only exception to this logic. Let's make it official.
https://bugzilla.redhat.com/show_bug.cgi?id=1660711
Suggested-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- src/qemu/qemu_process.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Reviewed-by: Jiri Denemark <jdenemar@redhat.com> Thanks and pushed.
participants (2)
-
Daniel Henrique Barboza
-
Jiri Denemark