[PATCH] rteval: Fix timerlat module for rtla short option parsing bug

John Kacur <[email protected]> Wed, 3 Jun 2026 15:40:34 -0400
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
rtla-7.1.0-rc6 has a bug parsing multi-character short options with
attached arguments (e.g., -p100, -c0-15, -E100). This causes the
timerlat measurement module to fail when invoking rtla with these
option formats.

Change the timerlat module to use space-separated arguments instead
of attached arguments:
  - Before: -p100 -c0-15 -E100 -T1000
  - After:  -p 100 -c 0-15 -E 100 -T 1000

This ensures compatibility with both affected rtla versions and
future versions where the bug is fixed. The space-separated format
works correctly in all versions once the upstream fix is applied.

Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <[email protected]>
---
 rteval/modules/measurement/timerlat.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/rteval/modules/measurement/timerlat.py b/rteval/modules/measurement/timerlat.py
index 03faa08639d5..a3219e216296 100644
--- a/rteval/modules/measurement/timerlat.py
+++ b/rteval/modules/measurement/timerlat.py
@@ -236,10 +236,14 @@ class Timerlat(rtevalModulePrototype):
         self._setReady()
 
     def _WorkloadPrepare(self):
-        self.__interval = 'interval' in self.__cfg and f'-p{int(self.__cfg.interval)}' or ""
-        self.__cmd = ['rtla', 'timerlat', 'hist', self.__interval, '-P', f'f:{int(self.__priority)}', '-u']
-        self.__cmd.append(f'-c{self.__cpulist}')
-        self.__cmd.append(f'-E{self.__buckets}')
+        # Use space-separated arguments to avoid rtla short option parsing bug
+        # with attached arguments (e.g., -p100 vs -p 100)
+        self.__cmd = ['rtla', 'timerlat', 'hist']
+        if 'interval' in self.__cfg:
+            self.__cmd.extend(['-p', str(int(self.__cfg.interval))])
+        self.__cmd.extend(['-P', f'f:{int(self.__priority)}', '-u'])
+        self.__cmd.extend(['-c', self.__cpulist])
+        self.__cmd.extend(['-E', str(self.__buckets)])
         self.__cmd.append('--no-summary')
         # Disable auto-analysis
         self.__cmd.append('--no-aa')
@@ -251,13 +255,13 @@ class Timerlat(rtevalModulePrototype):
             self.__cmd.append(f'--dma-latency={dma_latency}')
 
         if self.__cfg.stoptrace:
-            self.__cmd.append(f"-T{int(self.__cfg.stoptrace)}")
+            self.__cmd.extend(['-T', str(int(self.__cfg.stoptrace))])
 
         if self.__cfg.trace:
             if not self.__cfg.stoptrace:
                 self._log(Log.WARN, f'Ignoring trace={self.__cfg.trace}, because stoptrace not invoked')
             else:
-                self.__cmd.append(f'-t={self.__cfg.trace}')
+                self.__cmd.extend(['-t', self.__cfg.trace])
 
         self._log(Log.DEBUG, f'self.__cmd = {self.__cmd}')
 
-- 
2.54.0