mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-06 16:37:28 +08:00
feat: Improve CPU detection (#921)
This commit is contained in:
parent
92b4bfc383
commit
beadfe720c
10
src/proc.sh
10
src/proc.sh
@ -47,7 +47,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,10 +60,11 @@ if [[ "$KVM" != [Nn]* ]]; then
|
|||||||
CPU_FEATURES+=",migratable=no"
|
CPU_FEATURES+=",migratable=no"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CLOCK="/sys/devices/system/clocksource/clocksource0/current_clocksource"
|
||||||
if [ -f "$CLOCK" ]; then
|
if [ -f "$CLOCK" ]; then
|
||||||
CLOCK=$(<"$CLOCK")
|
result=$(<"$CLOCK")
|
||||||
if [[ "${CLOCK,,}" != "tsc" ]]; then
|
if [[ "${result,,}" != "tsc" ]]; then
|
||||||
warn "unexpected clocksource: $CLOCK"
|
warn "unexpected clocksource: $result"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
warn "file \"$CLOCK\" cannot not found?"
|
warn "file \"$CLOCK\" cannot not found?"
|
||||||
@ -127,7 +127,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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user