[Crash-utility] [PATCH v2 04/25] x86_64: modify bt -E to hide offline cpus' data

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


bt -E will search all irq stacks and exception stacks for possible
exception frames. With this patch offline cpus will be hiden.

The original output will be like:
<cut>
crash> bt -E
CPU 0 IRQ STACK:
(none found)

CPU 1 IRQ STACK:
(none found)

CPU 2 IRQ STACK:
(none found)

CPU 3 IRQ STACK:
(none found)
...
CPU 2 STACKFAULT EXCEPTION STACK:
(none found)

CPU 2 DOUBLEFAULT EXCEPTION STACK:
(none found)

CPU 2 NMI EXCEPTION STACK:
(none found)

CPU 2 DEBUG EXCEPTION STACK:
(none found)

CPU 2 MCE EXCEPTION STACK:
(none found)
...
<cut>

With data of offline cpu hiden, the output is like:
<cut>
crash> bt -E
CPU 0 IRQ STACK:
(none found)

CPU 1 IRQ STACK:
(none found)

CPU 2 IRQ STACK: <OFFLINE>

CPU 3 IRQ STACK:
(none found)
...
CPU 2 STACKFAULT EXCEPTION STACK: <OFFLINE>

CPU 2 DOUBLEFAULT EXCEPTION STACK: <OFFLINE>

CPU 2 NMI EXCEPTION STACK: <OFFLINE>

CPU 2 DEBUG EXCEPTION STACK: <OFFLINE>

CPU 2 MCE EXCEPTION STACK: <OFFLINE>
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
---
 x86_64.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index 9aa6432..19f2d48 100755
--- a/x86_64.c
+++ b/x86_64.c
@@ -2348,7 +2348,14 @@ x86_64_eframe_search(struct bt_info *bt)
                 	if (ms->stkinfo.ibase[c] == 0)
                         	break;
                                 bt->hp->esp = ms->stkinfo.ibase[c];
-                                fprintf(fp, "CPU %d IRQ STACK:\n", c);
+                                fprintf(fp, "CPU %d IRQ STACK:", c);
+
+				if (hide_offline_cpu(c)) {
+					fprintf(fp, " <OFFLINE>\n\n");
+					continue;
+				} else
+					fprintf(fp, "\n");
+
                                 if ((cnt = x86_64_eframe_search(bt)))
 					fprintf(fp, "\n");
 				else
@@ -2360,8 +2367,15 @@ x86_64_eframe_search(struct bt_info *bt)
                         	if (ms->stkinfo.ebase[c][i] == 0)
                                 	break;
                                 bt->hp->esp = ms->stkinfo.ebase[c][i];
-                                fprintf(fp, "CPU %d %s EXCEPTION STACK:\n", 
+                                fprintf(fp, "CPU %d %s EXCEPTION STACK:",
 					c, x86_64_exception_stacks[i]);
+
+				if (hide_offline_cpu(c)) {
+					fprintf(fp, " <OFFLINE>\n\n");
+					continue;
+				} else
+					fprintf(fp, "\n");
+
                                 if ((cnt = x86_64_eframe_search(bt)))
 					fprintf(fp, "\n");
 				else
-- 
1.8.5.3




More information about the Crash-utility mailing list