[libvirt] [PATCH 00/12] qemu: Enforce guest CPU specification

Jiri Denemark posted 12 patches 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1489510598.git.jdenemar@redhat.com
docs/formatdomain.html.in                          |  52 ++++-
docs/schemas/cputypes.rng                          |  10 +
docs/schemas/domaincommon.rng                      |   3 +
src/conf/cpu_conf.c                                |  30 +++
src/conf/cpu_conf.h                                |  12 ++
src/conf/domain_conf.c                             |  21 ++
src/cpu/cpu.c                                      |  45 +++++
src/cpu/cpu.h                                      |  12 ++
src/cpu/cpu_x86.c                                  | 105 ++++++++++
src/libvirt_private.syms                           |   1 +
src/qemu/qemu_domain.c                             |  42 ++++
src/qemu/qemu_monitor.c                            |  11 +-
src/qemu/qemu_monitor.h                            |   3 +-
src/qemu/qemu_monitor_json.c                       |  38 +++-
src/qemu/qemu_monitor_json.h                       |   3 +-
src/qemu/qemu_process.c                            | 225 +++++++++++++--------
tests/domaincapstest.c                             |  38 ++--
tests/qemumonitorjsontest.c                        |   4 +-
.../qemuxml2argv-aarch64-gic-host.xml              |   2 +-
.../qemuxml2argv-aarch64-gic-v2.xml                |   2 +-
.../qemuxml2argv-aarch64-gic-v3.xml                |   2 +-
.../qemuxml2argv-cpu-check-default-none.args       |  21 ++
.../qemuxml2argv-cpu-check-default-none.xml        |  19 ++
.../qemuxml2argv-cpu-check-default-none2.args      |  21 ++
.../qemuxml2argv-cpu-check-default-none2.xml       |  21 ++
.../qemuxml2argv-cpu-check-default-partial.args    |  22 ++
.../qemuxml2argv-cpu-check-default-partial.xml     |  19 ++
.../qemuxml2argv-cpu-check-default-partial2.args   |  21 ++
.../qemuxml2argv-cpu-check-default-partial2.xml    |  21 ++
.../qemuxml2argv-cpu-check-full.args               |   1 +
.../qemuxml2argv-cpu-check-full.xml                |  21 ++
.../qemuxml2argv-cpu-check-none.args               |  21 ++
.../qemuxml2argv-cpu-check-none.xml                |  21 ++
.../qemuxml2argv-cpu-check-partial.args            |   1 +
.../qemuxml2argv-cpu-check-partial.xml             |  21 ++
tests/qemuxml2argvtest.c                           |   8 +
.../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml   |   2 +-
...qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml |   2 +-
.../qemuxml2xmlout-aarch64-virtio-pci-default.xml  |   2 +-
...2xmlout-aarch64-virtio-pci-manual-addresses.xml |   2 +-
.../qemuxml2xmlout-cpu-check-default-none.xml      |  28 +++
.../qemuxml2xmlout-cpu-check-default-none2.xml     |  30 +++
.../qemuxml2xmlout-cpu-check-default-partial.xml   |  30 +++
.../qemuxml2xmlout-cpu-check-default-partial2.xml  |  30 +++
.../qemuxml2xmlout-cpu-check-full.xml              |  30 +++
.../qemuxml2xmlout-cpu-check-none.xml              |  30 +++
.../qemuxml2xmlout-cpu-check-partial.xml           |  30 +++
.../qemuxml2xmlout-cpu-eoi-disabled.xml            |   2 +-
.../qemuxml2xmlout-cpu-eoi-enabled.xml             |   2 +-
.../qemuxml2xmlout-cpu-host-kvmclock.xml           |   2 +-
.../qemuxml2xmlout-cpu-host-model-features.xml     |   2 +-
...emuxml2xmlout-cpu-host-passthrough-features.xml |   2 +-
.../qemuxml2xmlout-cpu-kvmclock.xml                |   2 +-
.../qemuxml2xmlout-graphics-spice-timeout.xml      |   2 +-
tests/qemuxml2xmltest.c                            |   8 +
tests/testutilsqemu.c                              |  48 ++---
56 files changed, 1039 insertions(+), 167 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none2.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none2.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial2.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial2.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-full.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-full.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-none.xml
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-partial.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-partial.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-none.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-none2.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-partial.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-partial2.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-full.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-none.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-partial.xml
[libvirt] [PATCH 00/12] qemu: Enforce guest CPU specification
Posted by Jiri Denemark 7 years, 1 month ago
When starting a domain with custom guest CPU specification QEMU may add
or remove some CPU features. There are several reasons for this, e.g.,
QEMU/KVM does not support some requested features or the definition of
the requested CPU model in libvirt's cpu_map.xml differs from the one
QEMU is using. We can't really avoid this because CPU models are allowed
to change with machine types and libvirt doesn't know (and probably
doesn't even want to know) about such changes.

Thus when we want to make sure guest ABI doesn't change when a domain
gets migrated to another host, we need to update our live CPU definition
according to the CPU QEMU created. Once updated, we will change CPU
checking to VIR_CPU_CHECK_FULL to make sure the virtual CPU created
after migration exactly matches the one on the source.

https://bugzilla.redhat.com/show_bug.cgi?id=822148
https://bugzilla.redhat.com/show_bug.cgi?id=824989

Jiri Denemark (12):
  tests: Switch to sparse initialization of virCPUDef
  docs: Clarify /domain/cpu/@match description
  Introduce /domain/cpu/@check XML attribute
  qemu: Set default values for CPU check attribute
  qemu: Refactor Hyper-V features check
  qemu: Refactor KVM features check
  qemu: Refactor CPU features check
  qemu: Refactor qemuProcessVerifyGuestCPU
  qemu: Use ARCH_IS_X86 in qemuMonitorJSONGetGuestCPU
  qemu: Ask QEMU for filtered CPU features
  qemu: Update CPU definition according to QEMU
  qemu: Enforce guest CPU specification

 docs/formatdomain.html.in                          |  52 ++++-
 docs/schemas/cputypes.rng                          |  10 +
 docs/schemas/domaincommon.rng                      |   3 +
 src/conf/cpu_conf.c                                |  30 +++
 src/conf/cpu_conf.h                                |  12 ++
 src/conf/domain_conf.c                             |  21 ++
 src/cpu/cpu.c                                      |  45 +++++
 src/cpu/cpu.h                                      |  12 ++
 src/cpu/cpu_x86.c                                  | 105 ++++++++++
 src/libvirt_private.syms                           |   1 +
 src/qemu/qemu_domain.c                             |  42 ++++
 src/qemu/qemu_monitor.c                            |  11 +-
 src/qemu/qemu_monitor.h                            |   3 +-
 src/qemu/qemu_monitor_json.c                       |  38 +++-
 src/qemu/qemu_monitor_json.h                       |   3 +-
 src/qemu/qemu_process.c                            | 225 +++++++++++++--------
 tests/domaincapstest.c                             |  38 ++--
 tests/qemumonitorjsontest.c                        |   4 +-
 .../qemuxml2argv-aarch64-gic-host.xml              |   2 +-
 .../qemuxml2argv-aarch64-gic-v2.xml                |   2 +-
 .../qemuxml2argv-aarch64-gic-v3.xml                |   2 +-
 .../qemuxml2argv-cpu-check-default-none.args       |  21 ++
 .../qemuxml2argv-cpu-check-default-none.xml        |  19 ++
 .../qemuxml2argv-cpu-check-default-none2.args      |  21 ++
 .../qemuxml2argv-cpu-check-default-none2.xml       |  21 ++
 .../qemuxml2argv-cpu-check-default-partial.args    |  22 ++
 .../qemuxml2argv-cpu-check-default-partial.xml     |  19 ++
 .../qemuxml2argv-cpu-check-default-partial2.args   |  21 ++
 .../qemuxml2argv-cpu-check-default-partial2.xml    |  21 ++
 .../qemuxml2argv-cpu-check-full.args               |   1 +
 .../qemuxml2argv-cpu-check-full.xml                |  21 ++
 .../qemuxml2argv-cpu-check-none.args               |  21 ++
 .../qemuxml2argv-cpu-check-none.xml                |  21 ++
 .../qemuxml2argv-cpu-check-partial.args            |   1 +
 .../qemuxml2argv-cpu-check-partial.xml             |  21 ++
 tests/qemuxml2argvtest.c                           |   8 +
 .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml   |   2 +-
 ...qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml |   2 +-
 .../qemuxml2xmlout-aarch64-virtio-pci-default.xml  |   2 +-
 ...2xmlout-aarch64-virtio-pci-manual-addresses.xml |   2 +-
 .../qemuxml2xmlout-cpu-check-default-none.xml      |  28 +++
 .../qemuxml2xmlout-cpu-check-default-none2.xml     |  30 +++
 .../qemuxml2xmlout-cpu-check-default-partial.xml   |  30 +++
 .../qemuxml2xmlout-cpu-check-default-partial2.xml  |  30 +++
 .../qemuxml2xmlout-cpu-check-full.xml              |  30 +++
 .../qemuxml2xmlout-cpu-check-none.xml              |  30 +++
 .../qemuxml2xmlout-cpu-check-partial.xml           |  30 +++
 .../qemuxml2xmlout-cpu-eoi-disabled.xml            |   2 +-
 .../qemuxml2xmlout-cpu-eoi-enabled.xml             |   2 +-
 .../qemuxml2xmlout-cpu-host-kvmclock.xml           |   2 +-
 .../qemuxml2xmlout-cpu-host-model-features.xml     |   2 +-
 ...emuxml2xmlout-cpu-host-passthrough-features.xml |   2 +-
 .../qemuxml2xmlout-cpu-kvmclock.xml                |   2 +-
 .../qemuxml2xmlout-graphics-spice-timeout.xml      |   2 +-
 tests/qemuxml2xmltest.c                            |   8 +
 tests/testutilsqemu.c                              |  48 ++---
 56 files changed, 1039 insertions(+), 167 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none2.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-none2.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial2.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-default-partial2.xml
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-full.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-full.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-none.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-none.xml
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-partial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-check-partial.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-none.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-none2.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-partial.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-default-partial2.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-full.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-none.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-check-partial.xml

-- 
2.12.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/12] qemu: Enforce guest CPU specification
Posted by Ján Tomko 7 years, 1 month ago
On Tue, Mar 14, 2017 at 05:57:39PM +0100, Jiri Denemark wrote:
>When starting a domain with custom guest CPU specification QEMU may add
>or remove some CPU features. There are several reasons for this, e.g.,
>QEMU/KVM does not support some requested features or the definition of
>the requested CPU model in libvirt's cpu_map.xml differs from the one
>QEMU is using. We can't really avoid this because CPU models are allowed
>to change with machine types and libvirt doesn't know (and probably
>doesn't even want to know) about such changes.
>
>Thus when we want to make sure guest ABI doesn't change when a domain
>gets migrated to another host, we need to update our live CPU definition
>according to the CPU QEMU created. Once updated, we will change CPU
>checking to VIR_CPU_CHECK_FULL to make sure the virtual CPU created
>after migration exactly matches the one on the source.
>
>https://bugzilla.redhat.com/show_bug.cgi?id=822148
>https://bugzilla.redhat.com/show_bug.cgi?id=824989
>
>Jiri Denemark (12):
>  tests: Switch to sparse initialization of virCPUDef
>  docs: Clarify /domain/cpu/@match description
>  Introduce /domain/cpu/@check XML attribute
>  qemu: Set default values for CPU check attribute
>  qemu: Refactor Hyper-V features check
>  qemu: Refactor KVM features check
>  qemu: Refactor CPU features check
>  qemu: Refactor qemuProcessVerifyGuestCPU
>  qemu: Use ARCH_IS_X86 in qemuMonitorJSONGetGuestCPU
>  qemu: Ask QEMU for filtered CPU features
>  qemu: Update CPU definition according to QEMU
>  qemu: Enforce guest CPU specification
>

ACK series.

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/12] qemu: Enforce guest CPU specification
Posted by Jiri Denemark 7 years, 1 month ago
On Wed, Mar 15, 2017 at 17:39:34 +0100, Ján Tomko wrote:
> On Tue, Mar 14, 2017 at 05:57:39PM +0100, Jiri Denemark wrote:
> >When starting a domain with custom guest CPU specification QEMU may add
> >or remove some CPU features. There are several reasons for this, e.g.,
> >QEMU/KVM does not support some requested features or the definition of
> >the requested CPU model in libvirt's cpu_map.xml differs from the one
> >QEMU is using. We can't really avoid this because CPU models are allowed
> >to change with machine types and libvirt doesn't know (and probably
> >doesn't even want to know) about such changes.
> >
> >Thus when we want to make sure guest ABI doesn't change when a domain
> >gets migrated to another host, we need to update our live CPU definition
> >according to the CPU QEMU created. Once updated, we will change CPU
> >checking to VIR_CPU_CHECK_FULL to make sure the virtual CPU created
> >after migration exactly matches the one on the source.
> >
> >https://bugzilla.redhat.com/show_bug.cgi?id=822148
> >https://bugzilla.redhat.com/show_bug.cgi?id=824989
> >
> >Jiri Denemark (12):
> >  tests: Switch to sparse initialization of virCPUDef
> >  docs: Clarify /domain/cpu/@match description
> >  Introduce /domain/cpu/@check XML attribute
> >  qemu: Set default values for CPU check attribute
> >  qemu: Refactor Hyper-V features check
> >  qemu: Refactor KVM features check
> >  qemu: Refactor CPU features check
> >  qemu: Refactor qemuProcessVerifyGuestCPU
> >  qemu: Use ARCH_IS_X86 in qemuMonitorJSONGetGuestCPU
> >  qemu: Ask QEMU for filtered CPU features
> >  qemu: Update CPU definition according to QEMU
> >  qemu: Enforce guest CPU specification
> 
> ACK series.

Thanks, I implemented a test for the new virCPUUpdateLive API to confirm
the API works as expected (I'll send it to the list later today) and
pushed this series.

Jirka

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