Skip to content

Commit

Permalink
[finalize-warmboot.sh] reset cpufreq governor to default
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Blyschak <[email protected]>
  • Loading branch information
stepanblyschak committed Jul 18, 2024
1 parent 21f2d3b commit ef1b3d8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions files/image_config/warmboot-finalizer/finalize-warmboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,30 @@ function check_list()
echo ${RET_LIST}
}

set_cpufreq_governor() {
governor="$1"
echo "$governor" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor \
&& debug "Set CPUFreq scaling governor to $governor" \
|| debug "Failed to set CPUFreq scaling governor to $governor"
}

function finalize_common() {
# Read default governor from kernel config
default_governor=$(cat "/boot/config-$(uname -r)" | grep -E 'CONFIG_CPU_FREQ_DEFAULT_GOV_.*=y' | sed -E 's/CONFIG_CPU_FREQ_DEFAULT_GOV_(.*)=y/\1/')
set_cpufreq_governor "$default_governor"
}

function finalize_warm_boot()
{
debug "Finalizing warmboot..."
finalize_common
sudo config warm_restart disable
}

function finalize_fast_reboot()
{
debug "Finalizing fast-reboot..."
finalize_common
sonic-db-cli STATE_DB hset "FAST_RESTART_ENABLE_TABLE|system" "enable" "false" &>/dev/null
sonic-db-cli CONFIG_DB DEL "WARM_RESTART|teamd" &>/dev/null
}
Expand Down

0 comments on commit ef1b3d8

Please sign in to comment.