1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

module/sched: Fix get_capacities() on !SCHED_DEBUG kernels

While reading the DT-provided capacity values (exposed in sysfs) is
sufficient, get_capacities() also unconditionally fetches data from the
sched_domain procfs, which is only populated on kernels compiled with
CONFIG_SCHED_DEBUG.

Tweak the logic to only call get_sd_info() if it is both possible and
required.
This commit is contained in:
Valentin Schneider 2019-11-26 14:38:12 +00:00 committed by Marc Bonnici
parent eb0661a6b4
commit 01dd80df34

View File

@ -469,12 +469,26 @@ class SchedModule(Module):
cpus = self.target.list_online_cpus() cpus = self.target.list_online_cpus()
capacities = {} capacities = {}
sd_info = self.get_sd_info()
for cpu in cpus: for cpu in cpus:
if self.has_dmips_capacity(cpu): if self.has_dmips_capacity(cpu):
capacities[cpu] = self.get_dmips_capacity(cpu) capacities[cpu] = self.get_dmips_capacity(cpu)
elif self.has_em(cpu, sd_info.cpus[cpu]):
missing_cpus = set(cpus).difference(capacities.keys())
if not missing_cpus:
return capacities
if not SchedProcFSData.available(self.target):
if default != None:
capacities.update({cpu : default for cpu in missing_cpus})
return capacities
else:
raise RuntimeError(
'No capacity data for cpus {}'.format(sorted(missing_cpus)))
sd_info = self.get_sd_info()
for cpu in missing_cpus:
if self.has_em(cpu, sd_info.cpus[cpu]):
capacities[cpu] = self.get_em_capacity(cpu, sd_info.cpus[cpu]) capacities[cpu] = self.get_em_capacity(cpu, sd_info.cpus[cpu])
else: else:
if default != None: if default != None: