Skip to content

Commit 0f1e602

Browse files
JamesC1305JackThomson2
authored andcommitted
fix(tests): disable C6 and C6P C-states on Intel Granite Rapids
If CPU is Intel Granite Rapids (Xeon 6, FMS 06-AD-XX), disable C6 and C6P states. We've observed significant volatility in our performance tests on Intel Granite Rapids CPUs (Xeon 6, FMS 06-AD-XX), specifically in many of our latency metrics. After spending time investigating this, it seems like cross-CPU communication becomes prohibitively slow with the deepest C-states enabled. Since GNR chips have higher core density (96 per socket vs. SPR's 48 per socket), we believe that the tail latency of transitioning out of the deepest C-states explains the volatility. Disabling these deep states appear to stabilise the performance, so for consistency in our CI, we will disable them. NB: The performance volatility only appears to affect Granite Rapids instances with low load (e.g., our performance integration tests). The assumption is that when the load is high, cores are unlikely to enter deeper C-states, so inter-CPU communication does not encounter the overhead of transitioning out of deeper C-states. Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
1 parent 09126b0 commit 0f1e602

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

tools/devtool

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,30 @@ apply_performance_tweaks() {
758758
echo 100 |sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct &> /dev/null
759759
fi
760760

761+
# If CPU is Intel Granite Rapids (Xeon 6, FMS 06-AD-XX), disable C6 and C6P states.
762+
# We've observed significant volatility in our performance tests on Intel Granite Rapids CPUs
763+
# (Xeon 6, FMS 06-AD-XX), specifically in many of our latency metrics. After spending time investigating
764+
# this, it seems like cross-CPU communication becomes prohibitively slow with the deepest C-states
765+
# enabled. Since GNR chips have higher core density (96 per socket vs. SPR's 48 per socket), we believe
766+
# that the tail latency of transitioning out of the deepest C-states explains the volatility.
767+
768+
# Disabling these deep states appear to stabilise the performance, so for consistency in our CI, we will disable them.
769+
770+
# NB: The performance volatility only appears to affect Granite Rapids instances with low load
771+
# (e.g., our performance integration tests). The assumption is that when the load is high, cores
772+
# are unlikely to enter deeper C-states, so inter-CPU communication does not encounter the overhead
773+
# of transitioning out of deeper C-states.
774+
model=$(awk '/^model\s+:/ {print $3; exit}' /proc/cpuinfo)
775+
family=$(awk '/^cpu family\s+:/ {print $4; exit}' /proc/cpuinfo)
776+
if [[ "$family" -eq 6 && "$model" -eq 173 ]]; then
777+
say "Intel Granite Rapids CPU detected. Disabling C6 and C6P C-states"
778+
for state in /sys/devices/system/cpu/cpu[0-9]*/cpuidle/state*/; do
779+
if [[ -f "$state/name" && $(cat "$state/name") == C6* ]]; then
780+
echo 1 | sudo tee "$state/disable" &> /dev/null
781+
fi
782+
done
783+
fi
784+
761785
# The governor is a linux component that can adjust CPU frequency. "performance" tells it to always run CPUs at
762786
# their maximum safe frequency. It seems to be the default for Amazon Linux, but it doesn't hurt to make this explicit.
763787
# See also https://wiki.archlinux.org/title/CPU_frequency_scaling
@@ -774,6 +798,17 @@ unapply_performance_tweaks() {
774798
echo $MAX_PERF_PCT |sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct &> /dev/null
775799
fi
776800

801+
# reenable Granite Rapids C-states
802+
model=$(awk '/^model\s+:/ {print $3; exit}' /proc/cpuinfo)
803+
family=$(awk '/^cpu family\s+:/ {print $4; exit}' /proc/cpuinfo)
804+
if [[ "$family" -eq 6 && "$model" -eq 173 ]]; then
805+
for state in /sys/devices/system/cpu/cpu[0-9]*/cpuidle/state*/; do
806+
if [[ -f "$state/name" && $(cat "$state/name") == C6* ]]; then
807+
echo 0 | sudo tee "$state/disable" &> /dev/null
808+
fi
809+
done
810+
fi
811+
777812
# We do not reset the governor, as keeping track of each CPUs configured governor is not trivial here. On our CI
778813
# instances, the performance governor is current the default anyway (2023/11/14)
779814
}

0 commit comments

Comments
 (0)