From 46d65e73d3d673741aaeef86203e3079acc8948b Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Thu, 25 May 2023 10:24:11 +0100 Subject: [PATCH 1/2] .github/workflows/test.yml: Take into account matrix in concurrency group --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e7d00e6d3..668a7375d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: # Cancel current runs of the workflow if we trigger it again for the same # ref. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.ref }} cancel-in-progress: true -- GitLab From 821dea7e6164940731e4f19b50abce3014ee7e1b Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Thu, 25 May 2023 10:17:29 +0100 Subject: [PATCH 2/2] lisa.trace: Fix FtraceCollector(events=['print']) FIX Fix event validation when using FtraceCollector with some events that ftrace does not allow to configure. --- lisa/trace.py | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/lisa/trace.py b/lisa/trace.py index 001095343..3f546f2a9 100644 --- a/lisa/trace.py +++ b/lisa/trace.py @@ -5714,7 +5714,7 @@ class FtraceCollector(CollectorBase, Configurable): raise ValueError("The target's kernel needs CONFIG_FTRACE=y kconfig enabled") tracing_path = devlib.FtraceCollector.find_tracing_path(target) - target_available_events = set(self._target_available_events(target, tracing_path)) + target_available_events, avoided = self._target_available_events(target, tracing_path) kmod = target.get_kmod(LISAFtraceDynamicKmod) # Get the events possibly defined in the module. Note that it's a @@ -5735,13 +5735,6 @@ class FtraceCollector(CollectorBase, Configurable): else: events = AndTraceEventChecker.from_events(set(events)) - # trace-cmd start complains if given these events, even though they are - # valid - avoided = { - 'funcgraph_entry', 'funcgraph_exit', - 'print', 'bprint', 'bputs', - } - def is_pattern(s): return '*' in s or '?' in s or '[' in s or ']' in s @@ -5833,10 +5826,7 @@ class FtraceCollector(CollectorBase, Configurable): meta_events = { event for event in meta_events - if any( - event in satisfied or event in avoided - for event in Trace.get_event_sources(event) - ) + if satisfied & set(Trace.get_event_sources(event)) } functions = functions or [] @@ -5926,9 +5916,19 @@ class FtraceCollector(CollectorBase, Configurable): except MissingTraceEventError as e: self.logger.info(f'Optional events missing: {str(e)}') - self.events = sorted(events | meta_events) - if not self.events: + if not events: raise ValueError('No ftrace events selected') + + self.events = sorted(events | meta_events) + + # Some events are "special" and cannot be disabled or enabled. We + # therefore cannot pass them to trace-cmd. + events -= avoided + # trace-cmd fails if passed no events, which is an issue since we + # cannot pass e.g. "print" event. + if not events: + events |= {'sched_switch'} + events = sorted(events) self._cm = None @@ -5951,6 +5951,7 @@ class FtraceCollector(CollectorBase, Configurable): # our own binary no_install=True, tracing_path=tracing_path, + strict=True, **kwargs ) super().__init__(collector, output_path=output_path) @@ -6017,10 +6018,19 @@ class FtraceCollector(CollectorBase, Configurable): @staticmethod def _target_available_events(target, tracing_path): events = target.read_value(target.path.join(tracing_path, 'available_events')) - return set( + + # trace-cmd start complains if given these events, even though they are + # valid + avoided = set(target.list_directory(target.path.join(tracing_path, 'events', 'ftrace'))) + + available = set( event.split(':', 1)[1] for event in events.splitlines() ) + # These events are available, but we still cannot pass them to trace-cmd record + available.update(avoided) + + return (available, avoided) @classmethod @kwargs_forwarded_to(__init__) -- GitLab