From 8de7f56ff8d1710c5431adf5d14177e51e8f62e0 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 23 Sep 2025 16:02:42 +0200 Subject: [PATCH] feat: Add KVM warning (#1021) --- src/proc.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/proc.sh b/src/proc.sh index a5f5c1b..5e3f69d 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -7,7 +7,6 @@ set -Eeuo pipefail : "${HOST_CPU:=""}" : "${CPU_FLAGS:=""}" : "${CPU_MODEL:=""}" -: "${DEF_MODEL:="qemu64"}" CLOCKSOURCE="tsc" [[ "${ARCH,,}" == "arm64" ]] && CLOCKSOURCE="arch_sys_counter" @@ -27,9 +26,13 @@ else 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." +if [[ "$KVM" == [Nn]* ]]; then + warn "KVM acceleration is disabled, this will cause the machine to run about 10 times slower!" +else + if [[ "${ARCH,,}" != "amd64" ]]; then + KVM="N" + warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for x64 instructions, so the machine will run about 10 times slower." + fi fi if [[ "$KVM" != [Nn]* ]]; then @@ -52,8 +55,8 @@ if [[ "$KVM" != [Nn]* ]]; then if [ -n "$KVM_ERR" ]; then KVM="N" if [[ "$OSTYPE" =~ ^darwin ]]; then - warn "you are using macOS which has no KVM support, this will cause a major loss of performance." - else + warn "you are using macOS which has no KVM support, so the machine will run about 10 times slower." + else kernel=$(uname -a) case "${kernel,,}" in *"microsoft"* ) @@ -61,7 +64,7 @@ if [[ "$KVM" != [Nn]* ]]; then *"synology"* ) error "Please make sure that Synology VMM (Virtual Machine Manager) is installed and that '/dev/kvm' is binded to this container." ;; *) - error "KVM acceleration is not available $KVM_ERR, this will cause a major loss of performance." + error "KVM acceleration is not available $KVM_ERR, this will cause the machine to run about 10 times slower." error "See the FAQ for possible causes, or continue without it by adding KVM: \"N\" (not recommended)." ;; esac [[ "$DEBUG" != [Yy1]* ]] && exit 88 @@ -120,7 +123,7 @@ else CPU_MODEL="max" CPU_FEATURES+=",migratable=no" else - CPU_MODEL="$DEF_MODEL" + CPU_MODEL="qemu64" fi fi