feat: Detect clock source

This commit is contained in:
Kroese 2025-03-14 06:00:58 +01:00 committed by GitHub
parent 85acaee0f4
commit d18a1abe99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,29 @@ if [[ "$CPU" == "Rockchip RK3588"* ]] && [[ "$CORES" == "8" ]]; then
[ -z "$CPU_PIN" ] && CPU_PIN="4,5,6,7" [ -z "$CPU_PIN" ] && CPU_PIN="4,5,6,7"
fi fi
if [[ "${ARCH,,}" != "arm64" ]]; then MSRS="/sys/module/kvm/parameters/ignore_msrs"
if [ -e "$MSRS" ]; then
result=$(<"$MSRS")
if [[ "$result" == "0" ]] || [[ "${result^^}" == "N" ]]; then
echo 1 | tee "$MSRS" > /dev/null 2>&1 || true
fi
fi
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
if [ -f "$CLOCK" ]; then
result=$(<"$CLOCK")
case "${result,,}" in
"arch_sys_counter" ) ;;
"kvm-clock" ) info "Nested KVM virtualization detected.." ;;
"hyperv_clocksource_tsc_page" ) info "Nested Hyper-V virtualization detected.." ;;
"hpet" ) warn "unsupported clock source detected: '$result'." ;;
*) warn "unexpected clock source detected: '$result'." ;;
esac
else
warn "file \"$CLOCK\" cannot not found?"
fi
if [[ "${ARCH,,}" != "arm64" ]]; then
KVM="N" KVM="N"
warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for ARM64 instructions, this will cause a major loss of performance." warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for ARM64 instructions, this will cause a major loss of performance."
fi fi