mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
cpufreq: Improve error when setting all CPUs to unsupported governor
Currently when using set_all_governors to try to set an unsupported governor, the error is a somewhat cryptic "sh: echo: I/O error". Add a check that diagnoses this error. In order to avoid slowing down the "good" path, the check for unsupported governors is only done if the failure has already occured.
This commit is contained in:
parent
1cc6ddf140
commit
af4214c3fb
@ -375,9 +375,18 @@ class CpufreqModule(Module):
|
||||
"""
|
||||
Set the specified governor for all the (online) CPUs
|
||||
"""
|
||||
return self.target._execute_util(
|
||||
try:
|
||||
return self.target._execute_util(
|
||||
'cpufreq_set_all_governors {}'.format(governor),
|
||||
as_root=True)
|
||||
except TargetError as e:
|
||||
if "echo: I/O error" in str(e):
|
||||
cpus_unsupported = [c for c in self.target.list_online_cpus()
|
||||
if governor not in self.list_governors(c)]
|
||||
raise TargetError("Governor {} unsupported for CPUs {}".format(
|
||||
governor, cpus_unsupported))
|
||||
else:
|
||||
raise
|
||||
|
||||
def get_all_governors(self):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user