Newer kernels stop offering some CPUID bits on AMD hosts that older
kernels gave to guests: spec-ctrl on Zen 1-3 since kernel commit
de572491a975 and bus-lock-detect on Zen 5 since 54950bfe2b69. A guest
started under the older kernel keeps the bit in its live definition
and cannot be migrated, restored or reverted onto the newer kernel:
guest CPU doesn't match specification: missing features: spec-ctrl
These bits are safe to ignore in this comparison.
A fresh start of a domain with the default check='partial' still fails
earlier, when the guest CPU is compared with the host CPU. Covering it
would need the same exception in virCPUx86Compare(); I left it out
unless someone wants it.
Tested on an EPYC 7443P host whose kernel withholds spec-ctrl and
bus-lock-detect. Without the series a check='full' domain requiring
either feature fails to start, and a save image whose CPU requires
either fails to restore. With it both succeed with the feature disabled
in the live definition. Without ibpb, spec-ctrl still fails.
Changes since v1:
- moved into virCPUx86UpdateLive(), which also covers fresh starts
(Jiri)
- the cpu code logs the change itself, at VIR_INFO (Jiri)
- simplified the checks (Jiri)
- cputest gets data-driven cases instead of a dedicated function (Jiri)
- table of droppable features, bus-lock-detect added in patch 2
v1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/EE7DTIUI3USA7SVAOXOGLUDOI5IWG2TJ/
Denis V. Lunev (2):
cpu_x86: let AMD guests drop spec-ctrl instead of failing
cpu_x86: let AMD guests drop bus-lock-detect instead of failing
src/cpu/cpu_x86.c | 114 +++++++++++++++++-
tests/cputest.c | 17 +++
...e-i7-1365U-no-bus-lock-detect-disabled.xml | 4 +
...re-i7-1365U-no-bus-lock-detect-enabled.xml | 21 ++++
...Core-i7-1365U-no-bus-lock-detect-guest.xml | 61 ++++++++++
...PYC-7713-64-Core-no-spec-ctrl-disabled.xml | 4 +
...EPYC-7713-64-Core-no-spec-ctrl-enabled.xml | 11 ++
...d-EPYC-7713-64-Core-no-spec-ctrl-guest.xml | 56 +++++++++
...id-EPYC-7713-64-Core-no-spec-ctrl-json.xml | 56 +++++++++
...-64-Core-no-spec-ctrl-no-ibpb-disabled.xml | 4 +
...3-64-Core-no-spec-ctrl-no-ibpb-enabled.xml | 11 ++
...713-64-Core-no-spec-ctrl-no-ibpb-guest.xml | 56 +++++++++
...0X-16-Core-no-bus-lock-detect-disabled.xml | 4 +
...50X-16-Core-no-bus-lock-detect-enabled.xml | 14 +++
...9950X-16-Core-no-bus-lock-detect-guest.xml | 45 +++++++
...-9950X-16-Core-no-bus-lock-detect-json.xml | 45 +++++++
16 files changed, 519 insertions(+), 4 deletions(-)
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-1365U-no-bus-lock-detect-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-1365U-no-bus-lock-detect-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-1365U-no-bus-lock-detect-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-json.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-no-ibpb-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-no-ibpb-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-EPYC-7713-64-Core-no-spec-ctrl-no-ibpb-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Ryzen-9-9950X-16-Core-no-bus-lock-detect-disabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Ryzen-9-9950X-16-Core-no-bus-lock-detect-enabled.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Ryzen-9-9950X-16-Core-no-bus-lock-detect-guest.xml
create mode 100644 tests/cputestdata/x86_64-cpuid-Ryzen-9-9950X-16-Core-no-bus-lock-detect-json.xml
base-commit: d6c09bf592632a242e3475e832187610aba71763
--
2.53.0