From 43a32e60fc019ae1541787b6a2c3634a9b9f66a7 Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Mon, 7 Dec 2020 22:30:50 +0200 Subject: [PATCH] [kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs (#6051) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Usually for a use case like networking - should not be configured to reach c6, the maximum used is c1e – due to the added latency getting in & out of states (bad for networking). Following a recommendation by Intel, networking system should avoid getting in & out of states which introduce latency. The recommended state is c1e and no state change enabling. In addition, c-state sole purpose is to save power and when inside a networking switch its really negligent being such a tiny consumer vs. the whole cluster. Signed-off-by: Shlomi Bitton --- installer/x86_64/install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index c64386d762..1df52e26de 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -535,8 +535,17 @@ 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}') +echo "Switch CPU vendor is: $CPUVENDOR" +if [[ $(echo $CPUVENDOR | grep -i "Intel") ]] ; then + CSTATES="intel_idle.max_cstate=0" +else + CSTATES="" +fi + DEFAULT_GRUB_SERIAL_COMMAND="serial --port=${CONSOLE_PORT} --speed=${CONSOLE_SPEED} --word=8 --parity=no --stop=1" -DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet" +DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet $CSTATES" GRUB_SERIAL_COMMAND=${GRUB_SERIAL_COMMAND:-"$DEFAULT_GRUB_SERIAL_COMMAND"} GRUB_CMDLINE_LINUX=${GRUB_CMDLINE_LINUX:-"$DEFAULT_GRUB_CMDLINE_LINUX"} export GRUB_SERIAL_COMMAND