-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[finalize-warmboot.sh] reset cpufreq governor to default #19634
Conversation
Signed-off-by: Stepan Blyschak <[email protected]>
Signed-off-by: Stepan Blyschak <[email protected]>
@saiarcot895 @vaibhavhd Can you please help review? |
@vaibhavhd kindly reminder for code review feedback/approval. |
Comments are open on utilities PR. |
@@ -101,16 +101,30 @@ function check_list() | |||
echo ${RET_LIST} | |||
} | |||
|
|||
function set_cpufreq_governor() { | |||
local -r governor="$1" | |||
echo "$governor" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 1> /dev/null \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this setting (or the way we are writing to a file) be effective at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
|
||
function finalize_common() { | ||
# Read default governor from kernel config | ||
local -r default_governor=$(cat "/boot/config-$(uname -r)" | grep -o 'CONFIG_CPU_FREQ_DEFAULT_GOV_[^=]*=y') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the guarantee that "/boot/config-$(uname -r)"
will have the default governor setting?
Do you need to sanity check on the value and type of default_governor
here? What if the cat
or grep
result in a failure? Wouldn't the code proceed to assign invalid value to /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of our sonic linux kernel config, why would we remove it or set it to invalid value?
function finalize_common() { | ||
# Read default governor from kernel config | ||
local -r default_governor=$(cat "/boot/config-$(uname -r)" | grep -o 'CONFIG_CPU_FREQ_DEFAULT_GOV_[^=]*=y') | ||
set_cpufreq_governor "$default_governor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The utilities change is made for MLNX platforms only. I think it would be best to make this call only for MLNX platforms as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vaibhavhd I applied your suggestion. While testing that modification found that the | grep is incorrect causing governor to not reset to default. That bug was introduced in "Handle review comments" commit, don't remember why I did it, but I reverted to previous default governor parsing method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with suggestions.
Signed-off-by: Stepan Blyschak <[email protected]>
Signed-off-by: Stepan Blyschak <[email protected]>
/azpw run Azure.sonic-buildimage |
/AzurePipelines run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
@qiluo-msft can you please help merge? |
…9634) #### Why I did it Set cpufreq.default_governor to *performance* for faster boot time. We observe consistent 1 sec improvement across several devices. The change in finalize-warmboot.sh restores the default governor after fast or warm boot is finished. **NOTE**: This will apply to upgrades starting from 202405 since this is set in shutdown path to avoid any extra scripts running at boot time. Upgrade from older versions/branches will require a runtime patch to fast-reboot and warm-reboot script. #### How I did it After fast or warm boot is finished restore to default governor. #### How to verify it Run fast-reboot or warm-reboot. Check: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance ``` After boot is finalized check that it is reset back to default: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil ``` Tested with sonic-net/sonic-utilities#3435
…9634) #### Why I did it Set cpufreq.default_governor to *performance* for faster boot time. We observe consistent 1 sec improvement across several devices. The change in finalize-warmboot.sh restores the default governor after fast or warm boot is finished. **NOTE**: This will apply to upgrades starting from 202405 since this is set in shutdown path to avoid any extra scripts running at boot time. Upgrade from older versions/branches will require a runtime patch to fast-reboot and warm-reboot script. #### How I did it After fast or warm boot is finished restore to default governor. #### How to verify it Run fast-reboot or warm-reboot. Check: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance ``` After boot is finalized check that it is reset back to default: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil ``` Tested with sonic-net/sonic-utilities#3435
@stepanblyschak Can you raise a PR to 202405 to do the cherry-pick? The auto cherry-pick is not working for this PR. |
…9634) #### Why I did it Set cpufreq.default_governor to *performance* for faster boot time. We observe consistent 1 sec improvement across several devices. The change in finalize-warmboot.sh restores the default governor after fast or warm boot is finished. **NOTE**: This will apply to upgrades starting from 202405 since this is set in shutdown path to avoid any extra scripts running at boot time. Upgrade from older versions/branches will require a runtime patch to fast-reboot and warm-reboot script. #### How I did it After fast or warm boot is finished restore to default governor. #### How to verify it Run fast-reboot or warm-reboot. Check: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance ``` After boot is finalized check that it is reset back to default: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil ``` Tested with sonic-net/sonic-utilities#3435
Cherry-pick PR to 202405: #21030 |
#### Why I did it Set cpufreq.default_governor to *performance* for faster boot time. We observe consistent 1 sec improvement across several devices. The change in finalize-warmboot.sh restores the default governor after fast or warm boot is finished. **NOTE**: This will apply to upgrades starting from 202405 since this is set in shutdown path to avoid any extra scripts running at boot time. Upgrade from older versions/branches will require a runtime patch to fast-reboot and warm-reboot script. #### How I did it After fast or warm boot is finished restore to default governor. #### How to verify it Run fast-reboot or warm-reboot. Check: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance ``` After boot is finalized check that it is reset back to default: ``` admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil ``` Tested with sonic-net/sonic-utilities#3435
Why I did it
Set cpufreq.default_governor to performance for faster boot time. We observe consistent 1 sec improvement across several devices.
The change in finalize-warmboot.sh restores the default governor after fast or warm boot is finished.
NOTE: This will apply to upgrades starting from 202405 since this is set in shutdown path to avoid any extra scripts running at boot time. Upgrade from older versions/branches will require a runtime patch to fast-reboot and warm-reboot script.
Work item tracking
How I did it
After fast or warm boot is finished restore to default governor.
How to verify it
Run fast-reboot or warm-reboot. Check:
After boot is finalized check that it is reset back to default:
Tested with sonic-net/sonic-utilities#3435
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)