[libvirt] [PATCH v2 7/7] qemu: Drop MSR features from host-model with old QEMU

Ján Tomko jtomko at redhat.com
Thu Jun 20 08:27:08 UTC 2019


On Thu, Jun 20, 2019 at 12:53:42AM +0200, Jiri Denemark wrote:
>With QEMU versions which lack "unavailable-features" we use CPUID based
>detection of features which were enabled or disabled once QEMU starts.
>Thus using MSR features with host-model would result in all of them
>being marked as disabled in the active domain definition even though
>QEMU did not actually disable them.
>
>Let's make sure we add MSR features to host-model only when
>"unavailable-features" property is supported by QEMU.
>
>Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
>---
> src/qemu/qemu_capabilities.c                     | 16 ++++++++++++++++
> tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml |  1 -
> tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml |  1 -
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
>diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>index 4134f319ac..b7c20f3e3e 100644
>--- a/src/qemu/qemu_capabilities.c
>+++ b/src/qemu/qemu_capabilities.c
>@@ -3193,6 +3193,22 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
>             goto error;
>     }
>
>+    if (ARCH_IS_X86(qemuCaps->arch) &&
>+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) {
>+        bool selecting = false;

void *invert = (void *)(intptr_t)0x1;
  or (if you don't like the pointer fun)
bool invert = true;


>+        if (cpu &&
>+            virCPUDefFilterFeatures(cpu, virCPUx86FeatureIsMSR, &selecting) < 0)
>+            goto error;
>+
>+        if (migCPU &&
>+            virCPUDefFilterFeatures(migCPU, virCPUx86FeatureIsMSR, &selecting) < 0)
>+            goto error;
>+
>+        if (fullCPU &&
>+            virCPUDefFilterFeatures(fullCPU, virCPUx86FeatureIsMSR, &selecting) < 0)
>+            goto error;
>+    }
>+
>     virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU);
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190620/97ebcfcc/attachment-0001.sig>


More information about the libvir-list mailing list