[PATCH v2 0/5] Allow Guest CPU Model with Deprecated Features Disabled

Collin Walling posted 5 patches 1 month ago
There is a newer version of this series
docs/manpages/virsh.rst                       |   6 +
include/libvirt/libvirt-domain.h              |  12 +
src/conf/cpu_conf.c                           |  10 +
src/conf/cpu_conf.h                           |   1 +
src/conf/schemas/cputypes.rng                 |  12 +
src/libvirt-domain.c                          |   2 +-
src/qemu/qemu_capabilities.c                  |  89 +++++
src/qemu/qemu_capabilities.h                  |   4 +
src/qemu/qemu_driver.c                        |   8 +-
src/qemu/qemu_monitor.c                       |  10 +
src/qemu/qemu_monitor.h                       |   1 +
src/qemu/qemu_monitor_json.c                  |  64 +++-
src/qemu/qemu_process.c                       |   4 +
.../caps_9.1.0_s390x.replies                  | 348 +++++++++++++++++-
.../qemucapabilitiesdata/caps_9.1.0_s390x.xml |  13 +
.../caps_9.2.0_s390x.replies                  | 348 +++++++++++++++++-
.../qemucapabilitiesdata/caps_9.2.0_s390x.xml |  13 +
tools/virsh-host.c                            |   9 +-
18 files changed, 940 insertions(+), 14 deletions(-)
[PATCH v2 0/5] Allow Guest CPU Model with Deprecated Features Disabled
Posted by Collin Walling 1 month ago
# Changelog

 v2
    - rebased on latest master changes

# Description

Add support for libvirt to query and cache an array of deprecated CPU features
(aka CPU properties) for the host-model.  This data is queried via a full
query-cpu-model-expansion and cached in the QEMU capabilities file.  This
model expansion will depend on the availability of the "deprecated-props" field
resulting from a query-cpu-model-expansion command.  Currently, only s390x
supports this field.

The purpose of these patches is to make it easy for users to create guests with
a CPU model that will be compatible & migratable with future hardware.

An updated host CPU model with deprecated features paired with the policy "disable"
may be visable via an update to the virsh domcapabilities command with the
--disable-deprecated-features flag.  An example is shown below.

Note: other CPU model queries (e.g. baseline and comparison) currently do not
consider deprecated features, as their outputs do not consider feature policy.
If implementation is desired, it will require a discussion on how these
commands should report policies.

Examples:

    virsh domcapabilities --disable-deprecated-features

e.g. output (trimmed):

    <mode name='host-model' supported='yes'>
      <model fallback='forbid'>z14.2-base</model>
      <feature policy='require' name='aen'/>
      <feature policy='require' name='cmmnt'/>
      <feature policy='require' name='aefsi'/>
      <feature policy='require' name='diag318'/>
      <feature policy='require' name='mepoch'/>
      <feature policy='require' name='msa8'/>
      <feature policy='require' name='msa7'/>
      <feature policy='require' name='msa6'/>
      <feature policy='require' name='msa5'/>
      <feature policy='require' name='msa4'/>
      <feature policy='require' name='msa3'/>
      <feature policy='require' name='msa2'/>
      <feature policy='require' name='msa1'/>
      <feature policy='require' name='sthyi'/>
      <feature policy='require' name='edat'/>
      <feature policy='require' name='ri'/>
      <feature policy='require' name='edat2'/>
      <feature policy='require' name='etoken'/>
      <feature policy='require' name='vx'/>
      <feature policy='require' name='ipter'/>
      <feature policy='require' name='mepochptff'/>
      <feature policy='require' name='ap'/>
      <feature policy='require' name='vxeh'/>
      <feature policy='require' name='vxpd'/>
      <feature policy='require' name='esop'/>
      <feature policy='require' name='apqi'/>
      <feature policy='require' name='apft'/>
      <feature policy='require' name='els'/>
      <feature policy='require' name='iep'/>
      <feature policy='require' name='apqci'/>
      <feature policy='disable' name='cte'/>
      <feature policy='require' name='ais'/>
      <feature policy='disable' name='bpb'/>
      <feature policy='require' name='ctop'/>
      <feature policy='require' name='gs'/>
      <feature policy='require' name='ppa15'/>
      <feature policy='require' name='zpci'/>
      <feature policy='require' name='sea_esop2'/>
      <feature policy='disable' name='te'/>
      <feature policy='require' name='cmm'/>
      <feature policy='disable' name='csske'/>
    </mode>

A domain may be defined with a new <cpu> XML attribute, deprecated_features='on|off':

  <cpu mode='host-model' check='partial' deprecated_features='off'/>

e.g. after guest has started (trimmed):

  <cpu mode='custom' match='exact' check='partial' deprecated_features='off'>
    <model fallback='forbid'>z14.2-base</model>
    <feature policy='require' name='aen'/>
    <feature policy='require' name='cmmnt'/>
    <feature policy='require' name='aefsi'/>
    <feature policy='require' name='diag318'/>
    <feature policy='require' name='mepoch'/>
    <feature policy='require' name='msa8'/>
    <feature policy='require' name='msa7'/>
    <feature policy='require' name='msa6'/>
    <feature policy='require' name='msa5'/>
    <feature policy='require' name='msa4'/>
    <feature policy='require' name='msa3'/>
    <feature policy='require' name='msa2'/>
    <feature policy='require' name='msa1'/>
    <feature policy='require' name='sthyi'/>
    <feature policy='require' name='edat'/>
    <feature policy='require' name='ri'/>
    <feature policy='require' name='edat2'/>
    <feature policy='require' name='etoken'/>
    <feature policy='require' name='vx'/>
    <feature policy='require' name='ipter'/>
    <feature policy='require' name='mepochptff'/>
    <feature policy='require' name='ap'/>
    <feature policy='require' name='vxeh'/>
    <feature policy='require' name='vxpd'/>
    <feature policy='require' name='esop'/>
    <feature policy='require' name='apqi'/>
    <feature policy='require' name='apft'/>
    <feature policy='require' name='els'/>
    <feature policy='require' name='iep'/>
    <feature policy='require' name='apqci'/>
    <feature policy='disable' name='cte'/>
    <feature policy='require' name='ais'/>
    <feature policy='disable' name='bpb'/>
    <feature policy='require' name='ctop'/>
    <feature policy='require' name='gs'/>
    <feature policy='require' name='ppa15'/>
    <feature policy='require' name='zpci'/>
    <feature policy='require' name='sea_esop2'/>
    <feature policy='disable' name='te'/>
    <feature policy='require' name='cmm'/>
    <feature policy='disable' name='csske'/>
  </cpu>

Collin Walling (5):
  qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions
  qemu: parse deprecated-props from query-cpu-model-expansion response
  qemu_capabilities: query deprecated features for host-model
  virsh: add --disable-deprecated-features flag to domcapabilities
  conf: add deprecated_features attribute

 docs/manpages/virsh.rst                       |   6 +
 include/libvirt/libvirt-domain.h              |  12 +
 src/conf/cpu_conf.c                           |  10 +
 src/conf/cpu_conf.h                           |   1 +
 src/conf/schemas/cputypes.rng                 |  12 +
 src/libvirt-domain.c                          |   2 +-
 src/qemu/qemu_capabilities.c                  |  89 +++++
 src/qemu/qemu_capabilities.h                  |   4 +
 src/qemu/qemu_driver.c                        |   8 +-
 src/qemu/qemu_monitor.c                       |  10 +
 src/qemu/qemu_monitor.h                       |   1 +
 src/qemu/qemu_monitor_json.c                  |  64 +++-
 src/qemu/qemu_process.c                       |   4 +
 .../caps_9.1.0_s390x.replies                  | 348 +++++++++++++++++-
 .../qemucapabilitiesdata/caps_9.1.0_s390x.xml |  13 +
 .../caps_9.2.0_s390x.replies                  | 348 +++++++++++++++++-
 .../qemucapabilitiesdata/caps_9.2.0_s390x.xml |  13 +
 tools/virsh-host.c                            |   9 +-
 18 files changed, 940 insertions(+), 14 deletions(-)

-- 
2.45.1
Re: [PATCH v2 0/5] Allow Guest CPU Model with Deprecated Features Disabled
Posted by Jiri Denemark 4 weeks, 1 day ago
On Mon, Nov 25, 2024 at 14:46:34 -0500, Collin Walling wrote:
> # Changelog
> 
>  v2
>     - rebased on latest master changes

I started reviewing the v1 yesterday with a plan to push this in time
for the release, but I found a few issues and got sidetracked by
investigating why the issues were not caught by our unit tests. They are
actually visible when running qemucapabilitiestest in valgrind, normally
everything passes just fine :-/ I'm copying my notes for v1 here.

Jirka
Re: [PATCH v2 0/5] Allow Guest CPU Model with Deprecated Features Disabled
Posted by Collin Walling 2 weeks, 2 days ago
On 11/26/24 11:59 AM, Jiri Denemark wrote:
> On Mon, Nov 25, 2024 at 14:46:34 -0500, Collin Walling wrote:
>> # Changelog
>>
>>  v2
>>     - rebased on latest master changes
> 
> I started reviewing the v1 yesterday with a plan to push this in time
> for the release, but I found a few issues and got sidetracked by
> investigating why the issues were not caught by our unit tests. They are
> actually visible when running qemucapabilitiestest in valgrind, normally
> everything passes just fine :-/ I'm copying my notes for v1 here.
> 
> Jirka

Whoops, thought I had replied!  Apologies.

Thanks for taking the due-diligence to check on this.  I'll have the
next iteration that addresses this and other review soon.

-- 
Regards,
  Collin