llkd: report stack signature matched

Adjusted debugging messaging to add clarity.  Report _which_ stack
signature matched that triggered the kernel panic.  Reduce the noise
associated with missing /stack to VERBOSE as that is for development
debugging only.

Test: observe during unit test we see something like following logs:

livelock: Found SyS_openat in stack for pid XXX
livelock: S 120.000s XXX->YYY port-bridge [kill]
livelock: Killing '/vendor/bin/port-bridge' (XXX) to check forward\
          scheduling progress in S state for\
          '/vendor/bin/port-bridge' (YYY)
. . .
livelock: Found SyS_openat in stack for pid XXXXX
livelock: S 120.000s XXXXX->XXXXX llkd_unit_test [kill]
livelock: Killing '/data/nativetest64/llkd_unit_test/llkd_unit_test\
          (XXXXX) to check forward scheduling progress in S state

Test: llkd_unit_test
Bug: 33808187
Change-Id: Ifac7dd9a656208563bb20e28739abb741358d964
This commit is contained in:
Mark Salyzyn 2019-01-02 15:04:42 -08:00
parent 1476931e02
commit 22e05fb5a4

View file

@ -737,19 +737,21 @@ bool llkCheckStack(proc* procp, const std::string& piddir) {
auto kernel_stack = ReadFile(piddir + "/stack");
if (kernel_stack.empty()) {
LOG(INFO) << piddir << "/stack empty comm=" << procp->getComm()
<< " cmdline=" << procp->getCmdline();
LOG(VERBOSE) << piddir << "/stack empty comm=" << procp->getComm()
<< " cmdline=" << procp->getCmdline();
return false;
}
// A scheduling incident that should not reset count_stack
if (kernel_stack.find(" cpu_worker_pools+0x") != std::string::npos) return false;
char idx = -1;
char match = -1;
std::string matched_stack_symbol = "<unknown>";
for (const auto& stack : llkCheckStackSymbols) {
if (++idx < 0) break;
if ((kernel_stack.find(" "s + stack + "+0x") != std::string::npos) ||
(kernel_stack.find(" "s + stack + ".cfi+0x") != std::string::npos)) {
match = idx;
matched_stack_symbol = stack;
break;
}
}
@ -760,7 +762,9 @@ bool llkCheckStack(proc* procp, const std::string& piddir) {
}
if (match == char(-1)) return false;
procp->count_stack += llkCycle;
return procp->count_stack >= llkStateTimeoutMs[llkStateStack];
if (procp->count_stack < llkStateTimeoutMs[llkStateStack]) return false;
LOG(WARNING) << "Found " << matched_stack_symbol << " in stack for pid " << procp->pid;
return true;
}
#endif