[Crash-utility] Two x86_64 specific patches to be applied

Dave Anderson anderson at redhat.com
Thu Dec 8 21:38:43 UTC 2005


FYI...

I will be updating the x86_64 backtrace code to search all of the
exception stacks for the origin of the active tasks' backtrace
when the info is not available in the dumpfile header.

Currently it first searches in the task's process stack, then the
per-cpu IRQ stack, and lastly the per-cpu NMI stack.  This patch
looks at all 3 exception stacks in 2.4 kernels (NMI, STACKFAULT
and DOUBLEFAULT), and all 5 exception stacks in 2.6 kernels
(NMI, STACKFAULT, DOUBLEFAULT, DEBUG and MCE).

The patch also removes an erroneous warning message re: the
task cpu not being the same as the IRQ or exception stack cpu
that gets displayed when doing a non-context-sensitive "bt -E",
again only on an x86_64.

Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20051208/0b9c3770/attachment.htm>
-------------- next part --------------
--- x86_64.c.orig	2005-12-08 16:20:02.000000000 -0500
+++ x86_64.c	2005-12-08 16:21:30.000000000 -0500
@@ -1490,7 +1490,7 @@ x86_64_in_exception_stack(struct bt_info
 			    (rsp < (ms->stkinfo.ebase[c][i] + 
 			    ms->stkinfo.esize))) {
 				estack = ms->stkinfo.ebase[c][i]; 
-				if (c != bt->tc->processor) 
+				if (CRASHDEBUG(1) && (c != bt->tc->processor)) 
 					error(INFO, 
       		                      "task cpu: %d  exception stack cpu: %d\n",
 						bt->tc->processor, c);
@@ -1523,7 +1523,7 @@ x86_64_in_irqstack(struct bt_info *bt) 
                 if ((rsp >= ms->stkinfo.ibase[c]) &&
                     (rsp < (ms->stkinfo.ibase[c] + ms->stkinfo.isize))) {
                 	irqstack = ms->stkinfo.ibase[c];
-                        if (c != bt->tc->processor) 
+                        if (CRASHDEBUG(1) && (c != bt->tc->processor)) 
                                 error(INFO, 
 			          "task cpu: %d  IRQ stack cpu: %d\n",
                                 	bt->tc->processor, c);
@@ -2311,7 +2311,7 @@ static void
 x86_64_get_dumpfile_stack_frame(struct bt_info *bt_in, ulong *rip, ulong *rsp) 
 {
 	int panic_task;
-        int i, panic, stage;
+        int i, estack, panic, stage;
         char *sym;
 	struct syment *sp;
         ulong *up;
@@ -2326,6 +2326,7 @@ x86_64_get_dumpfile_stack_frame(struct b
         ms = machdep->machspec;
 	ur_rip = ur_rsp = 0;
 	stage = 0;
+	estack = -1;
 
 	panic_task = tt->panic_task == bt->task ? TRUE : FALSE;
 
@@ -2372,7 +2373,7 @@ next_stack:
                         return;
                 }
 
-                if ((stage == 2) && 
+                if ((estack >= 0) && 
                     (STREQ(sym, "nmi_watchdog_tick") ||
                      STREQ(sym, "default_do_nmi"))) {
 			sp = x86_64_function_called_by((*up)-5);
@@ -2444,25 +2445,30 @@ skip_stage:
 		bt->stackbase = ms->stkinfo.ibase[bt->tc->processor];
 		bt->stacktop = ms->stkinfo.ibase[bt->tc->processor] + 
 			ms->stkinfo.isize;
+		console("x86_64_get_dumpfile_stack_frame: searching IRQ stack at %lx\n", 
+			bt->stackbase);
 		bt->stackbuf = ms->irqstack;
 		alter_stackbuf(bt);
 		stage = 1;
 		goto next_stack;
 
         /*
-         *  Check the NMI exception stack.
+         *  Check the exception stacks.
          */
 	case 1:
-		bt->stackbase = ms->stkinfo.ebase[bt->tc->processor][NMI_STACK];
-		bt->stacktop = ms->stkinfo.ebase[bt->tc->processor][NMI_STACK] +
-                       ms->stkinfo.esize;
+		if (++estack == 7)
+			break;
+		bt->stackbase = ms->stkinfo.ebase[bt->tc->processor][estack];
+		bt->stacktop = ms->stkinfo.ebase[bt->tc->processor][estack] +
+                	ms->stkinfo.esize;
+		console("x86_64_get_dumpfile_stack_frame: searching %s estack at %lx\n", 
+			x86_64_exception_stacks[estack], bt->stackbase);
+		if (!(bt->stackbase)) 
+			goto skip_stage;
 		bt->stackbuf = ms->irqstack;
 		alter_stackbuf(bt);
-		stage = 2;
 		goto next_stack;
 
-	case 2:
-		break;
 	}
 
 	/*


More information about the Crash-utility mailing list