From 18d98cfa6b9a2b65e2db8e3704765b490009ff3f Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Mon, 18 Dec 2023 19:13:24 +0100 Subject: [PATCH] lisa._kmod: Remove kmod parameters The lisa module was previously configured at load time by providing module parameters. The newly added VFS interface allows to configure kmod features at runtime. Remove the kmod parameters generation. Original-author: Beata Michalska Signed-off-by: Pierre Gondois --- lisa/_cli_tools/lisa_load_kmod.py | 6 +----- lisa/_kmod.py | 32 +++++++------------------------ lisa/trace.py | 3 --- lisa/wa/plugins/_kmod.py | 6 +----- 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/lisa/_cli_tools/lisa_load_kmod.py b/lisa/_cli_tools/lisa_load_kmod.py index 0fa95e6ed5..aa8c48e4d4 100755 --- a/lisa/_cli_tools/lisa_load_kmod.py +++ b/lisa/_cli_tools/lisa_load_kmod.py @@ -55,15 +55,11 @@ def _main(args, target): if cmd and cmd[0] == '--': cmd = cmd[1:] - kmod_params = {} - if features is not None: - kmod_params['features'] = list(features) - kmod = target.get_kmod(LISADynamicKmod) pretty_events = ', '.join(kmod.defined_events) logging.info(f'Kernel module provides the following ftrace events: {pretty_events}') - _kmod_cm = kmod.run(kmod_params=kmod_params) + _kmod_cm = kmod.run() _kmod_cfg = kmod.with_features(cfg_name="lisa_cli_tool", features=None) if keep_loaded: diff --git a/lisa/_kmod.py b/lisa/_kmod.py index a9ba4880af..746975d749 100644 --- a/lisa/_kmod.py +++ b/lisa/_kmod.py @@ -2534,14 +2534,9 @@ def populate(key, path): return (bin_, kernel_build_env._to_spec()) - def install(self, kmod_params=None): + def install(self): """ Install and load the module on the target. - - :param kmod_params: Parameters to pass to the module via ``insmod``. - Non-string iterable values will be turned into a comma-separated - string following the ``module_param_array()`` kernel API syntax. - :type kmod_params: dict(str, object) or None """ target = self.target @@ -2565,9 +2560,9 @@ def kmod_cm(): finally: target.remove(str(target_temp)) - return self._install(kmod_cm(), kmod_params=kmod_params) + return self._install(kmod_cm()) - def _install(self, kmod_cm, kmod_params): + def _install(self, kmod_cm): # Avoid circular import from lisa.trace import DmesgCollector @@ -2596,15 +2591,6 @@ def log_dmesg(coll, log): logger = self.logger target = self.target - kmod_params = kmod_params or {} - params = ' '.join( - f'{quote(k)}={quote(make_str(v))}' - for k, v in sorted( - kmod_params.items(), - key=itemgetter(0), - ) - ) - try: self.uninstall() except Exception: @@ -2619,7 +2605,7 @@ def log_dmesg(coll, log): try: with dmesg_coll as dmesg_coll: - target.execute(f'{quote(target.busybox)} insmod {quote(str(ko_path))} {params}', as_root=True) + target.execute(f'{quote(target.busybox)} insmod {quote(str(ko_path))}', as_root=True) except Exception as e: log_dmesg(dmesg_coll, logger.error) @@ -2879,7 +2865,7 @@ def _event_features(self, events): for event in fnmatch.filter(all_events, pattern) ) - def install(self, kmod_params=None): + def install(self): target = self.target logger = self.logger @@ -2903,17 +2889,13 @@ def guess_kmod_path(): base_path = f"{modules_path_base}/{modules_version}" return (base_path, f"{self.mod_name}.ko") - - kmod_params = kmod_params or {} - kmod_params['version'] = self.src.checksum - base_path, kmod_filename = guess_kmod_path() logger.debug(f'Looking for pre-installed {kmod_filename} module in {base_path}') super_ = super() def preinstalled_broken(e): logger.debug(f'Pre-installed {kmod_filename} is unsuitable, recompiling: {e}') - return super_.install(kmod_params=kmod_params) + return super_.install() try: kmod_path = target.execute( @@ -2932,7 +2914,7 @@ def kmod_cm(): yield kmod_path try: - ret = self._install(kmod_cm(), kmod_params=kmod_params) + ret = self._install(kmod_cm()) except (TargetStableCalledProcessError, KmodVersionError) as e: ret = preinstalled_broken(e) else: diff --git a/lisa/trace.py b/lisa/trace.py index 651c065874..4b8b84d50c 100644 --- a/lisa/trace.py +++ b/lisa/trace.py @@ -6131,9 +6131,6 @@ def _get_kmod(cls, target, target_available_events, needed_events, kmod_features needed, functools.partial( kmod.run, - kmod_params={ - 'features': sorted(kmod._event_features(needed)) - } ), kmod_feat_config ) diff --git a/lisa/wa/plugins/_kmod.py b/lisa/wa/plugins/_kmod.py index 547a9765d5..447c558c1a 100644 --- a/lisa/wa/plugins/_kmod.py +++ b/lisa/wa/plugins/_kmod.py @@ -221,11 +221,7 @@ def _all_ftrace_events(self, context): def _run(self): features = sorted(self._features) self.logger.info(f'Enabling LISA kmod features {", ".join(features)}') - return self._kmod.run( - kmod_params={ - 'features': features, - } - ) + return self._kmod.run() @contextmanager def _initialize_cm(self, context):