feat: Support invariant TSC

This commit is contained in:
Kroese 2024-06-05 04:34:28 +02:00 committed by GitHub
parent 2b777e1403
commit 7f1e0aadce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,6 +64,26 @@ if [[ "$KVM" != [Nn]* ]]; then
CPU_FEATURES="$CPU_FEATURES,migratable=no" CPU_FEATURES="$CPU_FEATURES,migratable=no"
fi fi
if grep -qw "svm" <<< "$flags"; then
# AMD processor
if grep -qw "tsc_scale" <<< "$flags"; then
CPU_FEATURES="$CPU_FEATURES,+invtsc"
fi
else
# Intel processor
vmx=$(sed -ne '/^vmx flags/s/^.*: //p' /proc/cpuinfo)
if grep -qw "tsc_scaling" <<< "$vmx"; then
CPU_FEATURES="$CPU_FEATURES,+invtsc"
fi
fi
else else
KVM_OPTS="" KVM_OPTS=""