Skip to content

Commit

Permalink
lisa._kmod: Remove kmod parameters
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Pierre Gondois <[email protected]>
  • Loading branch information
pierregondois committed Jan 4, 2024
1 parent f6278c4 commit 18d98cf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 38 deletions.
6 changes: 1 addition & 5 deletions lisa/_cli_tools/lisa_load_kmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
32 changes: 7 additions & 25 deletions lisa/_kmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions lisa/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
6 changes: 1 addition & 5 deletions lisa/wa/plugins/_kmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 18d98cf

Please sign in to comment.