mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-02 10:47:19 +08:00
feat: Detect clock source (#923)
This commit is contained in:
parent
beadfe720c
commit
5e6f931433
27
src/proc.sh
27
src/proc.sh
@ -9,6 +9,23 @@ set -Eeuo pipefail
|
||||
: "${CPU_MODEL:=""}"
|
||||
: "${DEF_MODEL:="qemu64"}"
|
||||
|
||||
CLOCKSOURCE="tsc"
|
||||
[[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter"
|
||||
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
|
||||
|
||||
if [ ! -f "$CLOCK" ]; then
|
||||
warn "file \"$CLOCK\" cannot not found?"
|
||||
else
|
||||
result=$(<"$CLOCK")
|
||||
case "${result,,}" in
|
||||
"${CLOCKSOURCE,,}" ) ;;
|
||||
"kvm-clock" ) info "Nested KVM virtualization detected.." ;;
|
||||
"hyperv_clocksource_tsc_page" ) info "Nested Hyper-V virtualization detected.." ;;
|
||||
"hpet" ) warn "unsupported clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'" ;;
|
||||
*) warn "unexpected clock source detected: '$result'. Please set host clock source to '$CLOCKSOURCE'" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ "${ARCH,,}" != "amd64" ]]; then
|
||||
KVM="N"
|
||||
warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for x64 instructions, this will cause a major loss of performance."
|
||||
@ -60,16 +77,6 @@ if [[ "$KVM" != [Nn]* ]]; then
|
||||
CPU_FEATURES+=",migratable=no"
|
||||
fi
|
||||
|
||||
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
|
||||
if [ -f "$CLOCK" ]; then
|
||||
result=$(<"$CLOCK")
|
||||
if [[ "${result,,}" != "tsc" ]]; then
|
||||
warn "unexpected clocksource: $result"
|
||||
fi
|
||||
else
|
||||
warn "file \"$CLOCK\" cannot not found?"
|
||||
fi
|
||||
|
||||
if grep -qw "svm" <<< "$flags"; then
|
||||
|
||||
# AMD processor
|
||||
|
Loading…
x
Reference in New Issue
Block a user