Here is a patch against crash v6.0.2 that adds duplicate node detection
per-CPU for the CFS runqueue display in dump_CFS_runqueues() for the
runq command.

This resolves the failure to bail-out of the unending looping display I
get with the crash dump I have that has a corrupted CFS runqueue
containing a loop.

Signed-off-by: David Mair <[email protected]>
---

 task.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/task.c b/task.c
index 433a043..0333fe8 100755
--- a/task.c
+++ b/task.c
@@ -7050,7 +7050,12 @@ dump_tasks_in_cfs_rq(ulong cfs_rq, ulong skip)
                                     OFFSET(sched_entity_run_node));
                if (!tc)
                        continue;
-               dump_task_runq_entry(tc);
+               if (hq_enter((ulong)tc)) {
+                       dump_task_runq_entry(tc);
+               } else {
+                       error(WARNING, "Duplicate CFS runqueue node, task %lx, 
probable
loop\n", tc->task);
+                       return total;
+               }
                total++;
        }

@@ -7217,10 +7222,12 @@ dump_CFS_runqueues(void)
                fprintf(fp, "  CFS RB_ROOT: %lx\n", (ulong)root);

                tot = 0;
+               hq_open();
                if (curr_cfs_rq)
                        tot += dump_tasks_in_cfs_rq(curr_cfs_rq, 0);
                if (cfs_rq != curr_cfs_rq)
                        tot += dump_tasks_in_cfs_rq(cfs_rq, curr_cfs_rq);
+               hq_close();
                if (!tot) {
                        INDENT(5);
                        fprintf(fp, "[no tasks queued]\n");

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to