[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 <shlomibi@nvidia.com>
This commit is contained in:
shlomibitton 2020-12-07 22:30:50 +02:00 committed by GitHub
parent 3b04da97fb
commit 43a32e60fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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