[PATCH 3/5] rteval: kernel.py: Add support for kthreads running with deadline policy

Punit Agrawal
2021-09-01T08:08:45Z

From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>

When running rteval on a system with kthreads running with "deadline"
policy, an exception is encountered when parsing the output of "ps".

[DEBUG] cmd: /usr/bin/ps -eocommand,pid,policy,rtprio,comm
Traceback (most recent call last):
...
File "...rteval/rteval/sysinfo/kernel.py", line 60, in kernel_get_kthreads
ret_kthreads[v[0]] = {'policy' : policies[bytes.decode(v[1])],
KeyError: 'DLN'

The kernel uses deadline policy for "schedutil" cpufreq governor
threads. Fix the crash in rteval by adding support for "deadline" to
the list of policies.

Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
---
rteval/sysinfo/kernel.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rteval/sysinfo/kernel.py b/rteval/sysinfo/kernel.py
index 97ad9402b13e..f2e9d72ac2ef 100644
--- a/rteval/sysinfo/kernel.py
+++ b/rteval/sysinfo/kernel.py
@@ -44,7 +44,7 @@ class KernelInfo:

def kernel_get_kthreads(self):
- policies = {'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown'}
+ policies = {'DLN': 'deadline', 'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown'}
ret_kthreads = {}
self.__log(Log.DEBUG, "getting kthread status")
cmd = '%s -eocommand,pid,policy,rtprio,comm' % getcmdpath('ps')
--
2.32.0