mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-11 12:33:42 +08:00
Compare commits
2 Commits
92b4bfc383
...
v7.29
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e6f931433 | ||
|
|
beadfe720c |
29
src/proc.sh
29
src/proc.sh
@@ -9,6 +9,23 @@ set -Eeuo pipefail
|
|||||||
: "${CPU_MODEL:=""}"
|
: "${CPU_MODEL:=""}"
|
||||||
: "${DEF_MODEL:="qemu64"}"
|
: "${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
|
if [[ "${ARCH,,}" != "amd64" ]]; then
|
||||||
KVM="N"
|
KVM="N"
|
||||||
warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for x64 instructions, this will cause a major loss of performance."
|
warn "your CPU architecture is ${ARCH^^} and cannot provide KVM acceleration for x64 instructions, this will cause a major loss of performance."
|
||||||
@@ -47,7 +64,6 @@ fi
|
|||||||
if [[ "$KVM" != [Nn]* ]]; then
|
if [[ "$KVM" != [Nn]* ]]; then
|
||||||
|
|
||||||
CPU_FEATURES="kvm=on,l3-cache=on,+hypervisor"
|
CPU_FEATURES="kvm=on,l3-cache=on,+hypervisor"
|
||||||
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
|
|
||||||
KVM_OPTS=",accel=kvm -enable-kvm -global kvm-pit.lost_tick_policy=discard"
|
KVM_OPTS=",accel=kvm -enable-kvm -global kvm-pit.lost_tick_policy=discard"
|
||||||
|
|
||||||
if ! grep -qw "sse4_2" <<< "$flags"; then
|
if ! grep -qw "sse4_2" <<< "$flags"; then
|
||||||
@@ -61,15 +77,6 @@ if [[ "$KVM" != [Nn]* ]]; then
|
|||||||
CPU_FEATURES+=",migratable=no"
|
CPU_FEATURES+=",migratable=no"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$CLOCK" ]; then
|
|
||||||
CLOCK=$(<"$CLOCK")
|
|
||||||
if [[ "${CLOCK,,}" != "tsc" ]]; then
|
|
||||||
warn "unexpected clocksource: $CLOCK"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "file \"$CLOCK\" cannot not found?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -qw "svm" <<< "$flags"; then
|
if grep -qw "svm" <<< "$flags"; then
|
||||||
|
|
||||||
# AMD processor
|
# AMD processor
|
||||||
@@ -127,7 +134,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$HOST_CPU" ]; then
|
if [ -z "$HOST_CPU" ]; then
|
||||||
HOST_CPU=$(lscpu | grep -m 1 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')
|
[[ "${CPU,,}" != "unknown" ]] && HOST_CPU="$CPU"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$HOST_CPU" ]; then
|
if [ -n "$HOST_CPU" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user