Skip to content

Commit ec07629

Browse files
committed
Store the isolated cores for ansible
This is defence in depth by disallowing the kernel to schedule work on the online cpu's before the script disables the CPU's. The script can fail when the CPU taken down is currently working on something.
1 parent 9626353 commit ec07629

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

provision-contest/disable-turboboost_ht

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ disable_cpu () {
1212
disabled_cores+=("${cpu##*/}")
1313
}
1414

15+
store_isolcpus_fact="/var/tmp/isolcpus"
16+
1517
# shellcheck disable=SC2012
1618
for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
1719
[[ $(basename $cpu) =~ ^cpu[0-9]+$ ]] || continue
@@ -54,6 +56,11 @@ for cpu in $(ls -1d /sys/devices/system/cpu/cpu* | sort --version-sort) ; do
5456
fi
5557
done
5658

59+
if [ -n "${store_isolcpus_fact}" ]; then
60+
csv_string=$(IFS=, ; echo "${disabled_cores[*]}")
61+
echo "$csv_string" > "$store_isolcpus_fact"
62+
fi
63+
5764
DIR_INTEL=/sys/devices/system/cpu/intel_pstate
5865
DIR_AMD=/sys/devices/system/cpu/cpufreq
5966
if [ -d $DIR_INTEL ]; then

0 commit comments

Comments
 (0)