From d3fb4a90a2773908ad4f244bee6b1bd2bba79911 Mon Sep 17 00:00:00 2001
From: Pavankumar Kondeti <pkondeti@codeaurora.org>
Date: Thu, 14 Mar 2019 08:46:06 +0530
Subject: [PATCH] lrdp_v2: Fix DL tasks prio in taskdump module

DL (SCHED_DEADLINE) tasks don't have any priority. They will be
scheduled in EDF (Early Deadline First) fashion. In task_struct,
the prio for such tasks would be -1. The current code treats
prio as an unsigned int and prints DL task prio as 4294967295.
Cast the prio to int before printing it.

Change-Id: Ib92417eeb361fc15d9d536eafe5dfe1baec06d20
---
 linux-ramdump-parser-v2/parsers/taskdump.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux-ramdump-parser-v2/parsers/taskdump.py b/linux-ramdump-parser-v2/parsers/taskdump.py
index 31b2d37..207583f 100755
--- a/linux-ramdump-parser-v2/parsers/taskdump.py
+++ b/linux-ramdump-parser-v2/parsers/taskdump.py
@@ -14,6 +14,7 @@ from print_out import print_out_str
 from parser_util import register_parser, RamParser, cleanupString
 taskhighlight_out = None
 highlight_tasks = "\n=====List of all runing and uninterruptable sleep process====\n"
+import ctypes
 
 def find_panic(ramdump, addr_stack, thread_task_name):
     if ramdump.arm64:
@@ -81,6 +82,8 @@ def dump_thread_group(ramdump, thread_group, task_out, taskhighlight_out, check_
         thread_task_prio = ramdump.read_int(next_thread_prio)
         if thread_task_prio is None:
             return
+        # Task prio is an integer and it can be -1 for DL tasks.
+        thread_task_prio = ctypes.c_int(thread_task_prio).value
         thread_task_pid = ramdump.read_int(next_thread_pid)
         if thread_task_pid is None:
             return
-- 
GitLab