From 7f1aae6e4c95d74fd20108ee8a16d35d514e4174 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 23 Jun 2020 14:47:23 +0100 Subject: [PATCH 1/3] fw/TargetManager: Fix Target Manger parameters not being used The target manager parameters have not been previously been used as they have been missing the required plumbing. Allow configuration of the TargetManager via the `device_config` section. --- doc/build_plugin_docs.py | 1 + wa/commands/show.py | 1 + wa/framework/configuration/plugin_cache.py | 3 ++- wa/framework/target/descriptor.py | 15 ++++++++++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/build_plugin_docs.py b/doc/build_plugin_docs.py index 9b740dad9..6c640bac1 100755 --- a/doc/build_plugin_docs.py +++ b/doc/build_plugin_docs.py @@ -105,6 +105,7 @@ def generate_target_documentation(outdir): text += get_params_rst(td.platform_params) text += get_params_rst(td.target_params) text += get_params_rst(td.assistant_params) + text += get_params_rst(td.tm_params) wfh.write(text) diff --git a/wa/commands/show.py b/wa/commands/show.py index 45531a4c4..89dde8327 100644 --- a/wa/commands/show.py +++ b/wa/commands/show.py @@ -109,6 +109,7 @@ def get_rst_from_target(target): text += get_params_rst(target.platform_params) text += get_params_rst(target.target_params) text += get_params_rst(target.assistant_params) + text += get_params_rst(target.tm_params) text += '.. Note: For available runtime parameters please see the documentation' return text + '\n' diff --git a/wa/framework/configuration/plugin_cache.py b/wa/framework/configuration/plugin_cache.py index 188d226a4..b81ba6e1d 100644 --- a/wa/framework/configuration/plugin_cache.py +++ b/wa/framework/configuration/plugin_cache.py @@ -175,7 +175,8 @@ def _set_from_global_aliases(self, plugin_name, config): def _get_target_params(self, name): td = self.targets[name] - return get_config_point_map(chain(td.target_params, td.platform_params, td.conn_params, td.assistant_params)) + return get_config_point_map(chain(td.target_params, td.platform_params, + td.conn_params, td.assistant_params, td.tm_params)) # pylint: disable=too-many-nested-blocks, too-many-branches def _merge_using_priority_specificity(self, specific_name, diff --git a/wa/framework/target/descriptor.py b/wa/framework/target/descriptor.py index 8fb138b37..ff9f829c4 100644 --- a/wa/framework/target/descriptor.py +++ b/wa/framework/target/descriptor.py @@ -14,6 +14,7 @@ # import inspect +from itertools import chain from devlib import (LinuxTarget, AndroidTarget, LocalLinuxTarget, ChromeOsTarget, Platform, Juno, TC2, Gem5SimulationPlatform, @@ -57,6 +58,7 @@ def instantiate_target(tdesc, params, connect=None, extra_platform_params=None): platform_params = get_config_point_map(tdesc.platform_params) conn_params = get_config_point_map(tdesc.conn_params) assistant_params = get_config_point_map(tdesc.assistant_params) + tm_params = get_config_point_map(tdesc.tm_params) tp, pp, cp = {}, {}, {} @@ -75,7 +77,7 @@ def instantiate_target(tdesc, params, connect=None, extra_platform_params=None): elif name in conn_params: if not conn_params[name].deprecated: cp[name] = value - elif name in assistant_params: + elif name in chain(assistant_params, tm_params): pass else: msg = 'Unexpected parameter for {}: {}' @@ -111,7 +113,7 @@ class TargetDescription(object): def __init__(self, name, source, description=None, target=None, platform=None, conn=None, assistant=None, target_params=None, platform_params=None, - conn_params=None, assistant_params=None): + conn_params=None, assistant_params=None, tm_params=None): self.name = name self.source = source self.description = description @@ -123,10 +125,12 @@ def __init__(self, name, source, description=None, target=None, platform=None, self._set('platform_params', platform_params) self._set('conn_params', conn_params) self._set('assistant_params', assistant_params) + self._set('tm_params', tm_params) def get_default_config(self): param_attrs = ['target_params', 'platform_params', - 'conn_params', 'assistant_params'] + 'conn_params', 'assistant_params', + 'tm_params'] config = {} for pattr in param_attrs: for p in getattr(self, pattr): @@ -610,6 +614,10 @@ class DefaultTargetDescriptor(TargetDescriptor): def get_descriptions(self): # pylint: disable=attribute-defined-outside-init,too-many-locals + # pylint: disable=wrong-import-position,cyclic-import + # Import here to prevent circular import + from wa.framework.target.manager import TargetManager + result = [] for target_name, target_tuple in TARGETS.items(): (target, conn, unsupported_platforms), target_params = self._get_item(target_tuple) @@ -631,6 +639,7 @@ def get_descriptions(self): td.target_params = target_params td.platform_params = platform_params td.assistant_params = assistant.parameters + td.tm_params = TargetManager.parameters if plat_conn: td.conn = plat_conn From 92335b1c6ebb566579b4cb0aaef486a6bca3ebd0 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 23 Jun 2020 14:51:58 +0100 Subject: [PATCH 2/3] target/manager: Allow specifying usage of target_info cache Allow disabling of the usage of the target_info cache. This is useful when running on a one-off target and there is no benefit of using caching the target information. --- wa/framework/target/manager.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wa/framework/target/manager.py b/wa/framework/target/manager.py index bc756aa31..ebb7224ac 100644 --- a/wa/framework/target/manager.py +++ b/wa/framework/target/manager.py @@ -41,6 +41,11 @@ class TargetManager(object): Specifies whether the target should be disconnected from at the end of the run. """), + Parameter('cache_target_info', kind=bool, default=True, + description=""" + Configure whether the cache should be used when collecting + target information. + """), ] def __init__(self, name, parameters, outdir): @@ -54,6 +59,7 @@ def __init__(self, name, parameters, outdir): self.rpm = None self.parameters = parameters self.disconnect = parameters.get('disconnect') + self.cache_target_info = parameters.get('cache_target_info') def initialize(self): self._init_target() @@ -93,6 +99,10 @@ def extract_results(self, context): @memoized def get_target_info(self): + if not self.cache_target_info: + info = get_target_info(self.target) + return info + cache = read_target_info_cache() info = get_target_info_from_cache(self.target.system_id, cache=cache) @@ -100,13 +110,12 @@ def get_target_info(self): info = get_target_info(self.target) cache_target_info(info, cache=cache) else: - # If module configuration has changed form when the target info + # If module configuration has changed from when the target info # was previously cached, it is possible additional info will be # available, so should re-generate the cache. if module_name_set(info.modules) != module_name_set(self.target.modules): info = get_target_info(self.target) cache_target_info(info, overwrite=True, cache=cache) - return info def reboot(self, context, hard=False): From 082ffb32ccc4ad9ce4073ffd5dad92712d1d30b4 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 23 Jun 2020 14:51:29 +0100 Subject: [PATCH 3/3] fw/target: Fix typos --- wa/framework/target/assistant.py | 4 ++-- wa/framework/target/descriptor.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wa/framework/target/assistant.py b/wa/framework/target/assistant.py index 5ce3957c7..3872e7baf 100644 --- a/wa/framework/target/assistant.py +++ b/wa/framework/target/assistant.py @@ -62,10 +62,10 @@ class AndroidAssistant(object): Logcat buffer on android is of limited size and it cannot be adjusted at run time. Depending on the amount of logging activity, - the buffer may not be enought to capture comlete trace for a + the buffer may not be enough to capture complete trace for a workload execution. For those situations, logcat may be polled periodically during the course of the run and stored in a - temporary locaiton on the host. Setting the value of the poll + temporary location on the host. Setting the value of the poll period enables this behavior. """), ] diff --git a/wa/framework/target/descriptor.py b/wa/framework/target/descriptor.py index ff9f829c4..f90bf6384 100644 --- a/wa/framework/target/descriptor.py +++ b/wa/framework/target/descriptor.py @@ -661,7 +661,7 @@ def _override_params(self, params, overrides): # pylint: disable=no-self-use for override in overrides: if override.name in param_map: param_map[override.name] = override - # Return the list of overriden parameters + # Return the list of overridden parameters return list(param_map.values()) def _get_item(self, item_tuple):