[PATCH v2 00/36] Add support for versioned CPU models

Jiri Denemark posted 36 patches 2 weeks ago
docs/formatdomaincaps.rst                     |    8 +-
src/conf/domain_capabilities.c                |   11 +-
src/conf/domain_capabilities.h                |    4 +-
src/cpu/cpu.c                                 |   25 +
src/cpu/cpu.h                                 |    8 +
src/cpu/cpu_map.c                             |    2 +-
src/cpu/cpu_x86.c                             |   88 +-
src/cpu_map/index.xml                         |  291 ++--
src/cpu_map/meson.build                       |   60 +
src/cpu_map/sync_qemu_features_i386.py        |    3 +
src/cpu_map/sync_qemu_models_i386.py          |  184 +-
src/cpu_map/x86_Broadwell-v1.xml              |    6 +
src/cpu_map/x86_Broadwell-v2.xml              |    6 +
src/cpu_map/x86_Broadwell-v3.xml              |    6 +
src/cpu_map/x86_Broadwell-v4.xml              |    6 +
src/cpu_map/x86_Cascadelake-Server-v1.xml     |    6 +
src/cpu_map/x86_Cascadelake-Server-v2.xml     |  157 ++
src/cpu_map/x86_Cascadelake-Server-v3.xml     |    6 +
src/cpu_map/x86_Cascadelake-Server-v4.xml     |  156 ++
src/cpu_map/x86_Cascadelake-Server-v5.xml     |  158 ++
src/cpu_map/x86_Cooperlake-v1.xml             |    6 +
src/cpu_map/x86_Cooperlake-v2.xml             |  164 ++
src/cpu_map/x86_Denverton-v1.xml              |    6 +
src/cpu_map/x86_Denverton-v2.xml              |  137 ++
src/cpu_map/x86_Denverton-v3.xml              |  139 ++
src/cpu_map/x86_Denverton.xml                 |  138 ++
src/cpu_map/x86_Dhyana-v1.xml                 |    6 +
src/cpu_map/x86_Dhyana-v2.xml                 |   73 +
src/cpu_map/x86_EPYC-Milan-v1.xml             |    6 +
src/cpu_map/x86_EPYC-Milan-v2.xml             |   99 ++
src/cpu_map/x86_EPYC-Rome-v1.xml              |    6 +
src/cpu_map/x86_EPYC-Rome-v2.xml              |   86 +
src/cpu_map/x86_EPYC-Rome-v3.xml              |   86 +
src/cpu_map/x86_EPYC-Rome-v4.xml              |   85 +
src/cpu_map/x86_EPYC-v1.xml                   |    6 +
src/cpu_map/x86_EPYC-v2.xml                   |    6 +
src/cpu_map/x86_EPYC-v3.xml                   |   79 +
src/cpu_map/x86_EPYC-v4.xml                   |   79 +
src/cpu_map/x86_GraniteRapids-v1.xml          |    6 +
src/cpu_map/x86_Haswell-v1.xml                |    6 +
src/cpu_map/x86_Haswell-v2.xml                |    6 +
src/cpu_map/x86_Haswell-v3.xml                |    6 +
src/cpu_map/x86_Haswell-v4.xml                |    6 +
src/cpu_map/x86_Icelake-Server-v1.xml         |    6 +
src/cpu_map/x86_Icelake-Server-v2.xml         |    6 +
src/cpu_map/x86_Icelake-Server-v3.xml         |  165 ++
src/cpu_map/x86_Icelake-Server-v4.xml         |  172 ++
src/cpu_map/x86_Icelake-Server-v5.xml         |  174 ++
src/cpu_map/x86_Icelake-Server-v6.xml         |  175 ++
src/cpu_map/x86_Icelake-Server-v7.xml         |  177 ++
src/cpu_map/x86_IvyBridge-v1.xml              |    6 +
src/cpu_map/x86_IvyBridge-v2.xml              |    6 +
src/cpu_map/x86_KnightsMill.xml               |   71 +
src/cpu_map/x86_Nehalem-v1.xml                |    6 +
src/cpu_map/x86_Nehalem-v2.xml                |    6 +
src/cpu_map/x86_SandyBridge-v1.xml            |    6 +
src/cpu_map/x86_SandyBridge-v2.xml            |    6 +
src/cpu_map/x86_SapphireRapids-v1.xml         |    6 +
src/cpu_map/x86_SapphireRapids-v2.xml         |  193 +++
src/cpu_map/x86_SapphireRapids-v3.xml         |  198 +++
src/cpu_map/x86_SierraForest-v1.xml           |    6 +
src/cpu_map/x86_Skylake-Client-v1.xml         |    6 +
src/cpu_map/x86_Skylake-Client-v2.xml         |    6 +
src/cpu_map/x86_Skylake-Client-v3.xml         |    6 +
src/cpu_map/x86_Skylake-Client-v4.xml         |  141 ++
src/cpu_map/x86_Skylake-Server-v1.xml         |    6 +
src/cpu_map/x86_Skylake-Server-v2.xml         |    6 +
src/cpu_map/x86_Skylake-Server-v3.xml         |    6 +
src/cpu_map/x86_Skylake-Server-v4.xml         |  148 ++
src/cpu_map/x86_Skylake-Server-v5.xml         |  150 ++
src/cpu_map/x86_Snowridge-v1.xml              |    6 +
src/cpu_map/x86_Snowridge-v2.xml              |  143 ++
src/cpu_map/x86_Snowridge-v3.xml              |  145 ++
src/cpu_map/x86_Snowridge-v4.xml              |  143 ++
src/cpu_map/x86_Westmere-v1.xml               |    6 +
src/cpu_map/x86_Westmere-v2.xml               |    6 +
src/libvirt_private.syms                      |    1 +
src/qemu/qemu_capabilities.c                  |   10 +-
tests/cputest.c                               |    5 +-
.../x86_64-cpuid-Atom-P5362-host.xml          |    2 +-
.../x86_64-cpuid-Cooperlake-host.xml          |    2 +-
.../x86_64-cpuid-Core-i5-2500-host.xml        |    2 +-
.../x86_64-cpuid-Core-i5-2540M-host.xml       |    2 +-
.../x86_64-cpuid-Core-i5-4670T-host.xml       |    2 +-
.../x86_64-cpuid-Core-i5-650-host.xml         |    2 +-
.../x86_64-cpuid-Core-i5-6600-host.xml        |    2 +-
.../x86_64-cpuid-Core-i7-2600-host.xml        |    2 +-
...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |    2 +-
.../x86_64-cpuid-Core-i7-3520M-host.xml       |    2 +-
.../x86_64-cpuid-Core-i7-3740QM-host.xml      |    2 +-
.../x86_64-cpuid-Core-i7-3770-host.xml        |    2 +-
.../x86_64-cpuid-Core-i7-4510U-host.xml       |    2 +-
.../x86_64-cpuid-Core-i7-4600U-host.xml       |    2 +-
.../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |    2 +-
.../x86_64-cpuid-Core-i7-5600U-host.xml       |    2 +-
.../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |    2 +-
.../x86_64-cpuid-Core-i7-7600U-host.xml       |    2 +-
.../x86_64-cpuid-Core-i7-7700-host.xml        |    2 +-
.../x86_64-cpuid-Core-i7-8550U-host.xml       |    2 +-
.../x86_64-cpuid-Core-i7-8700-host.xml        |    2 +-
.../x86_64-cpuid-EPYC-7502-32-Core-host.xml   |    5 +-
.../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |    2 +-
...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |    8 +-
...6_64-cpuid-Hygon-C86-7185-32-core-host.xml |    5 +-
.../x86_64-cpuid-Ice-Lake-Server-host.xml     |    2 +-
...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |    2 +-
...86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml |    2 +-
.../x86_64-cpuid-Xeon-E3-1225-v5-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E3-1245-v5-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E5-2609-v3-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E5-2623-v4-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E5-2630-v3-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E5-2630-v4-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E5-2650-host.xml        |    2 +-
.../x86_64-cpuid-Xeon-E5-2650-v3-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E5-2650-v4-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E7-4820-host.xml        |    2 +-
.../x86_64-cpuid-Xeon-E7-4830-host.xml        |    2 +-
.../x86_64-cpuid-Xeon-E7-8890-v3-host.xml     |    2 +-
.../x86_64-cpuid-Xeon-E7540-host.xml          |    2 +-
.../x86_64-cpuid-Xeon-Gold-5115-host.xml      |    2 +-
.../x86_64-cpuid-Xeon-Gold-6130-host.xml      |    2 +-
.../x86_64-cpuid-Xeon-Gold-6148-host.xml      |    2 +-
.../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |    2 +-
.../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |    2 +-
.../x86_64-cpuid-Xeon-W3520-host.xml          |    2 +-
.../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  462 ++++-
.../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml  |  836 +++++++++-
tests/domaincapsdata/qemu_5.2.0.x86_64.xml    |  462 ++++-
.../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  477 +++++-
.../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml  |  896 +++++++++-
tests/domaincapsdata/qemu_6.0.0.x86_64.xml    |  477 +++++-
.../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  576 ++++++-
.../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml  | 1458 +++++++++++++---
tests/domaincapsdata/qemu_6.1.0.x86_64.xml    |  576 ++++++-
.../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  583 ++++++-
.../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml  | 1461 +++++++++++++---
tests/domaincapsdata/qemu_6.2.0.x86_64.xml    |  583 ++++++-
.../domaincapsdata/qemu_7.0.0-q35.x86_64.xml  |  609 ++++++-
.../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml  | 1485 ++++++++++++++---
tests/domaincapsdata/qemu_7.0.0.x86_64.xml    |  609 ++++++-
.../domaincapsdata/qemu_7.1.0-q35.x86_64.xml  |  609 ++++++-
.../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml  | 1425 +++++++++++++---
tests/domaincapsdata/qemu_7.1.0.x86_64.xml    |  609 ++++++-
.../domaincapsdata/qemu_7.2.0-q35.x86_64.xml  |  609 ++++++-
.../qemu_7.2.0-tcg.x86_64+hvf.xml             |  979 ++++++++++-
.../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml  |  979 ++++++++++-
tests/domaincapsdata/qemu_7.2.0.x86_64.xml    |  609 ++++++-
.../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  |  652 +++++++-
.../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml  | 1015 ++++++++++-
tests/domaincapsdata/qemu_8.0.0.x86_64.xml    |  652 +++++++-
.../domaincapsdata/qemu_8.1.0-q35.x86_64.xml  |  815 ++++++++-
.../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml  | 1063 +++++++++++-
tests/domaincapsdata/qemu_8.1.0.x86_64.xml    |  815 ++++++++-
.../domaincapsdata/qemu_8.2.0-q35.x86_64.xml  |  815 ++++++++-
.../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml  |  959 ++++++++++-
tests/domaincapsdata/qemu_8.2.0.x86_64.xml    |  815 ++++++++-
.../domaincapsdata/qemu_9.0.0-q35.x86_64.xml  |  815 ++++++++-
.../domaincapsdata/qemu_9.0.0-tcg.x86_64.xml  |  915 +++++++++-
tests/domaincapsdata/qemu_9.0.0.x86_64.xml    |  815 ++++++++-
.../domaincapsdata/qemu_9.1.0-q35.x86_64.xml  |  922 +++++++++-
.../domaincapsdata/qemu_9.1.0-tcg.x86_64.xml  | 1139 +++++++++++--
tests/domaincapsdata/qemu_9.1.0.x86_64.xml    |  922 +++++++++-
.../domaincapsdata/qemu_9.2.0-q35.x86_64.xml  |  922 +++++++++-
.../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml  | 1139 +++++++++++--
tests/domaincapsdata/qemu_9.2.0.x86_64.xml    |  922 +++++++++-
166 files changed, 35711 insertions(+), 2629 deletions(-)
create mode 100644 src/cpu_map/x86_Broadwell-v1.xml
create mode 100644 src/cpu_map/x86_Broadwell-v2.xml
create mode 100644 src/cpu_map/x86_Broadwell-v3.xml
create mode 100644 src/cpu_map/x86_Broadwell-v4.xml
create mode 100644 src/cpu_map/x86_Cascadelake-Server-v1.xml
create mode 100644 src/cpu_map/x86_Cascadelake-Server-v2.xml
create mode 100644 src/cpu_map/x86_Cascadelake-Server-v3.xml
create mode 100644 src/cpu_map/x86_Cascadelake-Server-v4.xml
create mode 100644 src/cpu_map/x86_Cascadelake-Server-v5.xml
create mode 100644 src/cpu_map/x86_Cooperlake-v1.xml
create mode 100644 src/cpu_map/x86_Cooperlake-v2.xml
create mode 100644 src/cpu_map/x86_Denverton-v1.xml
create mode 100644 src/cpu_map/x86_Denverton-v2.xml
create mode 100644 src/cpu_map/x86_Denverton-v3.xml
create mode 100644 src/cpu_map/x86_Denverton.xml
create mode 100644 src/cpu_map/x86_Dhyana-v1.xml
create mode 100644 src/cpu_map/x86_Dhyana-v2.xml
create mode 100644 src/cpu_map/x86_EPYC-Milan-v1.xml
create mode 100644 src/cpu_map/x86_EPYC-Milan-v2.xml
create mode 100644 src/cpu_map/x86_EPYC-Rome-v1.xml
create mode 100644 src/cpu_map/x86_EPYC-Rome-v2.xml
create mode 100644 src/cpu_map/x86_EPYC-Rome-v3.xml
create mode 100644 src/cpu_map/x86_EPYC-Rome-v4.xml
create mode 100644 src/cpu_map/x86_EPYC-v1.xml
create mode 100644 src/cpu_map/x86_EPYC-v2.xml
create mode 100644 src/cpu_map/x86_EPYC-v3.xml
create mode 100644 src/cpu_map/x86_EPYC-v4.xml
create mode 100644 src/cpu_map/x86_GraniteRapids-v1.xml
create mode 100644 src/cpu_map/x86_Haswell-v1.xml
create mode 100644 src/cpu_map/x86_Haswell-v2.xml
create mode 100644 src/cpu_map/x86_Haswell-v3.xml
create mode 100644 src/cpu_map/x86_Haswell-v4.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v1.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v2.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v3.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v4.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v5.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v6.xml
create mode 100644 src/cpu_map/x86_Icelake-Server-v7.xml
create mode 100644 src/cpu_map/x86_IvyBridge-v1.xml
create mode 100644 src/cpu_map/x86_IvyBridge-v2.xml
create mode 100644 src/cpu_map/x86_KnightsMill.xml
create mode 100644 src/cpu_map/x86_Nehalem-v1.xml
create mode 100644 src/cpu_map/x86_Nehalem-v2.xml
create mode 100644 src/cpu_map/x86_SandyBridge-v1.xml
create mode 100644 src/cpu_map/x86_SandyBridge-v2.xml
create mode 100644 src/cpu_map/x86_SapphireRapids-v1.xml
create mode 100644 src/cpu_map/x86_SapphireRapids-v2.xml
create mode 100644 src/cpu_map/x86_SapphireRapids-v3.xml
create mode 100644 src/cpu_map/x86_SierraForest-v1.xml
create mode 100644 src/cpu_map/x86_Skylake-Client-v1.xml
create mode 100644 src/cpu_map/x86_Skylake-Client-v2.xml
create mode 100644 src/cpu_map/x86_Skylake-Client-v3.xml
create mode 100644 src/cpu_map/x86_Skylake-Client-v4.xml
create mode 100644 src/cpu_map/x86_Skylake-Server-v1.xml
create mode 100644 src/cpu_map/x86_Skylake-Server-v2.xml
create mode 100644 src/cpu_map/x86_Skylake-Server-v3.xml
create mode 100644 src/cpu_map/x86_Skylake-Server-v4.xml
create mode 100644 src/cpu_map/x86_Skylake-Server-v5.xml
create mode 100644 src/cpu_map/x86_Snowridge-v1.xml
create mode 100644 src/cpu_map/x86_Snowridge-v2.xml
create mode 100644 src/cpu_map/x86_Snowridge-v3.xml
create mode 100644 src/cpu_map/x86_Snowridge-v4.xml
create mode 100644 src/cpu_map/x86_Westmere-v1.xml
create mode 100644 src/cpu_map/x86_Westmere-v2.xml
[PATCH v2 00/36] Add support for versioned CPU models
Posted by Jiri Denemark 2 weeks ago
Each CPU model with -v* suffix is defined as a standalone model copying
all attributes of the previous version although CPU model versions with
an alias are handled differently. The full definition is used for the
alias and the versioned model is created as an identical copy of the
alias.

To avoid breaking migration compatibility of host-model CPUs all
versioned models are marked with <decode guest='off'/> so that they are
ignored when selecting candidates for host-model. It's not ideal but not
doing so would break almost all host-model CPUs as the new versioned CPU
models have all vmx-* features included since their introduction while
existing CPU models were updated later. This meas existing models would
be accompanied with a long list of vmx-* features to properly describe a
host CPU while the newly added CPU models would have those features
enabled implicitly and their list of features would be significantly
shorter. Thus the new models would always be better candidates for
host-model than the existing models.


Version 2:
  - removed patches
    - cpu_x86: Copy added and removed features from ancestor
    - qemu: Canonicalize CPU models

  - new patches
    - cpu_x86: Annotate virCPUx86Model fields
    - cpu_x86: Promote added/removed from ancestor
    - cpu_x86: Record relations between CPU models
    - cpu: Introduce virCPUGetCanonicalModel
    - domain_capabilities: Report canonical names of CPU models
    - cpu_map: Add Denverton CPU model
    - cpu_map: Add KnightsMill CPU model

  - make -v? variants linked to their corresponding non-versioned models
    (such as -noTSX, -IBRS, etc.)
  - all -v? variants are marked with <decode host='on' guest='off'/>
  - do not add absolute path to CPU model XMLs to index.xml
  - use <group name='...'> for all groups rather than a strange mix of
    <group name='...'> and <group vendor='...'>


Jiri Denemark (36):
  cpu_x86: Annotate virCPUx86Model fields
  cpu_x86: Promote added/removed from ancestor
  sync_qemu_features_i386: Add some removed features back
  sync_qemu_models_i386: Use f-strings
  sync_qemu_models_i386: Do not overwrite existing models
  sync_qemu_models_i386: Do not require full path to QEMU's cpu.c
  sync_qemu_models_i386: Add support for versioned CPU models
  sync_qemu_models_i386: Store extra info in a separate file
  sync_qemu_models_i386: Switch to lxml
  cpu_map: Properly group models in index.xml
  sync_qemu_models_i386: Update index.xml
  sync_qemu_models_i386: Copy signatures from base model
  cpu_x86: Record relations between CPU models
  cpu: Introduce virCPUGetCanonicalModel
  domain_capabilities: Report canonical names of CPU models
  cpu_map: Add versions of SierraForest CPU model
  cpu_map: Add versions of GraniteRapids CPU model
  cpu_map: Add versions of SapphireRapids CPU model
  cpu_map: Add versions of Snowridge CPU model
  cpu_map: Add versions of Cooperlake CPU model
  cpu_map: Add versions of Icelake-Server CPU model
  cpu_map: Add versions of Cascadelake-Server CPU model
  cpu_map: Add versions of Skylake-Server CPU model
  cpu_map: Add versions of Skylake-Client CPU model
  cpu_map: Add versions of Broadwell CPU model
  cpu_map: Add versions of Haswell CPU model
  cpu_map: Add versions of IvyBridge CPU model
  cpu_map: Add versions of SandyBridge CPU model
  cpu_map: Add versions of Westmere CPU model
  cpu_map: Add versions of Nehalem CPU model
  cpu_map: Add versions of EPYC-Milan CPU model
  cpu_map: Add versions of EPYC-Rome CPU model
  cpu_map: Add versions of EPYC CPU model
  cpu_map: Add versions of Dhyana CPU model
  cpu_map: Add Denverton CPU model
  cpu_map: Add KnightsMill CPU model

 docs/formatdomaincaps.rst                     |    8 +-
 src/conf/domain_capabilities.c                |   11 +-
 src/conf/domain_capabilities.h                |    4 +-
 src/cpu/cpu.c                                 |   25 +
 src/cpu/cpu.h                                 |    8 +
 src/cpu/cpu_map.c                             |    2 +-
 src/cpu/cpu_x86.c                             |   88 +-
 src/cpu_map/index.xml                         |  291 ++--
 src/cpu_map/meson.build                       |   60 +
 src/cpu_map/sync_qemu_features_i386.py        |    3 +
 src/cpu_map/sync_qemu_models_i386.py          |  184 +-
 src/cpu_map/x86_Broadwell-v1.xml              |    6 +
 src/cpu_map/x86_Broadwell-v2.xml              |    6 +
 src/cpu_map/x86_Broadwell-v3.xml              |    6 +
 src/cpu_map/x86_Broadwell-v4.xml              |    6 +
 src/cpu_map/x86_Cascadelake-Server-v1.xml     |    6 +
 src/cpu_map/x86_Cascadelake-Server-v2.xml     |  157 ++
 src/cpu_map/x86_Cascadelake-Server-v3.xml     |    6 +
 src/cpu_map/x86_Cascadelake-Server-v4.xml     |  156 ++
 src/cpu_map/x86_Cascadelake-Server-v5.xml     |  158 ++
 src/cpu_map/x86_Cooperlake-v1.xml             |    6 +
 src/cpu_map/x86_Cooperlake-v2.xml             |  164 ++
 src/cpu_map/x86_Denverton-v1.xml              |    6 +
 src/cpu_map/x86_Denverton-v2.xml              |  137 ++
 src/cpu_map/x86_Denverton-v3.xml              |  139 ++
 src/cpu_map/x86_Denverton.xml                 |  138 ++
 src/cpu_map/x86_Dhyana-v1.xml                 |    6 +
 src/cpu_map/x86_Dhyana-v2.xml                 |   73 +
 src/cpu_map/x86_EPYC-Milan-v1.xml             |    6 +
 src/cpu_map/x86_EPYC-Milan-v2.xml             |   99 ++
 src/cpu_map/x86_EPYC-Rome-v1.xml              |    6 +
 src/cpu_map/x86_EPYC-Rome-v2.xml              |   86 +
 src/cpu_map/x86_EPYC-Rome-v3.xml              |   86 +
 src/cpu_map/x86_EPYC-Rome-v4.xml              |   85 +
 src/cpu_map/x86_EPYC-v1.xml                   |    6 +
 src/cpu_map/x86_EPYC-v2.xml                   |    6 +
 src/cpu_map/x86_EPYC-v3.xml                   |   79 +
 src/cpu_map/x86_EPYC-v4.xml                   |   79 +
 src/cpu_map/x86_GraniteRapids-v1.xml          |    6 +
 src/cpu_map/x86_Haswell-v1.xml                |    6 +
 src/cpu_map/x86_Haswell-v2.xml                |    6 +
 src/cpu_map/x86_Haswell-v3.xml                |    6 +
 src/cpu_map/x86_Haswell-v4.xml                |    6 +
 src/cpu_map/x86_Icelake-Server-v1.xml         |    6 +
 src/cpu_map/x86_Icelake-Server-v2.xml         |    6 +
 src/cpu_map/x86_Icelake-Server-v3.xml         |  165 ++
 src/cpu_map/x86_Icelake-Server-v4.xml         |  172 ++
 src/cpu_map/x86_Icelake-Server-v5.xml         |  174 ++
 src/cpu_map/x86_Icelake-Server-v6.xml         |  175 ++
 src/cpu_map/x86_Icelake-Server-v7.xml         |  177 ++
 src/cpu_map/x86_IvyBridge-v1.xml              |    6 +
 src/cpu_map/x86_IvyBridge-v2.xml              |    6 +
 src/cpu_map/x86_KnightsMill.xml               |   71 +
 src/cpu_map/x86_Nehalem-v1.xml                |    6 +
 src/cpu_map/x86_Nehalem-v2.xml                |    6 +
 src/cpu_map/x86_SandyBridge-v1.xml            |    6 +
 src/cpu_map/x86_SandyBridge-v2.xml            |    6 +
 src/cpu_map/x86_SapphireRapids-v1.xml         |    6 +
 src/cpu_map/x86_SapphireRapids-v2.xml         |  193 +++
 src/cpu_map/x86_SapphireRapids-v3.xml         |  198 +++
 src/cpu_map/x86_SierraForest-v1.xml           |    6 +
 src/cpu_map/x86_Skylake-Client-v1.xml         |    6 +
 src/cpu_map/x86_Skylake-Client-v2.xml         |    6 +
 src/cpu_map/x86_Skylake-Client-v3.xml         |    6 +
 src/cpu_map/x86_Skylake-Client-v4.xml         |  141 ++
 src/cpu_map/x86_Skylake-Server-v1.xml         |    6 +
 src/cpu_map/x86_Skylake-Server-v2.xml         |    6 +
 src/cpu_map/x86_Skylake-Server-v3.xml         |    6 +
 src/cpu_map/x86_Skylake-Server-v4.xml         |  148 ++
 src/cpu_map/x86_Skylake-Server-v5.xml         |  150 ++
 src/cpu_map/x86_Snowridge-v1.xml              |    6 +
 src/cpu_map/x86_Snowridge-v2.xml              |  143 ++
 src/cpu_map/x86_Snowridge-v3.xml              |  145 ++
 src/cpu_map/x86_Snowridge-v4.xml              |  143 ++
 src/cpu_map/x86_Westmere-v1.xml               |    6 +
 src/cpu_map/x86_Westmere-v2.xml               |    6 +
 src/libvirt_private.syms                      |    1 +
 src/qemu/qemu_capabilities.c                  |   10 +-
 tests/cputest.c                               |    5 +-
 .../x86_64-cpuid-Atom-P5362-host.xml          |    2 +-
 .../x86_64-cpuid-Cooperlake-host.xml          |    2 +-
 .../x86_64-cpuid-Core-i5-2500-host.xml        |    2 +-
 .../x86_64-cpuid-Core-i5-2540M-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i5-4670T-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i5-650-host.xml         |    2 +-
 .../x86_64-cpuid-Core-i5-6600-host.xml        |    2 +-
 .../x86_64-cpuid-Core-i7-2600-host.xml        |    2 +-
 ...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |    2 +-
 .../x86_64-cpuid-Core-i7-3520M-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i7-3740QM-host.xml      |    2 +-
 .../x86_64-cpuid-Core-i7-3770-host.xml        |    2 +-
 .../x86_64-cpuid-Core-i7-4510U-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i7-4600U-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |    2 +-
 .../x86_64-cpuid-Core-i7-5600U-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |    2 +-
 .../x86_64-cpuid-Core-i7-7600U-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i7-7700-host.xml        |    2 +-
 .../x86_64-cpuid-Core-i7-8550U-host.xml       |    2 +-
 .../x86_64-cpuid-Core-i7-8700-host.xml        |    2 +-
 .../x86_64-cpuid-EPYC-7502-32-Core-host.xml   |    5 +-
 .../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |    2 +-
 ...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |    8 +-
 ...6_64-cpuid-Hygon-C86-7185-32-core-host.xml |    5 +-
 .../x86_64-cpuid-Ice-Lake-Server-host.xml     |    2 +-
 ...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |    2 +-
 ...86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml |    2 +-
 .../x86_64-cpuid-Xeon-E3-1225-v5-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E3-1245-v5-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E5-2609-v3-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E5-2623-v4-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E5-2630-v3-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E5-2630-v4-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E5-2650-host.xml        |    2 +-
 .../x86_64-cpuid-Xeon-E5-2650-v3-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E5-2650-v4-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E7-4820-host.xml        |    2 +-
 .../x86_64-cpuid-Xeon-E7-4830-host.xml        |    2 +-
 .../x86_64-cpuid-Xeon-E7-8890-v3-host.xml     |    2 +-
 .../x86_64-cpuid-Xeon-E7540-host.xml          |    2 +-
 .../x86_64-cpuid-Xeon-Gold-5115-host.xml      |    2 +-
 .../x86_64-cpuid-Xeon-Gold-6130-host.xml      |    2 +-
 .../x86_64-cpuid-Xeon-Gold-6148-host.xml      |    2 +-
 .../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |    2 +-
 .../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |    2 +-
 .../x86_64-cpuid-Xeon-W3520-host.xml          |    2 +-
 .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  462 ++++-
 .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml  |  836 +++++++++-
 tests/domaincapsdata/qemu_5.2.0.x86_64.xml    |  462 ++++-
 .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  477 +++++-
 .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml  |  896 +++++++++-
 tests/domaincapsdata/qemu_6.0.0.x86_64.xml    |  477 +++++-
 .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  576 ++++++-
 .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml  | 1458 +++++++++++++---
 tests/domaincapsdata/qemu_6.1.0.x86_64.xml    |  576 ++++++-
 .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  583 ++++++-
 .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml  | 1461 +++++++++++++---
 tests/domaincapsdata/qemu_6.2.0.x86_64.xml    |  583 ++++++-
 .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml  |  609 ++++++-
 .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml  | 1485 ++++++++++++++---
 tests/domaincapsdata/qemu_7.0.0.x86_64.xml    |  609 ++++++-
 .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml  |  609 ++++++-
 .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml  | 1425 +++++++++++++---
 tests/domaincapsdata/qemu_7.1.0.x86_64.xml    |  609 ++++++-
 .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml  |  609 ++++++-
 .../qemu_7.2.0-tcg.x86_64+hvf.xml             |  979 ++++++++++-
 .../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml  |  979 ++++++++++-
 tests/domaincapsdata/qemu_7.2.0.x86_64.xml    |  609 ++++++-
 .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  |  652 +++++++-
 .../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml  | 1015 ++++++++++-
 tests/domaincapsdata/qemu_8.0.0.x86_64.xml    |  652 +++++++-
 .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml  |  815 ++++++++-
 .../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml  | 1063 +++++++++++-
 tests/domaincapsdata/qemu_8.1.0.x86_64.xml    |  815 ++++++++-
 .../domaincapsdata/qemu_8.2.0-q35.x86_64.xml  |  815 ++++++++-
 .../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml  |  959 ++++++++++-
 tests/domaincapsdata/qemu_8.2.0.x86_64.xml    |  815 ++++++++-
 .../domaincapsdata/qemu_9.0.0-q35.x86_64.xml  |  815 ++++++++-
 .../domaincapsdata/qemu_9.0.0-tcg.x86_64.xml  |  915 +++++++++-
 tests/domaincapsdata/qemu_9.0.0.x86_64.xml    |  815 ++++++++-
 .../domaincapsdata/qemu_9.1.0-q35.x86_64.xml  |  922 +++++++++-
 .../domaincapsdata/qemu_9.1.0-tcg.x86_64.xml  | 1139 +++++++++++--
 tests/domaincapsdata/qemu_9.1.0.x86_64.xml    |  922 +++++++++-
 .../domaincapsdata/qemu_9.2.0-q35.x86_64.xml  |  922 +++++++++-
 .../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml  | 1139 +++++++++++--
 tests/domaincapsdata/qemu_9.2.0.x86_64.xml    |  922 +++++++++-
 166 files changed, 35711 insertions(+), 2629 deletions(-)
 create mode 100644 src/cpu_map/x86_Broadwell-v1.xml
 create mode 100644 src/cpu_map/x86_Broadwell-v2.xml
 create mode 100644 src/cpu_map/x86_Broadwell-v3.xml
 create mode 100644 src/cpu_map/x86_Broadwell-v4.xml
 create mode 100644 src/cpu_map/x86_Cascadelake-Server-v1.xml
 create mode 100644 src/cpu_map/x86_Cascadelake-Server-v2.xml
 create mode 100644 src/cpu_map/x86_Cascadelake-Server-v3.xml
 create mode 100644 src/cpu_map/x86_Cascadelake-Server-v4.xml
 create mode 100644 src/cpu_map/x86_Cascadelake-Server-v5.xml
 create mode 100644 src/cpu_map/x86_Cooperlake-v1.xml
 create mode 100644 src/cpu_map/x86_Cooperlake-v2.xml
 create mode 100644 src/cpu_map/x86_Denverton-v1.xml
 create mode 100644 src/cpu_map/x86_Denverton-v2.xml
 create mode 100644 src/cpu_map/x86_Denverton-v3.xml
 create mode 100644 src/cpu_map/x86_Denverton.xml
 create mode 100644 src/cpu_map/x86_Dhyana-v1.xml
 create mode 100644 src/cpu_map/x86_Dhyana-v2.xml
 create mode 100644 src/cpu_map/x86_EPYC-Milan-v1.xml
 create mode 100644 src/cpu_map/x86_EPYC-Milan-v2.xml
 create mode 100644 src/cpu_map/x86_EPYC-Rome-v1.xml
 create mode 100644 src/cpu_map/x86_EPYC-Rome-v2.xml
 create mode 100644 src/cpu_map/x86_EPYC-Rome-v3.xml
 create mode 100644 src/cpu_map/x86_EPYC-Rome-v4.xml
 create mode 100644 src/cpu_map/x86_EPYC-v1.xml
 create mode 100644 src/cpu_map/x86_EPYC-v2.xml
 create mode 100644 src/cpu_map/x86_EPYC-v3.xml
 create mode 100644 src/cpu_map/x86_EPYC-v4.xml
 create mode 100644 src/cpu_map/x86_GraniteRapids-v1.xml
 create mode 100644 src/cpu_map/x86_Haswell-v1.xml
 create mode 100644 src/cpu_map/x86_Haswell-v2.xml
 create mode 100644 src/cpu_map/x86_Haswell-v3.xml
 create mode 100644 src/cpu_map/x86_Haswell-v4.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v1.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v2.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v3.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v4.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v5.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v6.xml
 create mode 100644 src/cpu_map/x86_Icelake-Server-v7.xml
 create mode 100644 src/cpu_map/x86_IvyBridge-v1.xml
 create mode 100644 src/cpu_map/x86_IvyBridge-v2.xml
 create mode 100644 src/cpu_map/x86_KnightsMill.xml
 create mode 100644 src/cpu_map/x86_Nehalem-v1.xml
 create mode 100644 src/cpu_map/x86_Nehalem-v2.xml
 create mode 100644 src/cpu_map/x86_SandyBridge-v1.xml
 create mode 100644 src/cpu_map/x86_SandyBridge-v2.xml
 create mode 100644 src/cpu_map/x86_SapphireRapids-v1.xml
 create mode 100644 src/cpu_map/x86_SapphireRapids-v2.xml
 create mode 100644 src/cpu_map/x86_SapphireRapids-v3.xml
 create mode 100644 src/cpu_map/x86_SierraForest-v1.xml
 create mode 100644 src/cpu_map/x86_Skylake-Client-v1.xml
 create mode 100644 src/cpu_map/x86_Skylake-Client-v2.xml
 create mode 100644 src/cpu_map/x86_Skylake-Client-v3.xml
 create mode 100644 src/cpu_map/x86_Skylake-Client-v4.xml
 create mode 100644 src/cpu_map/x86_Skylake-Server-v1.xml
 create mode 100644 src/cpu_map/x86_Skylake-Server-v2.xml
 create mode 100644 src/cpu_map/x86_Skylake-Server-v3.xml
 create mode 100644 src/cpu_map/x86_Skylake-Server-v4.xml
 create mode 100644 src/cpu_map/x86_Skylake-Server-v5.xml
 create mode 100644 src/cpu_map/x86_Snowridge-v1.xml
 create mode 100644 src/cpu_map/x86_Snowridge-v2.xml
 create mode 100644 src/cpu_map/x86_Snowridge-v3.xml
 create mode 100644 src/cpu_map/x86_Snowridge-v4.xml
 create mode 100644 src/cpu_map/x86_Westmere-v1.xml
 create mode 100644 src/cpu_map/x86_Westmere-v2.xml

-- 
2.47.0
Re: [PATCH v2 00/36] Add support for versioned CPU models
Posted by Han Han 1 week, 3 days ago
Hi Jiri,
I patched these patches to v10.9.0-159-ge9b8be23f7 then built and installed
the rpms. After that, I hit an error when start a domain with host-model
cpu:

Version:
libvirt v10.9.0-159-ge9b8be23f7 with this patch series
qemu-kvm-9.1.0-5.el9.x86_64
host CPU: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz

Here is how I build it:
# curl
https://patchew.org/Libvirt/cover.1732311125.git.jdenemar@redhat.com/mbox
-o /tmp/mbox && git am /tmp/mbox
# meson build
# meson dist -C build --no-tests
# cp build/libvirt.spec ~/rpmbuild/SPECS
# cp build/meson-dist/libvirt-10.10.0.tar.xz ~/rpmbuild/SOURCES
# rpmbuild -ba ~/rpmbuild/SPECS/libvirt.spec --nocheck
# dnf update ~/rpmbuild/RPMS/x86_64/libvirt*10.10.0-1* -y

Then start a domain with host-model cpu:
➜  ~ virsh start rhel10-sebios


error: Failed to start domain 'rhel10-sebios'
error: XML error: failed to parse xml document
'/usr/share/libvirt/cpu_map/x86_Denverton.xml

For the virtqemud.log and the guest XML. Please check it in the attachment.

On Sat, Nov 23, 2024 at 5:34 AM Jiri Denemark <jdenemar@redhat.com> wrote:

> Each CPU model with -v* suffix is defined as a standalone model copying
> all attributes of the previous version although CPU model versions with
> an alias are handled differently. The full definition is used for the
> alias and the versioned model is created as an identical copy of the
> alias.
>
> To avoid breaking migration compatibility of host-model CPUs all
> versioned models are marked with <decode guest='off'/> so that they are
> ignored when selecting candidates for host-model. It's not ideal but not
> doing so would break almost all host-model CPUs as the new versioned CPU
> models have all vmx-* features included since their introduction while
> existing CPU models were updated later. This meas existing models would
> be accompanied with a long list of vmx-* features to properly describe a
> host CPU while the newly added CPU models would have those features
> enabled implicitly and their list of features would be significantly
> shorter. Thus the new models would always be better candidates for
> host-model than the existing models.
>
>
> Version 2:
>   - removed patches
>     - cpu_x86: Copy added and removed features from ancestor
>     - qemu: Canonicalize CPU models
>
>   - new patches
>     - cpu_x86: Annotate virCPUx86Model fields
>     - cpu_x86: Promote added/removed from ancestor
>     - cpu_x86: Record relations between CPU models
>     - cpu: Introduce virCPUGetCanonicalModel
>     - domain_capabilities: Report canonical names of CPU models
>     - cpu_map: Add Denverton CPU model
>     - cpu_map: Add KnightsMill CPU model
>
>   - make -v? variants linked to their corresponding non-versioned models
>     (such as -noTSX, -IBRS, etc.)
>   - all -v? variants are marked with <decode host='on' guest='off'/>
>   - do not add absolute path to CPU model XMLs to index.xml
>   - use <group name='...'> for all groups rather than a strange mix of
>     <group name='...'> and <group vendor='...'>
>
>
> Jiri Denemark (36):
>   cpu_x86: Annotate virCPUx86Model fields
>   cpu_x86: Promote added/removed from ancestor
>   sync_qemu_features_i386: Add some removed features back
>   sync_qemu_models_i386: Use f-strings
>   sync_qemu_models_i386: Do not overwrite existing models
>   sync_qemu_models_i386: Do not require full path to QEMU's cpu.c
>   sync_qemu_models_i386: Add support for versioned CPU models
>   sync_qemu_models_i386: Store extra info in a separate file
>   sync_qemu_models_i386: Switch to lxml
>   cpu_map: Properly group models in index.xml
>   sync_qemu_models_i386: Update index.xml
>   sync_qemu_models_i386: Copy signatures from base model
>   cpu_x86: Record relations between CPU models
>   cpu: Introduce virCPUGetCanonicalModel
>   domain_capabilities: Report canonical names of CPU models
>   cpu_map: Add versions of SierraForest CPU model
>   cpu_map: Add versions of GraniteRapids CPU model
>   cpu_map: Add versions of SapphireRapids CPU model
>   cpu_map: Add versions of Snowridge CPU model
>   cpu_map: Add versions of Cooperlake CPU model
>   cpu_map: Add versions of Icelake-Server CPU model
>   cpu_map: Add versions of Cascadelake-Server CPU model
>   cpu_map: Add versions of Skylake-Server CPU model
>   cpu_map: Add versions of Skylake-Client CPU model
>   cpu_map: Add versions of Broadwell CPU model
>   cpu_map: Add versions of Haswell CPU model
>   cpu_map: Add versions of IvyBridge CPU model
>   cpu_map: Add versions of SandyBridge CPU model
>   cpu_map: Add versions of Westmere CPU model
>   cpu_map: Add versions of Nehalem CPU model
>   cpu_map: Add versions of EPYC-Milan CPU model
>   cpu_map: Add versions of EPYC-Rome CPU model
>   cpu_map: Add versions of EPYC CPU model
>   cpu_map: Add versions of Dhyana CPU model
>   cpu_map: Add Denverton CPU model
>   cpu_map: Add KnightsMill CPU model
>
>  docs/formatdomaincaps.rst                     |    8 +-
>  src/conf/domain_capabilities.c                |   11 +-
>  src/conf/domain_capabilities.h                |    4 +-
>  src/cpu/cpu.c                                 |   25 +
>  src/cpu/cpu.h                                 |    8 +
>  src/cpu/cpu_map.c                             |    2 +-
>  src/cpu/cpu_x86.c                             |   88 +-
>  src/cpu_map/index.xml                         |  291 ++--
>  src/cpu_map/meson.build                       |   60 +
>  src/cpu_map/sync_qemu_features_i386.py        |    3 +
>  src/cpu_map/sync_qemu_models_i386.py          |  184 +-
>  src/cpu_map/x86_Broadwell-v1.xml              |    6 +
>  src/cpu_map/x86_Broadwell-v2.xml              |    6 +
>  src/cpu_map/x86_Broadwell-v3.xml              |    6 +
>  src/cpu_map/x86_Broadwell-v4.xml              |    6 +
>  src/cpu_map/x86_Cascadelake-Server-v1.xml     |    6 +
>  src/cpu_map/x86_Cascadelake-Server-v2.xml     |  157 ++
>  src/cpu_map/x86_Cascadelake-Server-v3.xml     |    6 +
>  src/cpu_map/x86_Cascadelake-Server-v4.xml     |  156 ++
>  src/cpu_map/x86_Cascadelake-Server-v5.xml     |  158 ++
>  src/cpu_map/x86_Cooperlake-v1.xml             |    6 +
>  src/cpu_map/x86_Cooperlake-v2.xml             |  164 ++
>  src/cpu_map/x86_Denverton-v1.xml              |    6 +
>  src/cpu_map/x86_Denverton-v2.xml              |  137 ++
>  src/cpu_map/x86_Denverton-v3.xml              |  139 ++
>  src/cpu_map/x86_Denverton.xml                 |  138 ++
>  src/cpu_map/x86_Dhyana-v1.xml                 |    6 +
>  src/cpu_map/x86_Dhyana-v2.xml                 |   73 +
>  src/cpu_map/x86_EPYC-Milan-v1.xml             |    6 +
>  src/cpu_map/x86_EPYC-Milan-v2.xml             |   99 ++
>  src/cpu_map/x86_EPYC-Rome-v1.xml              |    6 +
>  src/cpu_map/x86_EPYC-Rome-v2.xml              |   86 +
>  src/cpu_map/x86_EPYC-Rome-v3.xml              |   86 +
>  src/cpu_map/x86_EPYC-Rome-v4.xml              |   85 +
>  src/cpu_map/x86_EPYC-v1.xml                   |    6 +
>  src/cpu_map/x86_EPYC-v2.xml                   |    6 +
>  src/cpu_map/x86_EPYC-v3.xml                   |   79 +
>  src/cpu_map/x86_EPYC-v4.xml                   |   79 +
>  src/cpu_map/x86_GraniteRapids-v1.xml          |    6 +
>  src/cpu_map/x86_Haswell-v1.xml                |    6 +
>  src/cpu_map/x86_Haswell-v2.xml                |    6 +
>  src/cpu_map/x86_Haswell-v3.xml                |    6 +
>  src/cpu_map/x86_Haswell-v4.xml                |    6 +
>  src/cpu_map/x86_Icelake-Server-v1.xml         |    6 +
>  src/cpu_map/x86_Icelake-Server-v2.xml         |    6 +
>  src/cpu_map/x86_Icelake-Server-v3.xml         |  165 ++
>  src/cpu_map/x86_Icelake-Server-v4.xml         |  172 ++
>  src/cpu_map/x86_Icelake-Server-v5.xml         |  174 ++
>  src/cpu_map/x86_Icelake-Server-v6.xml         |  175 ++
>  src/cpu_map/x86_Icelake-Server-v7.xml         |  177 ++
>  src/cpu_map/x86_IvyBridge-v1.xml              |    6 +
>  src/cpu_map/x86_IvyBridge-v2.xml              |    6 +
>  src/cpu_map/x86_KnightsMill.xml               |   71 +
>  src/cpu_map/x86_Nehalem-v1.xml                |    6 +
>  src/cpu_map/x86_Nehalem-v2.xml                |    6 +
>  src/cpu_map/x86_SandyBridge-v1.xml            |    6 +
>  src/cpu_map/x86_SandyBridge-v2.xml            |    6 +
>  src/cpu_map/x86_SapphireRapids-v1.xml         |    6 +
>  src/cpu_map/x86_SapphireRapids-v2.xml         |  193 +++
>  src/cpu_map/x86_SapphireRapids-v3.xml         |  198 +++
>  src/cpu_map/x86_SierraForest-v1.xml           |    6 +
>  src/cpu_map/x86_Skylake-Client-v1.xml         |    6 +
>  src/cpu_map/x86_Skylake-Client-v2.xml         |    6 +
>  src/cpu_map/x86_Skylake-Client-v3.xml         |    6 +
>  src/cpu_map/x86_Skylake-Client-v4.xml         |  141 ++
>  src/cpu_map/x86_Skylake-Server-v1.xml         |    6 +
>  src/cpu_map/x86_Skylake-Server-v2.xml         |    6 +
>  src/cpu_map/x86_Skylake-Server-v3.xml         |    6 +
>  src/cpu_map/x86_Skylake-Server-v4.xml         |  148 ++
>  src/cpu_map/x86_Skylake-Server-v5.xml         |  150 ++
>  src/cpu_map/x86_Snowridge-v1.xml              |    6 +
>  src/cpu_map/x86_Snowridge-v2.xml              |  143 ++
>  src/cpu_map/x86_Snowridge-v3.xml              |  145 ++
>  src/cpu_map/x86_Snowridge-v4.xml              |  143 ++
>  src/cpu_map/x86_Westmere-v1.xml               |    6 +
>  src/cpu_map/x86_Westmere-v2.xml               |    6 +
>  src/libvirt_private.syms                      |    1 +
>  src/qemu/qemu_capabilities.c                  |   10 +-
>  tests/cputest.c                               |    5 +-
>  .../x86_64-cpuid-Atom-P5362-host.xml          |    2 +-
>  .../x86_64-cpuid-Cooperlake-host.xml          |    2 +-
>  .../x86_64-cpuid-Core-i5-2500-host.xml        |    2 +-
>  .../x86_64-cpuid-Core-i5-2540M-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i5-4670T-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i5-650-host.xml         |    2 +-
>  .../x86_64-cpuid-Core-i5-6600-host.xml        |    2 +-
>  .../x86_64-cpuid-Core-i7-2600-host.xml        |    2 +-
>  ...86_64-cpuid-Core-i7-2600-xsaveopt-host.xml |    2 +-
>  .../x86_64-cpuid-Core-i7-3520M-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i7-3740QM-host.xml      |    2 +-
>  .../x86_64-cpuid-Core-i7-3770-host.xml        |    2 +-
>  .../x86_64-cpuid-Core-i7-4510U-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i7-4600U-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i7-5600U-arat-host.xml  |    2 +-
>  .../x86_64-cpuid-Core-i7-5600U-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i7-5600U-ibrs-host.xml  |    2 +-
>  .../x86_64-cpuid-Core-i7-7600U-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i7-7700-host.xml        |    2 +-
>  .../x86_64-cpuid-Core-i7-8550U-host.xml       |    2 +-
>  .../x86_64-cpuid-Core-i7-8700-host.xml        |    2 +-
>  .../x86_64-cpuid-EPYC-7502-32-Core-host.xml   |    5 +-
>  .../x86_64-cpuid-EPYC-7601-32-Core-host.xml   |    2 +-
>  ...6_64-cpuid-EPYC-7601-32-Core-ibpb-host.xml |    8 +-
>  ...6_64-cpuid-Hygon-C86-7185-32-core-host.xml |    5 +-
>  .../x86_64-cpuid-Ice-Lake-Server-host.xml     |    2 +-
>  ...64-cpuid-Ryzen-7-1800X-Eight-Core-host.xml |    2 +-
>  ...86_64-cpuid-Ryzen-9-3900X-12-Core-host.xml |    2 +-
>  .../x86_64-cpuid-Xeon-E3-1225-v5-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E3-1245-v5-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2609-v3-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2623-v4-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2630-v3-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2630-v4-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2650-host.xml        |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2650-v3-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E5-2650-v4-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E7-4820-host.xml        |    2 +-
>  .../x86_64-cpuid-Xeon-E7-4830-host.xml        |    2 +-
>  .../x86_64-cpuid-Xeon-E7-8890-v3-host.xml     |    2 +-
>  .../x86_64-cpuid-Xeon-E7540-host.xml          |    2 +-
>  .../x86_64-cpuid-Xeon-Gold-5115-host.xml      |    2 +-
>  .../x86_64-cpuid-Xeon-Gold-6130-host.xml      |    2 +-
>  .../x86_64-cpuid-Xeon-Gold-6148-host.xml      |    2 +-
>  .../x86_64-cpuid-Xeon-Platinum-8268-host.xml  |    2 +-
>  .../x86_64-cpuid-Xeon-Platinum-9242-host.xml  |    2 +-
>  .../x86_64-cpuid-Xeon-W3520-host.xml          |    2 +-
>  .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  462 ++++-
>  .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml  |  836 +++++++++-
>  tests/domaincapsdata/qemu_5.2.0.x86_64.xml    |  462 ++++-
>  .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  477 +++++-
>  .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml  |  896 +++++++++-
>  tests/domaincapsdata/qemu_6.0.0.x86_64.xml    |  477 +++++-
>  .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  576 ++++++-
>  .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml  | 1458 +++++++++++++---
>  tests/domaincapsdata/qemu_6.1.0.x86_64.xml    |  576 ++++++-
>  .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  583 ++++++-
>  .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml  | 1461 +++++++++++++---
>  tests/domaincapsdata/qemu_6.2.0.x86_64.xml    |  583 ++++++-
>  .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml  |  609 ++++++-
>  .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml  | 1485 ++++++++++++++---
>  tests/domaincapsdata/qemu_7.0.0.x86_64.xml    |  609 ++++++-
>  .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml  |  609 ++++++-
>  .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml  | 1425 +++++++++++++---
>  tests/domaincapsdata/qemu_7.1.0.x86_64.xml    |  609 ++++++-
>  .../domaincapsdata/qemu_7.2.0-q35.x86_64.xml  |  609 ++++++-
>  .../qemu_7.2.0-tcg.x86_64+hvf.xml             |  979 ++++++++++-
>  .../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml  |  979 ++++++++++-
>  tests/domaincapsdata/qemu_7.2.0.x86_64.xml    |  609 ++++++-
>  .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml  |  652 +++++++-
>  .../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml  | 1015 ++++++++++-
>  tests/domaincapsdata/qemu_8.0.0.x86_64.xml    |  652 +++++++-
>  .../domaincapsdata/qemu_8.1.0-q35.x86_64.xml  |  815 ++++++++-
>  .../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml  | 1063 +++++++++++-
>  tests/domaincapsdata/qemu_8.1.0.x86_64.xml    |  815 ++++++++-
>  .../domaincapsdata/qemu_8.2.0-q35.x86_64.xml  |  815 ++++++++-
>  .../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml  |  959 ++++++++++-
>  tests/domaincapsdata/qemu_8.2.0.x86_64.xml    |  815 ++++++++-
>  .../domaincapsdata/qemu_9.0.0-q35.x86_64.xml  |  815 ++++++++-
>  .../domaincapsdata/qemu_9.0.0-tcg.x86_64.xml  |  915 +++++++++-
>  tests/domaincapsdata/qemu_9.0.0.x86_64.xml    |  815 ++++++++-
>  .../domaincapsdata/qemu_9.1.0-q35.x86_64.xml  |  922 +++++++++-
>  .../domaincapsdata/qemu_9.1.0-tcg.x86_64.xml  | 1139 +++++++++++--
>  tests/domaincapsdata/qemu_9.1.0.x86_64.xml    |  922 +++++++++-
>  .../domaincapsdata/qemu_9.2.0-q35.x86_64.xml  |  922 +++++++++-
>  .../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml  | 1139 +++++++++++--
>  tests/domaincapsdata/qemu_9.2.0.x86_64.xml    |  922 +++++++++-
>  166 files changed, 35711 insertions(+), 2629 deletions(-)
>  create mode 100644 src/cpu_map/x86_Broadwell-v1.xml
>  create mode 100644 src/cpu_map/x86_Broadwell-v2.xml
>  create mode 100644 src/cpu_map/x86_Broadwell-v3.xml
>  create mode 100644 src/cpu_map/x86_Broadwell-v4.xml
>  create mode 100644 src/cpu_map/x86_Cascadelake-Server-v1.xml
>  create mode 100644 src/cpu_map/x86_Cascadelake-Server-v2.xml
>  create mode 100644 src/cpu_map/x86_Cascadelake-Server-v3.xml
>  create mode 100644 src/cpu_map/x86_Cascadelake-Server-v4.xml
>  create mode 100644 src/cpu_map/x86_Cascadelake-Server-v5.xml
>  create mode 100644 src/cpu_map/x86_Cooperlake-v1.xml
>  create mode 100644 src/cpu_map/x86_Cooperlake-v2.xml
>  create mode 100644 src/cpu_map/x86_Denverton-v1.xml
>  create mode 100644 src/cpu_map/x86_Denverton-v2.xml
>  create mode 100644 src/cpu_map/x86_Denverton-v3.xml
>  create mode 100644 src/cpu_map/x86_Denverton.xml
>  create mode 100644 src/cpu_map/x86_Dhyana-v1.xml
>  create mode 100644 src/cpu_map/x86_Dhyana-v2.xml
>  create mode 100644 src/cpu_map/x86_EPYC-Milan-v1.xml
>  create mode 100644 src/cpu_map/x86_EPYC-Milan-v2.xml
>  create mode 100644 src/cpu_map/x86_EPYC-Rome-v1.xml
>  create mode 100644 src/cpu_map/x86_EPYC-Rome-v2.xml
>  create mode 100644 src/cpu_map/x86_EPYC-Rome-v3.xml
>  create mode 100644 src/cpu_map/x86_EPYC-Rome-v4.xml
>  create mode 100644 src/cpu_map/x86_EPYC-v1.xml
>  create mode 100644 src/cpu_map/x86_EPYC-v2.xml
>  create mode 100644 src/cpu_map/x86_EPYC-v3.xml
>  create mode 100644 src/cpu_map/x86_EPYC-v4.xml
>  create mode 100644 src/cpu_map/x86_GraniteRapids-v1.xml
>  create mode 100644 src/cpu_map/x86_Haswell-v1.xml
>  create mode 100644 src/cpu_map/x86_Haswell-v2.xml
>  create mode 100644 src/cpu_map/x86_Haswell-v3.xml
>  create mode 100644 src/cpu_map/x86_Haswell-v4.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v1.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v2.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v3.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v4.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v5.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v6.xml
>  create mode 100644 src/cpu_map/x86_Icelake-Server-v7.xml
>  create mode 100644 src/cpu_map/x86_IvyBridge-v1.xml
>  create mode 100644 src/cpu_map/x86_IvyBridge-v2.xml
>  create mode 100644 src/cpu_map/x86_KnightsMill.xml
>  create mode 100644 src/cpu_map/x86_Nehalem-v1.xml
>  create mode 100644 src/cpu_map/x86_Nehalem-v2.xml
>  create mode 100644 src/cpu_map/x86_SandyBridge-v1.xml
>  create mode 100644 src/cpu_map/x86_SandyBridge-v2.xml
>  create mode 100644 src/cpu_map/x86_SapphireRapids-v1.xml
>  create mode 100644 src/cpu_map/x86_SapphireRapids-v2.xml
>  create mode 100644 src/cpu_map/x86_SapphireRapids-v3.xml
>  create mode 100644 src/cpu_map/x86_SierraForest-v1.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Client-v1.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Client-v2.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Client-v3.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Client-v4.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Server-v1.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Server-v2.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Server-v3.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Server-v4.xml
>  create mode 100644 src/cpu_map/x86_Skylake-Server-v5.xml
>  create mode 100644 src/cpu_map/x86_Snowridge-v1.xml
>  create mode 100644 src/cpu_map/x86_Snowridge-v2.xml
>  create mode 100644 src/cpu_map/x86_Snowridge-v3.xml
>  create mode 100644 src/cpu_map/x86_Snowridge-v4.xml
>  create mode 100644 src/cpu_map/x86_Westmere-v1.xml
>  create mode 100644 src/cpu_map/x86_Westmere-v2.xml
>
> --
> 2.47.0
>
>
Re: [PATCH v2 00/36] Add support for versioned CPU models
Posted by Jiri Denemark 1 week, 3 days ago
On Tue, Nov 26, 2024 at 14:36:55 +0800, Han Han wrote:
> Hi Jiri,
> I patched these patches to v10.9.0-159-ge9b8be23f7 then built and installed
> the rpms. After that, I hit an error when start a domain with host-model
> cpu:
> 
> Version:
> libvirt v10.9.0-159-ge9b8be23f7 with this patch series
> qemu-kvm-9.1.0-5.el9.x86_64
> host CPU: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
> 
> Here is how I build it:
> # curl
> https://patchew.org/Libvirt/cover.1732311125.git.jdenemar@redhat.com/mbox
> -o /tmp/mbox && git am /tmp/mbox
> # meson build
> # meson dist -C build --no-tests
> # cp build/libvirt.spec ~/rpmbuild/SPECS
> # cp build/meson-dist/libvirt-10.10.0.tar.xz ~/rpmbuild/SOURCES
> # rpmbuild -ba ~/rpmbuild/SPECS/libvirt.spec --nocheck
> # dnf update ~/rpmbuild/RPMS/x86_64/libvirt*10.10.0-1* -y
> 
> Then start a domain with host-model cpu:
> ➜  ~ virsh start rhel10-sebios
> 
> 
> error: Failed to start domain 'rhel10-sebios'
> error: XML error: failed to parse xml document
> '/usr/share/libvirt/cpu_map/x86_Denverton.xml
> 
> For the virtqemud.log and the guest XML. Please check it in the attachment.

Oh yeah, I forgot to update src/cpu_map/meson.build in the last two
patches (Denverton and KnightsMill). I fixed it in my gitlab repo:

git fetch https://gitlab.com/jirkade/libvirt.git cpu-versions

Jirka
Re: [PATCH v2 00/36] Add support for versioned CPU models
Posted by Han Han 1 week, 3 days ago
Hi Jiri, I meet a segment fault for sev-snp testing on this libvirt branch.
Here are the details:
Version:
qemu-kvm-9.1.0-4.el10.x86_64
kernel-6.12.0-30.el10.x86_64
host CPU: AMD EPYC 7313 16-Core Processor

Step:
0. Enable AMD SEV-SNP settings in BIOS and kernel. Make sure `sevctl ok`
pass.
1. Start a domain with sev-snp, EPYC-Milan-v2 CPU model
domain XML:
<domain type='kvm'>
...
  <currentMemory unit='KiB'>5120000</currentMemory>
  <memtune>
    <hard_limit unit='KiB'>5120000</hard_limit>
  </memtune>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-rhel10.0.0'>hvm</type>
    <loader type='rom'
stateless='yes'>/usr/share/edk2/ovmf/OVMF.amdsev.fd</loader>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <smm state='on'/>
  </features>
  <cpu mode='host-model' check='partial'>
    <model fallback='forbid'>EPYC-Milan-v2</model>
    <vendor>AMD</vendor>
    <maxphysaddr mode='passthrough' limit='43'/>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='tsc-deadline'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='vaes'/>
    <feature policy='require' name='vpclmulqdq'/>
    <feature policy='require' name='spec-ctrl'/>
    <feature policy='require' name='stibp'/>
    <feature policy='require' name='arch-capabilities'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='overflow-recov'/>
    <feature policy='require' name='succor'/>
    <feature policy='require' name='invtsc'/>
    <feature policy='require' name='stibp-always-on'/>
    <feature policy='require' name='virt-ssbd'/>
    <feature policy='require' name='amd-psfd'/>
    <feature policy='require' name='lbrv'/>
    <feature policy='require' name='tsc-scale'/>
    <feature policy='require' name='vmcb-clean'/>
    <feature policy='require' name='flushbyasid'/>
    <feature policy='require' name='pause-filter'/>
    <feature policy='require' name='pfthreshold'/>
    <feature policy='require' name='v-vmsave-vmload'/>
    <feature policy='require' name='vgif'/>
    <feature policy='require' name='no-nested-data-bp'/>
    <feature policy='require' name='lfence-always-serializing'/>
    <feature policy='require' name='null-sel-clr-base'/>
    <feature policy='require' name='rdctl-no'/>
    <feature policy='require' name='skip-l1dfl-vmentry'/>
    <feature policy='require' name='mds-no'/>
    <feature policy='require' name='pschange-mc-no'/>
    <feature policy='require' name='gds-no'/>
    <feature policy='require' name='rfds-no'/>
  </cpu>
...
  <launchSecurity type='sev-snp' kernelHashes='no'>
    <cbitpos>51</cbitpos>
    <reducedPhysBits>1</reducedPhysBits>
    <policy>0x00030000</policy>
  </launchSecurity>
</domain>

# virsh start sev-snp
error: Disconnected from qemu:///system due to end of file
error: Failed to start domain 'sev-snp'
error: End of file while reading data: Input/output error

# coredumpctl -1
TIME                         PID UID GID SIG     COREFILE EXE
  SIZE
Tue 2024-11-26 21:54:19 EST 5027   0   0 SIGSEGV present
 /usr/sbin/virtqemud   1M

Backtrace:
#0  0x00007f78a4824dbf in virCPUCompareUnusable
(arch=arch@entry=VIR_ARCH_X86_64,
host=host@entry=0x7f78840269e0, cpu=cpu@entry=0x7f788402ba80, blockers=0x0,
failIncompatible=failIncompatible@entry=true) at ../src/cpu/cpu.c:204
#1  0x00007f78904c10a6 in qemuDomainCheckCPU (arch=VIR_ARCH_X86_64,
virtType=VIR_DOMAIN_VIRT_KVM, qemuCaps=0x7f7884039020 [virQEMUCaps],
cpu=0x7f788402ba80, compatCPU=VIR_QEMU_CAPS_HOST_CPU_FULL,
failIncompatible=<optimized out>) at ../src/qemu/qemu_domain.c:11433
#2  0x00007f7890550200 in qemuProcessUpdateGuestCPU (def=0x7f78581a0880,
qemuCaps=0x7f7884039020 [virQEMUCaps], hostarch=VIR_ARCH_X86_64, flags=17)
at ../src/qemu/qemu_process.c:6368
#3  qemuProcessPrepareDomain (driver=driver@entry=0x7f78340195e0,
vm=vm@entry=0x7f7834352900 [virDomainObj], flags=flags@entry=17) at
../src/qemu/qemu_process.c:6800
#4  0x00007f7890556bb0 in qemuProcessStart (conn=0x7f788c428350,
driver=0x7f78340195e0, vm=0x7f7834352900 [virDomainObj], updatedCPU=0x0,
asyncJob=VIR_ASYNC_JOB_START, migrateFrom=0x0, migrateFd=-1,
migratePath=0x0, snapshot=0x0, vmop=VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
flags=17) at ../src/qemu/qemu_process.c:8304
#5  0x00007f789057a3d8 in qemuDomainObjStart.constprop.0
(conn=0x7f788c428350, driver=0x7f78340195e0, vm=0x7f7834352900
[virDomainObj], flags=0, asyncJob=<optimized out>) at
../src/qemu/qemu_driver.c:6336
#6  0x00007f78904d0d91 in qemuDomainCreateWithFlags (dom=0x7f7884053e30,
flags=0) at ../src/qemu/qemu_driver.c:6385
#7  0x00007f78a49132b9 in virDomainCreate (domain=domain@entry=0x7f7884053e30)
at ../src/libvirt-domain.c:7079
#8  0x0000556939de9df1 in remoteDispatchDomainCreate (server=0x55694c7a1360
[virNetServer], msg=0x55694c7a6090, client=<optimized out>,
rerr=0x7f78947fd9f0, args=0x7f788404fe70) at
src/remote/remote_daemon_dispatch_stubs.h:5050
#9  remoteDispatchDomainCreateHelper (server=0x55694c7a1360 [virNetServer],
client=<optimized out>, msg=0x55694c7a6090, rerr=0x7f78947fd9f0,
args=0x7f788404fe70, ret=0x0) at
src/remote/remote_daemon_dispatch_stubs.h:5029
#10 0x00007f78a4804f19 in virNetServerProgramDispatchCall
(prog=0x55694c79a000 [virNetServerProgram], server=0x55694c7a1360
[virNetServer], client=0x55694c7aaac0 [virNetServerClient],
msg=0x55694c7a6090) at ../src/rpc/virnetserverprogram.c:423
#11 virNetServerProgramDispatch (prog=0x55694c79a000 [virNetServerProgram],
server=server@entry=0x55694c7a1360 [virNetServer],
client=client@entry=0x55694c7aaac0
[virNetServerClient], msg=msg@entry=0x55694c7a6090) at
../src/rpc/virnetserverprogram.c:299
#12 0x00007f78a4805512 in virNetServerProcessMsg (srv=srv@entry=0x55694c7a1360
[virNetServer], client=0x55694c7aaac0 [virNetServerClient], prog=<optimized
out>, msg=0x55694c7a6090) at ../src/rpc/virnetserver.c:135
#13 0x00007f78a4805621 in virNetServerHandleJob (jobOpaque=0x55694c798710,
opaque=0x55694c7a1360) at ../src/rpc/virnetserver.c:155
#14 0x00007f78a473d225 in virThreadPoolWorker (opaque=<optimized out>) at
../src/util/virthreadpool.c:164
#15 0x00007f78a473c718 in virThreadHelper (data=<optimized out>) at
../src/util/virthread.c:256
#16 0x00007f78a40dfa29 in start_thread (arg=<optimized out>) at
pthread_create.c:447
#17 0x00007f78a414f4fc in clone3 () at
../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Attachment: the domain XML, the qemu log, full backtrace

On Tue, Nov 26, 2024 at 2:48 PM Jiri Denemark <jdenemar@redhat.com> wrote:

> On Tue, Nov 26, 2024 at 14:36:55 +0800, Han Han wrote:
> > Hi Jiri,
> > I patched these patches to v10.9.0-159-ge9b8be23f7 then built and
> installed
> > the rpms. After that, I hit an error when start a domain with host-model
> > cpu:
> >
> > Version:
> > libvirt v10.9.0-159-ge9b8be23f7 with this patch series
> > qemu-kvm-9.1.0-5.el9.x86_64
> > host CPU: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
> >
> > Here is how I build it:
> > # curl
> >
> https://patchew.org/Libvirt/cover.1732311125.git.jdenemar@redhat.com/mbox
> > -o /tmp/mbox && git am /tmp/mbox
> > # meson build
> > # meson dist -C build --no-tests
> > # cp build/libvirt.spec ~/rpmbuild/SPECS
> > # cp build/meson-dist/libvirt-10.10.0.tar.xz ~/rpmbuild/SOURCES
> > # rpmbuild -ba ~/rpmbuild/SPECS/libvirt.spec --nocheck
> > # dnf update ~/rpmbuild/RPMS/x86_64/libvirt*10.10.0-1* -y
> >
> > Then start a domain with host-model cpu:
> > ➜  ~ virsh start rhel10-sebios
> >
> >
> > error: Failed to start domain 'rhel10-sebios'
> > error: XML error: failed to parse xml document
> > '/usr/share/libvirt/cpu_map/x86_Denverton.xml
> >
> > For the virtqemud.log and the guest XML. Please check it in the
> attachment.
>
> Oh yeah, I forgot to update src/cpu_map/meson.build in the last two
> patches (Denverton and KnightsMill). I fixed it in my gitlab repo:
>
> git fetch https://gitlab.com/jirkade/libvirt.git cpu-versions
>
> Jirka
>
>
Re: [PATCH v2 00/36] Add support for versioned CPU models
Posted by Han Han 1 week, 2 days ago
Another segment fault:
➜  ~ virsh capabilities --xpath //cpu > /tmp/cpu.xml

➜  ~ virsh hypervisor-cpu-compare /tmp/cpu.xml
error: Disconnected from qemu:///system due to end of file
error: Failed to compare hypervisor CPU with /tmp/cpu.xml
error: End of file while reading data: Input/output error

Backtrace:
(gdb) bt
#0  virCPUCompareUnusable
    (arch=arch@entry=VIR_ARCH_X86_64, host=host@entry=0x7f28b83441a0,
cpu=cpu@entry=0x7f28fc012530, blockers=0x0,
failIncompatible=failIncompatible@entry=false)
    at ../src/cpu/cpu.c:198
#1  0x00007f2900cc400c in qemuDomainCheckCPU
    (arch=VIR_ARCH_X86_64, virtType=VIR_DOMAIN_VIRT_KVM,
qemuCaps=0x7f28b80fb1a0, cpu=0x7f28fc012530,
compatCPU=VIR_QEMU_CAPS_HOST_CPU_REPORTED, failIncompatible=<optimized
out>) at ../src/qemu/qemu_domain.c:11433
#2  0x00007f2900ce22a2 in qemuConnectCompareHypervisorCPU
    (conn=<optimized out>, emulator=<optimized out>, archStr=<optimized
out>, machine=0x0, virttypeStr=<optimized out>, xmlCPU=0x7f28fc006000
"<cpu>\n  <arch>x86_64</arch>\n  <model>Cascadelake-Server-v1</model>\n
 <vendor>Intel</vendor>\n  <microcode version=\"83900167\"/>\n  <signature
family=\"6\" model=\"85\" stepping=\"7\"/>\n  <counter name=\"tsc\" fr"...,
flags=0) at ../src/qemu/qemu_driver.c:11642
#3  0x00007f2915332855 in virConnectCompareHypervisorCPU
    (conn=0x7f28b8015b90, emulator=0x0, arch=0x0, machine=0x0,
virttype=0x0, xmlCPU=0x7f28fc006000 "<cpu>\n  <arch>x86_64</arch>\n
 <model>Cascadelake-Server-v1</model>\n  <vendor>Intel</vendor>\n
 <microcode version=\"83900167\"/>\n  <signature family=\"6\" model=\"85\"
stepping=\"7\"/>\n  <counter name=\"tsc\" fr"..., flags=0)
    at ../src/libvirt-host.c:1152
#4  0x0000564b7a33e087 in remoteDispatchConnectCompareHypervisorCPU
    (server=0x564b7ae62880, msg=0x564b7ae741b0, ret=0x7f28fc000b80,
args=0x7f28fc004ac0, rerr=0x7f2905ffe9a0, client=0x564b7ae713c0)
    at src/remote/remote_daemon_dispatch_stubs.h:373
#5  remoteDispatchConnectCompareHypervisorCPUHelper
    (server=0x564b7ae62880, client=0x564b7ae713c0, msg=0x564b7ae741b0,
rerr=0x7f2905ffe9a0, args=0x7f28fc004ac0, ret=0x7f28fc000b80)
    at src/remote/remote_daemon_dispatch_stubs.h:345
#6  0x00007f2915211b5c in virNetServerProgramDispatchCall
(msg=0x564b7ae741b0, client=0x564b7ae713c0, server=0x564b7ae62880,
prog=0x564b7ae63c10)
    at ../src/rpc/virnetserverprogram.c:423
#7  virNetServerProgramDispatch (prog=0x564b7ae63c10,
server=0x564b7ae62880, client=0x564b7ae713c0, msg=0x564b7ae741b0) at
../src/rpc/virnetserverprogram.c:299
#8  0x00007f29152198e8 in virNetServerProcessMsg (msg=<optimized out>,
prog=<optimized out>, client=<optimized out>, srv=0x564b7ae62880)
    at ../src/rpc/virnetserver.c:135
#9  virNetServerHandleJob (jobOpaque=0x564b7ae5f1b0, opaque=0x564b7ae62880)
at ../src/rpc/virnetserver.c:155
#10 0x00007f291514f423 in virThreadPoolWorker (opaque=<optimized out>) at
../src/util/virthreadpool.c:164
#11 0x00007f291514ec69 in virThreadHelper (data=<optimized out>) at
../src/util/virthread.c:256
#12 0x00007f2914a89e92 in start_thread () at /lib64/libc.so.6
#13 0x00007f2914b0ef20 in clone3 () at /lib64/libc.so.6

On Wed, Nov 27, 2024 at 10:56 AM Han Han <hhan@redhat.com> wrote:

> Hi Jiri, I meet a segment fault for sev-snp testing on this libvirt
> branch. Here are the details:
> Version:
> qemu-kvm-9.1.0-4.el10.x86_64
> kernel-6.12.0-30.el10.x86_64
> host CPU: AMD EPYC 7313 16-Core Processor
>
> Step:
> 0. Enable AMD SEV-SNP settings in BIOS and kernel. Make sure `sevctl ok`
> pass.
> 1. Start a domain with sev-snp, EPYC-Milan-v2 CPU model
> domain XML:
> <domain type='kvm'>
> ...
>   <currentMemory unit='KiB'>5120000</currentMemory>
>   <memtune>
>     <hard_limit unit='KiB'>5120000</hard_limit>
>   </memtune>
>   <vcpu placement='static'>4</vcpu>
>   <os>
>     <type arch='x86_64' machine='pc-q35-rhel10.0.0'>hvm</type>
>     <loader type='rom'
> stateless='yes'>/usr/share/edk2/ovmf/OVMF.amdsev.fd</loader>
>     <boot dev='hd'/>
>   </os>
>   <features>
>     <acpi/>
>     <apic/>
>     <smm state='on'/>
>   </features>
>   <cpu mode='host-model' check='partial'>
>     <model fallback='forbid'>EPYC-Milan-v2</model>
>     <vendor>AMD</vendor>
>     <maxphysaddr mode='passthrough' limit='43'/>
>     <feature policy='require' name='x2apic'/>
>     <feature policy='require' name='tsc-deadline'/>
>     <feature policy='require' name='hypervisor'/>
>     <feature policy='require' name='tsc_adjust'/>
>     <feature policy='require' name='vaes'/>
>     <feature policy='require' name='vpclmulqdq'/>
>     <feature policy='require' name='spec-ctrl'/>
>     <feature policy='require' name='stibp'/>
>     <feature policy='require' name='arch-capabilities'/>
>     <feature policy='require' name='ssbd'/>
>     <feature policy='require' name='cmp_legacy'/>
>     <feature policy='require' name='overflow-recov'/>
>     <feature policy='require' name='succor'/>
>     <feature policy='require' name='invtsc'/>
>     <feature policy='require' name='stibp-always-on'/>
>     <feature policy='require' name='virt-ssbd'/>
>     <feature policy='require' name='amd-psfd'/>
>     <feature policy='require' name='lbrv'/>
>     <feature policy='require' name='tsc-scale'/>
>     <feature policy='require' name='vmcb-clean'/>
>     <feature policy='require' name='flushbyasid'/>
>     <feature policy='require' name='pause-filter'/>
>     <feature policy='require' name='pfthreshold'/>
>     <feature policy='require' name='v-vmsave-vmload'/>
>     <feature policy='require' name='vgif'/>
>     <feature policy='require' name='no-nested-data-bp'/>
>     <feature policy='require' name='lfence-always-serializing'/>
>     <feature policy='require' name='null-sel-clr-base'/>
>     <feature policy='require' name='rdctl-no'/>
>     <feature policy='require' name='skip-l1dfl-vmentry'/>
>     <feature policy='require' name='mds-no'/>
>     <feature policy='require' name='pschange-mc-no'/>
>     <feature policy='require' name='gds-no'/>
>     <feature policy='require' name='rfds-no'/>
>   </cpu>
> ...
>   <launchSecurity type='sev-snp' kernelHashes='no'>
>     <cbitpos>51</cbitpos>
>     <reducedPhysBits>1</reducedPhysBits>
>     <policy>0x00030000</policy>
>   </launchSecurity>
> </domain>
>
> # virsh start sev-snp
> error: Disconnected from qemu:///system due to end of file
> error: Failed to start domain 'sev-snp'
> error: End of file while reading data: Input/output error
>
> # coredumpctl -1
> TIME                         PID UID GID SIG     COREFILE EXE
>     SIZE
> Tue 2024-11-26 21:54:19 EST 5027   0   0 SIGSEGV present
>  /usr/sbin/virtqemud   1M
>
> Backtrace:
> #0  0x00007f78a4824dbf in virCPUCompareUnusable (arch=arch@entry=VIR_ARCH_X86_64,
> host=host@entry=0x7f78840269e0, cpu=cpu@entry=0x7f788402ba80,
> blockers=0x0, failIncompatible=failIncompatible@entry=true) at
> ../src/cpu/cpu.c:204
> #1  0x00007f78904c10a6 in qemuDomainCheckCPU (arch=VIR_ARCH_X86_64,
> virtType=VIR_DOMAIN_VIRT_KVM, qemuCaps=0x7f7884039020 [virQEMUCaps],
> cpu=0x7f788402ba80, compatCPU=VIR_QEMU_CAPS_HOST_CPU_FULL,
> failIncompatible=<optimized out>) at ../src/qemu/qemu_domain.c:11433
> #2  0x00007f7890550200 in qemuProcessUpdateGuestCPU (def=0x7f78581a0880,
> qemuCaps=0x7f7884039020 [virQEMUCaps], hostarch=VIR_ARCH_X86_64, flags=17)
> at ../src/qemu/qemu_process.c:6368
> #3  qemuProcessPrepareDomain (driver=driver@entry=0x7f78340195e0,
> vm=vm@entry=0x7f7834352900 [virDomainObj], flags=flags@entry=17) at
> ../src/qemu/qemu_process.c:6800
> #4  0x00007f7890556bb0 in qemuProcessStart (conn=0x7f788c428350,
> driver=0x7f78340195e0, vm=0x7f7834352900 [virDomainObj], updatedCPU=0x0,
> asyncJob=VIR_ASYNC_JOB_START, migrateFrom=0x0, migrateFd=-1,
> migratePath=0x0, snapshot=0x0, vmop=VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
> flags=17) at ../src/qemu/qemu_process.c:8304
> #5  0x00007f789057a3d8 in qemuDomainObjStart.constprop.0
> (conn=0x7f788c428350, driver=0x7f78340195e0, vm=0x7f7834352900
> [virDomainObj], flags=0, asyncJob=<optimized out>) at
> ../src/qemu/qemu_driver.c:6336
> #6  0x00007f78904d0d91 in qemuDomainCreateWithFlags (dom=0x7f7884053e30,
> flags=0) at ../src/qemu/qemu_driver.c:6385
> #7  0x00007f78a49132b9 in virDomainCreate (domain=domain@entry=0x7f7884053e30)
> at ../src/libvirt-domain.c:7079
> #8  0x0000556939de9df1 in remoteDispatchDomainCreate
> (server=0x55694c7a1360 [virNetServer], msg=0x55694c7a6090,
> client=<optimized out>, rerr=0x7f78947fd9f0, args=0x7f788404fe70) at
> src/remote/remote_daemon_dispatch_stubs.h:5050
> #9  remoteDispatchDomainCreateHelper (server=0x55694c7a1360
> [virNetServer], client=<optimized out>, msg=0x55694c7a6090,
> rerr=0x7f78947fd9f0, args=0x7f788404fe70, ret=0x0) at
> src/remote/remote_daemon_dispatch_stubs.h:5029
> #10 0x00007f78a4804f19 in virNetServerProgramDispatchCall
> (prog=0x55694c79a000 [virNetServerProgram], server=0x55694c7a1360
> [virNetServer], client=0x55694c7aaac0 [virNetServerClient],
> msg=0x55694c7a6090) at ../src/rpc/virnetserverprogram.c:423
> #11 virNetServerProgramDispatch (prog=0x55694c79a000
> [virNetServerProgram], server=server@entry=0x55694c7a1360 [virNetServer],
> client=client@entry=0x55694c7aaac0 [virNetServerClient], msg=msg@entry=0x55694c7a6090)
> at ../src/rpc/virnetserverprogram.c:299
> #12 0x00007f78a4805512 in virNetServerProcessMsg (srv=srv@entry=0x55694c7a1360
> [virNetServer], client=0x55694c7aaac0 [virNetServerClient], prog=<optimized
> out>, msg=0x55694c7a6090) at ../src/rpc/virnetserver.c:135
> #13 0x00007f78a4805621 in virNetServerHandleJob (jobOpaque=0x55694c798710,
> opaque=0x55694c7a1360) at ../src/rpc/virnetserver.c:155
> #14 0x00007f78a473d225 in virThreadPoolWorker (opaque=<optimized out>) at
> ../src/util/virthreadpool.c:164
> #15 0x00007f78a473c718 in virThreadHelper (data=<optimized out>) at
> ../src/util/virthread.c:256
> #16 0x00007f78a40dfa29 in start_thread (arg=<optimized out>) at
> pthread_create.c:447
> #17 0x00007f78a414f4fc in clone3 () at
> ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
>
> Attachment: the domain XML, the qemu log, full backtrace
>
> On Tue, Nov 26, 2024 at 2:48 PM Jiri Denemark <jdenemar@redhat.com> wrote:
>
>> On Tue, Nov 26, 2024 at 14:36:55 +0800, Han Han wrote:
>> > Hi Jiri,
>> > I patched these patches to v10.9.0-159-ge9b8be23f7 then built and
>> installed
>> > the rpms. After that, I hit an error when start a domain with host-model
>> > cpu:
>> >
>> > Version:
>> > libvirt v10.9.0-159-ge9b8be23f7 with this patch series
>> > qemu-kvm-9.1.0-5.el9.x86_64
>> > host CPU: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
>> >
>> > Here is how I build it:
>> > # curl
>> >
>> https://patchew.org/Libvirt/cover.1732311125.git.jdenemar@redhat.com/mbox
>> > -o /tmp/mbox && git am /tmp/mbox
>> > # meson build
>> > # meson dist -C build --no-tests
>> > # cp build/libvirt.spec ~/rpmbuild/SPECS
>> > # cp build/meson-dist/libvirt-10.10.0.tar.xz ~/rpmbuild/SOURCES
>> > # rpmbuild -ba ~/rpmbuild/SPECS/libvirt.spec --nocheck
>> > # dnf update ~/rpmbuild/RPMS/x86_64/libvirt*10.10.0-1* -y
>> >
>> > Then start a domain with host-model cpu:
>> > ➜  ~ virsh start rhel10-sebios
>> >
>> >
>> > error: Failed to start domain 'rhel10-sebios'
>> > error: XML error: failed to parse xml document
>> > '/usr/share/libvirt/cpu_map/x86_Denverton.xml
>> >
>> > For the virtqemud.log and the guest XML. Please check it in the
>> attachment.
>>
>> Oh yeah, I forgot to update src/cpu_map/meson.build in the last two
>> patches (Denverton and KnightsMill). I fixed it in my gitlab repo:
>>
>> git fetch https://gitlab.com/jirkade/libvirt.git cpu-versions
>>
>> Jirka
>>
>>
Re: [PATCH v2 00/36] Add support for versioned CPU models
Posted by Jiri Denemark 1 week, 2 days ago
On Wed, Nov 27, 2024 at 15:17:59 +0800, Han Han wrote:
> Another segment fault:
> ➜  ~ virsh capabilities --xpath //cpu > /tmp/cpu.xml
> 
> ➜  ~ virsh hypervisor-cpu-compare /tmp/cpu.xml
> error: Disconnected from qemu:///system due to end of file
> error: Failed to compare hypervisor CPU with /tmp/cpu.xml
> error: End of file while reading data: Input/output error
> 
> Backtrace:
> (gdb) bt
> #0  virCPUCompareUnusable
>     (arch=arch@entry=VIR_ARCH_X86_64, host=host@entry=0x7f28b83441a0,
> cpu=cpu@entry=0x7f28fc012530, blockers=0x0,
> failIncompatible=failIncompatible@entry=false)
>     at ../src/cpu/cpu.c:198

Thanks, both are caused by the same bug. I've just sent a fix to the
list.

Jirka
Re: [PATCH v2 00/36] Add support for versioned CPU models
Posted by Daniel P. Berrangé 1 week, 3 days ago
On Fri, Nov 22, 2024 at 10:32:40PM +0100, Jiri Denemark wrote:
> Each CPU model with -v* suffix is defined as a standalone model copying
> all attributes of the previous version although CPU model versions with
> an alias are handled differently. The full definition is used for the
> alias and the versioned model is created as an identical copy of the
> alias.
> 
> To avoid breaking migration compatibility of host-model CPUs all
> versioned models are marked with <decode guest='off'/> so that they are
> ignored when selecting candidates for host-model. It's not ideal but not
> doing so would break almost all host-model CPUs as the new versioned CPU
> models have all vmx-* features included since their introduction while
> existing CPU models were updated later. This meas existing models would
> be accompanied with a long list of vmx-* features to properly describe a
> host CPU while the newly added CPU models would have those features
> enabled implicitly and their list of features would be significantly
> shorter. Thus the new models would always be better candidates for
> host-model than the existing models.
> 
> 
> Version 2:

For everything

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

but see my commentary against the "Denverton" patch.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|