From 01b033079785dea322cafb97910dd408143f1960 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Sun, 4 Apr 2021 10:40:53 +0300 Subject: [PATCH] [install.sh] Fix CPU cstates configuration. (#7222) The motivation of these changes is to fix (#6051): - Why I did it To fix CPU cstates configuration - How I did it Updated code to be POSIX compatible - How to verify it root@sonic:/home/admin# sonic_installer install sonic-mellanox.bin Signed-off-by: Nazarii Hnydyn --- installer/x86_64/install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index a21054db36..cbb81fabd0 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -562,9 +562,10 @@ trap_push "rm $grub_cfg || true" [ -r ./platform.conf ] && . ./platform.conf # Check if the CPU vendor is 'Intel' and disable c-states if True -CPUVENDOR=$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}') +CPUVENDOR="$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}')" echo "Switch CPU vendor is: $CPUVENDOR" -if [[ $(echo $CPUVENDOR | grep -i "Intel") ]] ; then +if echo "$CPUVENDOR" | grep -i 'Intel' >/dev/null 2>&1; then + echo "Switch CPU cstates are: disabled" CSTATES="intel_idle.max_cstate=0" else CSTATES=""