am 4ba4e03e: Merge "also add backtraces of CPUs before watchdog kills system server" into lmp-mr1-dev

* commit '4ba4e03e6b8dcb556774b323429f8904676cd615':
  also add backtraces of CPUs before watchdog kills system server
This commit is contained in:
Guang Zhu
2014-10-30 21:00:34 +00:00
committed by Android Git Automerger

View File

@@ -415,15 +415,9 @@ public class Watchdog extends Thread {
dumpKernelStackTraces(); dumpKernelStackTraces();
} }
// Trigger the kernel to dump all blocked threads to the kernel log // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the kernel log
try { doSysRq('w');
FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger"); doSysRq('l');
sysrq_trigger.write("w");
sysrq_trigger.close();
} catch (IOException e) {
Slog.e(TAG, "Failed to write to /proc/sysrq-trigger");
Slog.e(TAG, e.getMessage());
}
// Try to add the error to the dropbox, but assuming that the ActivityManager // Try to add the error to the dropbox, but assuming that the ActivityManager
// itself may be deadlocked. (which has happened, causing this statement to // itself may be deadlocked. (which has happened, causing this statement to
@@ -488,6 +482,16 @@ public class Watchdog extends Thread {
} }
} }
private void doSysRq(char c) {
try {
FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
sysrq_trigger.write(c);
sysrq_trigger.close();
} catch (IOException e) {
Slog.w(TAG, "Failed to write to /proc/sysrq-trigger", e);
}
}
private File dumpKernelStackTraces() { private File dumpKernelStackTraces() {
String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null); String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
if (tracesPath == null || tracesPath.length() == 0) { if (tracesPath == null || tracesPath.length() == 0) {