diff options
author | Chris Jones <christopher.jones@linaro.org> | 2022-03-15 17:57:52 +0000 |
---|---|---|
committer | Chris Jones <christopher.jones@linaro.org> | 2022-03-24 19:27:45 +0000 |
commit | 2395ce41310b96e0bc58071e5c6bcefcbe08b20a (patch) | |
tree | ee05e1435332bcd235d5a3ba3e51c2b80a485316 | |
parent | cba52c6e6b01b912cc20c3efc474798aec823296 (diff) | |
download | art-build-scripts-2395ce41310b96e0bc58071e5c6bcefcbe08b20a.tar.gz |
Skip readonly CPU online files
Add warning and skip hotplugging (enabling/disabling) of a CPU if its
online file is unwritable/readonly. On some devices (e.g: Pixel 6)
CPU0 is often special and excluded from CPU hotplugging therefore
flag an appropriate warning but still allow benchmarks to run.
Test: ./scripts/benchmarks/benchmarks_run_target.sh --cpu big \
--iterations 2 benchmarks/algorithm/DeltaBlue
Change-Id: I19d548f0df9d3d2d805f4bc1bdd787b3284603b7
-rw-r--r-- | devices/cpu_freq_utils.sh | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/devices/cpu_freq_utils.sh b/devices/cpu_freq_utils.sh index 4794aded..0f005c51 100644 --- a/devices/cpu_freq_utils.sh +++ b/devices/cpu_freq_utils.sh @@ -76,25 +76,33 @@ set_state_cpus() { # Only raise an error if we were trying to disable CPU. if [[ $state -eq 0 ]]; then log E "Could not write to $online_file" + return 1 fi - else - local new_state trial + fi + + # Check that the online file is writable, if not skip it. + if [[ $(adb_shell "ls -l ${online_file} | grep -c 'w'") -eq 0 ]]; then + log W "CPU '${cpu}' is not writable" + continue + fi + + # Try and set the CPU to the requested state. + local new_state trial + adb_shell "echo ${state} > $online_file" + new_state=$(safe adb_shell "cat $online_file") + for ((trial=1; trial <= max_trials && new_state != state; trial++)); do + # There might be a kthread hotplugging CPUs on and off (for example the + # thermal governor if the temperature is high), so let us wait for the + # device to cool down and retry. + log W "Failed to set CPU ${cpu} to state ${state}, retrying ${trial}..." + safe sleep 100s adb_shell "echo ${state} > $online_file" new_state=$(safe adb_shell "cat $online_file") - for ((trial=1; trial <= max_trials && new_state != state; trial++)); do - # There might be a kthread hotplugging CPUs on and off (for example the - # thermal governor if the temperature is high), so let us wait for the - # device to cool down and retry. - log W "Failed to set CPU ${cpu} to state ${state}, retrying ${trial}..." - safe sleep 100s - adb_shell "echo ${state} > $online_file" - new_state=$(safe adb_shell "cat $online_file") - done - # If after 10 trials there is still a failure, abort with an error. - if [[ "${new_state}" != "${state}" ]]; then - log E "Failed to set CPU ${cpu} to state ${state}, after ${trial} trials" - return 1 - fi + done + # If after 10 trials there is still a failure, abort with an error. + if [[ "${new_state}" != "${state}" ]]; then + log E "Failed to set CPU ${cpu} to state ${state}, after ${trial} trials" + return 1 fi log I "Successfully set CPU ${cpu} to state ${state}" |