Skip to content

Commit

Permalink
rt_config: Don't try to configure an offline cpu
Browse files Browse the repository at this point in the history
As per [1], any attempt to configure a core's frequency will fail
if the first core of the associated frequency domain is offline.
Remove the assumption that the first cpu should be used when committing
the change to the device to resolve this.

[1] ARM-software#1217
  • Loading branch information
marcbonnici committed Jun 29, 2023
1 parent 6779f24 commit 422c1ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions wa/framework/target/runtime_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,16 @@ def set_governor_tunables(obj, value, core):

@staticmethod
def set_param(obj, value, core, parameter):
'''Method to store passed parameter if it is not already specified for that cpu'''
cpus = resolve_unique_domain_cpus(core, obj.target)
for cpu in cpus:
if parameter in obj.config[cpu]:
msg = 'Cannot set "{}" for core "{}"; Parameter for CPU{} has already been set'
raise ConfigError(msg.format(parameter, core, cpu))
obj.config[cpu][parameter] = value
'''Method to store passed parameter if it is not already specified for that cpu frequency domain'''
domain_cpus = resolve_unique_domain_cpus(core, obj.target)
for domain_cpu in domain_cpus:
cpus = obj.target.cpufreq.get_related_cpus(domain_cpu)
for cpu in cpus:
if cpu in obj.config and parameter in obj.config[cpu]:
msg = 'Cannot set "{}" for core "{}"; Parameter for CPU{} has already been set'
raise ConfigError(msg.format(parameter, core, cpu))
# Once validated, store the ID of the first cpu resolved.
obj.config[cpus[0]][parameter] = value

def __init__(self, target):
self.config = defaultdict(dict)
Expand Down
2 changes: 1 addition & 1 deletion wa/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def resolve_unique_domain_cpus(name, target):
# Skip core if not online
continue
if domain_cpus[0] not in unique_cpus:
unique_cpus.append(domain_cpus[0])
unique_cpus.append(cpu)
return unique_cpus


Expand Down

0 comments on commit 422c1ec

Please sign in to comment.