aboutsummaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@linaro.org>2016-11-18 11:11:04 +0000
committerMichele Di Giorgio <michele.digiorgio@linaro.org>2016-11-30 16:24:55 +0000
commitc46015cd068f520137ecb14eb3604f2200ea2bdb (patch)
treecb91944663c495038f9f5d05779b37241fd0c03f /devices
parentbedf9fa410b39bd034e3acd649100a74bf9330b2 (diff)
cpu_freq_utils: Make CPUs hotplug script more robust
In some cases, it happens that we try to restore the CPUs configuration while some kernel thread is hotplugging CPUs ON and OFF as well, especially when the device gets hot after running benchmarks or tests. In which case, the build scripts will fail. This patch simply waits a few second after the first attempt to hotplug a CPU, before trying again. If the second attempt fails too, then the script aborts and an error is returned. Change-Id: I56c911195bc5ca3072b607bb805eed42100d5f92 Signed-off-by: Michele Di Giorgio <michele.digiorgio@linaro.org>
Diffstat (limited to 'devices')
-rw-r--r--devices/cpu_freq_utils.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/devices/cpu_freq_utils.sh b/devices/cpu_freq_utils.sh
index 2723c7f..b6f5b41 100644
--- a/devices/cpu_freq_utils.sh
+++ b/devices/cpu_freq_utils.sh
@@ -52,8 +52,17 @@ set_state_cpus() {
# without any message printed, check that the new status is what we expect.
new_status=$(safe adb_shell_strip "cat $online_file")
if [[ ${output} || ${new_status} != ${state} ]]; then
- log E "Failed to set CPU ${cpu} to state ${state}: ${output}"
- return 1
+ # There might be a kthread hotplugging CPUs on and off (for example the
+ # thermal governor if the temperature is high), so let us wait a few
+ # seconds and then retry. If fails again, abort with an error.
+ log W "Failed to set CPU ${cpu} to state ${state}, retrying..."
+ safe sleep 10s
+ output=$(safe adb_shell_strip "echo ${state} > $online_file")
+ new_status=$(safe adb_shell_strip "cat $online_file")
+ if [[ ${output} || ${new_status} != ${state} ]]; then
+ log E "Failed to set CPU ${cpu} to state ${state}: ${output}"
+ return 1
+ fi
fi
fi
done