[pve-devel] [PATCH v3 00/11] Add basics for custom CPU models
Stefan Reiter
s.reiter at proxmox.com
Thu Oct 3 16:56:15 CEST 2019
Based on the RFC and following on- and off-list discussion about custom CPU
models [0].
In essence, this revised patch allows a user to specify custom CPU models in
/etc/pve/cpu-models.conf (section-config style [1]), where VMs using that CPU
model inherit details from the definition. This removes any fragile
"auto-magical" CPU flag detection, while still giving the user a way to create
VMs with the best possible subset of CPU features maintaining live-migration
compatibility.
Includes the infrastructure for broadcasting supported CPU flags for each
cluster-node via the key-value store - this is not necessary for the
custom-cpu feature in particular, but I think could prove useful for
implementing the GUI part (e.g. show the user which flags are supported on which
nodes).
I intentionally wanted to send this series before starting any GUI or new API
work, to get some feedback if this approach works better than the cluster-cpu
one.
v2 -> v3:
* Shuffle some code between patches to make sure nothing breaks in-between
* Change "query_understood_cpu_flags" to use static file generated at compile
time of "pve-qemu"
* Fix "query_supported_cpu_flags" to accomodate tcg accelerator (instead of kvm
only). Also fix broadcast to set both variants, and better failure handling.
* Useful minimum value for phys-bits
* Rename/Negate property: "custom" -> "built-in"
* more/better comments, minor code/commit fixes as suggested by Thomas' review
v1 -> v2:
Quite a big change to v1. Once I began reusing the $cpu_fmt hash for both custom
CPU models and VM-specific settings, I realized the approach mentioned by Fabian
- to move some helpers from QemuServer to the new CPUConfig
- would actually make a lot of sense.
* Re-query supported CPU flags when QEMU/KVM updates (without needing to
restart pvestatd) using kvm_user_version
* Improve documentation and error handling on CPU flag querying helpers
* Rename CustomCPUConfig -> CPUConfig
* Extract some CPU helpers from QemuServer to CPUConfig
* Use cfs_ functions for IO, don't use 'bless'
* Merge $cpu_fmt for custom models and VM-specific CPU settings
* Rename 'basemodel' -> 'reported-model', only support default models as
reported (avoids custom models depending on each other for now)
* Add new CPU flag resolving infrastructure
* Add and fix test cases
Does not include any fix for versioning/live-migration with custom models for
now, felt these changes were big enough.
[0]: https://pve.proxmox.com/pipermail/pve-devel/2019-July/038268.html
[1]: e.g.:
cpu-model: custom-cpu-name
host-phys-bits 1
flags +aes;+avx;+avx2
reported-model kvm64
manager: Stefan Reiter (1):
Broadcast supported CPU flags
PVE/Service/pvestatd.pm | 46 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
qemu: Stefan Reiter (1):
Write understood CPU flags into static file
debian/rules | 9 +++++++++
1 file changed, 9 insertions(+)
qemu-server: Stefan Reiter (9):
Add QEMU CPU flag querying helpers
Add CPUConfig file and migrate some helpers
Adapt CPUConfig to handle custom models
Add overrides and convenience functions to CPUConfig
Verify VM-specific CPU configs seperately
Add helpers to better structure CPU option handling
Rework get_cpu_options and allow custom CPU models
fix #2318: allow phys-bits and host-phys-bits CPU settings
cfg2cmd: add test case for custom CPU model
PVE/QemuServer.pm | 336 ++++--------
PVE/QemuServer/CPUConfig.pm | 607 +++++++++++++++++++++
PVE/QemuServer/Makefile | 1 +
test/cfg2cmd/custom-cpu-model.conf | 8 +
test/cfg2cmd/i440fx-win10-hostpci.conf.cmd | 2 +-
test/cfg2cmd/minimal-defaults.conf.cmd | 2 +-
test/cfg2cmd/q35-linux-hostpci.conf.cmd | 2 +-
test/cfg2cmd/q35-win10-hostpci.conf.cmd | 2 +-
test/cfg2cmd/simple1.conf.cmd | 2 +-
test/cfg2cmd/spice-usb3.conf.cmd | 2 +-
test/run_config2command_tests.pl | 21 +
11 files changed, 750 insertions(+), 235 deletions(-)
create mode 100644 PVE/QemuServer/CPUConfig.pm
create mode 100644 test/cfg2cmd/custom-cpu-model.conf
--
2.20.1
More information about the pve-devel
mailing list