]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Change CPU comparison algorithm for future models
authorJiri Denemark <jdenemar@redhat.com>
Tue, 15 Oct 2024 16:18:25 +0000 (18:18 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 23 Oct 2024 14:00:45 +0000 (16:00 +0200)
commitf928eb5fc80ca0ed7277f2513b63aed36c09d275
tree2d4c877849b4c6e539cf244c6ae0e2114f065e2c
parente373f870345bc5fcb47873e804d92a01b42aafad
qemu: Change CPU comparison algorithm for future models

When starting a domain we check whether the guest CPU definition is
compatible with the host (i.e., when the host supports all features
required both explicitly and by the specified CPU model) as long as
check == 'partial', which is the default.

We are doing so by checking our definition of the CPU model in the CPU
map amending it with explicitly mentioned features and comparing it to
features QEMU would enabled when started with -cpu host. But since our
CPU model definitions often slightly differ from QEMU we may be checking
features which are not actually needed and on the other hand not
checking something that is part of the CPU model in QEMU.

This patch changes the algorithm for CPU models added in the future
(changing it for existing models could cause them to suddenly become
incompatible with the host and domains using them would fail to start).
The new algorithm uses information we probe from QEMU about features
that block each model from being directly usable. If all those features
are explicitly disabled in the CPU definition we consider the base model
compatible with the host. Then we only need to check that all explicitly
required features are supported by QEMU on the host to get the result
for the whole CPU definition.

After this we only use the model definitions (for newly added models)
from CPU map for creating a CPU definition for host-model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c