Re: [PATCH 5/5] qemu: capabilities: force update if the microcode version does not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 04, 2018 at 15:58:12 +0100, Jiri Denemark wrote:
> From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> 
> A microcode update can cause the CPUID bits to change; an example
> from the past was the update that disabled TSX on several Haswell
> and Broadwell machines.
> 
> Therefore, place microcode version in the virQEMUCaps struct and
> XML, and rebuild the cache if the versions do not match.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
>  src/qemu/qemu_capabilities.c                       | 40 +++++++++++++++++++++-
>  src/qemu/qemu_capabilities.h                       |  6 ++--
>  src/qemu/qemu_capspriv.h                           |  5 +++
>  src/qemu/qemu_driver.c                             |  9 ++++-
>  tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |  1 +
>  .../caps_2.10.0-gicv2.aarch64.xml                  |  1 +
>  .../caps_2.10.0-gicv3.aarch64.xml                  |  1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |  1 +
>  tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |  1 +
>  .../caps_2.6.0-gicv2.aarch64.xml                   |  1 +
>  .../caps_2.6.0-gicv3.aarch64.xml                   |  1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml    |  1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml    |  1 +
>  tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml    |  1 +
>  tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml    |  1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml    |  1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |  1 +
>  tests/qemucapabilitiestest.c                       | 14 +++++---
>  tests/qemucapsprobe.c                              |  2 +-
>  tests/testutilsqemu.c                              |  2 +-
>  32 files changed, 93 insertions(+), 10 deletions(-)
> 
[...]

> diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
> index dde5f767b8..87807b4135 100644
> --- a/tests/qemucapabilitiestest.c
> +++ b/tests/qemucapabilitiestest.c
> @@ -61,10 +61,16 @@ testQemuCaps(const void *opaque)
>                                    qemuMonitorTestGetMonitor(mon)) < 0)
>          goto cleanup;
>  
> -    if (virQEMUCapsGet(capsActual, QEMU_CAPS_KVM) &&
> -        virQEMUCapsInitQMPMonitorTCG(capsActual,
> -                                     qemuMonitorTestGetMonitor(mon)) < 0)
> -        goto cleanup;
> +    if (virQEMUCapsGet(capsActual, QEMU_CAPS_KVM)) {
> +        if (virQEMUCapsInitQMPMonitorTCG(capsActual,
> +                                         qemuMonitorTestGetMonitor(mon)) < 0)
> +            goto cleanup;
> +
> +        /* Fill microcodeVersion with a "random" value which is the file
> +         * length to provide a reproducible number for testing.
> +         */
> +        virQEMUCapsSetMicrocodeVersion(capsActual, virFileLength(repliesFile, -1));
> +    }
>  
>      if (!(actual = virQEMUCapsFormatCache(capsActual)))
>          goto cleanup;

Interresting approach. The only drawback will be that when updating
capabilities this will generate 2 lines more of diff.

ACK

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux