Skip to content

Commit 3b97d43

Browse files
shlomibittonabdosi
authored andcommitted
[kernel] Change grub cmdline to set c-states to 0 for "Intel" CPUs (#6051)
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 <[email protected]>
1 parent 371f828 commit 3b97d43

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

installer/x86_64/install.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,17 @@ trap_push "rm $grub_cfg || true"
535535
536536
[ -r ./platform.conf ] && . ./platform.conf
537537
538+
# Check if the CPU vendor is 'Intel' and disable c-states if True
539+
CPUVENDOR=$(cat /proc/cpuinfo | grep -m 1 vendor_id | awk '{print $3}')
540+
echo "Switch CPU vendor is: $CPUVENDOR"
541+
if [[ $(echo $CPUVENDOR | grep -i "Intel") ]] ; then
542+
CSTATES="intel_idle.max_cstate=0"
543+
else
544+
CSTATES=""
545+
fi
546+
538547
DEFAULT_GRUB_SERIAL_COMMAND="serial --port=${CONSOLE_PORT} --speed=${CONSOLE_SPEED} --word=8 --parity=no --stop=1"
539-
DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet"
548+
DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet $CSTATES"
540549
GRUB_SERIAL_COMMAND=${GRUB_SERIAL_COMMAND:-"$DEFAULT_GRUB_SERIAL_COMMAND"}
541550
GRUB_CMDLINE_LINUX=${GRUB_CMDLINE_LINUX:-"$DEFAULT_GRUB_CMDLINE_LINUX"}
542551
export GRUB_SERIAL_COMMAND

0 commit comments

Comments
 (0)