From e5a09d8da57965967929e9342cdcb539303e7448 Mon Sep 17 00:00:00 2001 From: Woody Lin Date: Wed, 22 Apr 2020 10:18:59 +0800 Subject: [PATCH] llkd: Print thread group before panic the kernel Debugging information for addressing the reason why the process stops as a zombie, can be found by observing the call trace and running status of threads in thread group of the zombie process. Bug: 154667692 Change-Id: Icd7fa2161e88b08fd5ce0d5dc3a3790ed4ac02d1 --- llkd/libllkd.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/llkd/libllkd.cpp b/llkd/libllkd.cpp index 1c3acb821..8ad9900ec 100644 --- a/llkd/libllkd.cpp +++ b/llkd/libllkd.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -1204,9 +1205,19 @@ milliseconds llkCheck(bool checkRunning) { } } // We are here because we have confirmed kernel live-lock + std::vector threads; + auto taskdir = procdir + std::to_string(tid) + "/task/"; + dir taskDirectory(taskdir); + for (auto tp = taskDirectory.read(); tp != nullptr; tp = taskDirectory.read()) { + std::string piddir; + if (getValidTidDir(tp, &piddir)) + threads.push_back(android::base::Basename(piddir)); + } const auto message = state + " "s + llkFormat(procp->count) + " " + std::to_string(ppid) + "->" + std::to_string(pid) + "->" + - std::to_string(tid) + " " + process_comm + " [panic]"; + std::to_string(tid) + " " + process_comm + " [panic]\n" + + " thread group: {" + android::base::Join(threads, ",") + + "}"; llkPanicKernel(dump, tid, (state == 'Z') ? "zombie" : (state == 'D') ? "driver" : "sleeping", message);