Configure CPU Model
To configure a CPU model:
- The correct CPU model should be configured for a KVM guest to mitigate Fatal glibc error: CPU does not support x86-64-v2. To view the bug, refer to Bug 2040657 - glibc: More Reliable CPU Compatibility Diagnostics.
To determine the current architecture level (on KVM guest or compute resource), the following cpu_check.awk script can be used:
#!/usr/bin/awk -f BEGIN { while (!/flags/) if (getline < "/proc/cpuinfo" != 1) exit 1 if (/lm/&&/cmov/&&/cx8/&&/fpu/&&/fxsr/&&/mmx/&&/syscall/&&/sse2/) level = 1 if (level == 1 && /cx16/&&/lahf/&&/popcnt/&&/sse4_1/&&/sse4_2/&&/ssse3/) level = 2 if (level == 2 && /avx/&&/avx2/&&/bmi1/&&/bmi2/&&/f16c/&&/fma/&&/abm/&&/movbe/&&/xsave/) level = 3 if (level == 3 && /avx512f/&&/avx512bw/&&/avx512cd/&&/avx512dq/&&/avx512vl/) level = 4 if (level > 0) { print "CPU supports x86-64-v" level; exit level + 1 } exit 1 }
To determine architecture levels inside the guest, run:
# ./cpu_check.awk CPU supports x86-64-v1
To check the architecture level on compute resource:
# ./cpu_check.awk CPU supports x86-64-v3
- ABI compatibility levels for CPU models, preferred CPU models for Intel x86, and AMD x86 compute resources are described at QEMU / KVM CPU model configuration.
To determine the CPU model on compute resource, run:
# virsh capabilities <capabilities> <host> ... <cpu> <arch>x86_64</arch> <model>EPYC-IBPB</model> <vendor>AMD</vendor>
To set the needed model for the KVM guest, the following should be added to its libvirt XML configuration file (Configuring the CPU model):
<domain type="kvm" xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0"> ... <cpu mode="custom"> <model>EPYC-IBPB</model> </cpu>