[Crash-utility] [PATCH v2 08/25] modify bt -c to hide offline cpus' data

Qiao Nuohan qiaonuohan at cn.fujitsu.com
Mon Sep 29 02:09:06 UTC 2014


bt -c will display the stack trace of the active task on specified cpus.
This patch will hide offline cpus' data and print a message like "bt:
CPU xx is offline" to indicate the hide(xx is the id of the offline cpu).

The original output is like below:
<cut>
crash> bt -c 2,3
PID: 0      TASK: ffff88003f380040  CPU: 2   COMMAND: "swapper"
 #0 [ffff88003f3adf00] cpu_idle at ffffffff8100a00b

PID: 22     TASK: ffff88003f3fb500  CPU: 3   COMMAND: "events/3"
 #0 [ffff880002387e90] crash_nmi_callback at ffffffff8102fee6
 #1 [ffff880002387ea0] notifier_call_chain at ffffffff8152d515
 #2 [ffff880002387ee0] atomic_notifier_call_chain at ffffffff8152d57a
 #3 [ffff880002387ef0] notify_die at ffffffff810a154e
 #4 [ffff880002387f20] do_nmi at ffffffff8152b1db
 #5 [ffff880002387f50] nmi at ffffffff8152aaa0
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> bt -c 2,3
bt: CPU 2 is OFFLINE.

PID: 22     TASK: ffff88003f3fb500  CPU: 3   COMMAND: "events/3"
 #0 [ffff880002387e90] crash_nmi_callback at ffffffff8102fee6
 #1 [ffff880002387ea0] notifier_call_chain at ffffffff8152d515
 #2 [ffff880002387ee0] atomic_notifier_call_chain at ffffffff8152d57a
 #3 [ffff880002387ef0] notify_die at ffffffff810a154e
 #4 [ffff880002387f20] do_nmi at ffffffff8152b1db
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
---
 kernel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel.c b/kernel.c
index 8948c84..f5f98ca 100755
--- a/kernel.c
+++ b/kernel.c
@@ -2261,6 +2261,12 @@ cmd_bt(void)
 
 		for (i = 0; i < kt->cpus; i++) {
 			if (NUM_IN_BITMAP(cpus, i)) {
+				if (hide_offline_cpu(i)) {
+					error(INFO, "%sCPU %d is OFFLINE.\n",
+					      subsequent++ ? "\n" : "", i);
+					continue;
+				}
+
 				if ((task = get_active_task(i)))
 					tc = task_to_context(task);
 				else
-- 
1.8.5.3




More information about the Crash-utility mailing list