[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/kernel/devel linux-2.6-xen-x86-unwinder.patch,1.1,1.2



Author: davej

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv32613

Modified Files:
	linux-2.6-xen-x86-unwinder.patch 
Log Message:
garg

linux-2.6-xen-x86-unwinder.patch:
 include/asm-x86_64/mach-xen/asm/stacktrace.h       |   18 +++
 linux-2.6.18.noarch/arch/x86_64/kernel/traps-xen.c |  100 ++++++++++++++++-----
 2 files changed, 95 insertions(+), 23 deletions(-)

Index: linux-2.6-xen-x86-unwinder.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-xen-x86-unwinder.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-xen-x86-unwinder.patch	4 Oct 2006 04:53:02 -0000	1.1
+++ linux-2.6-xen-x86-unwinder.patch	4 Oct 2006 05:51:38 -0000	1.2
@@ -1,3 +1,217 @@
+--- linux-2.6.18.noarch/arch/x86_64/kernel/traps-xen.c~	2006-10-04 01:43:48.000000000 -0400
++++ linux-2.6.18.noarch/arch/x86_64/kernel/traps-xen.c	2006-10-04 01:50:55.000000000 -0400
+@@ -45,6 +45,7 @@
+ #include <asm/pda.h>
+ #include <asm/proto.h>
+ #include <asm/nmi.h>
++#include <asm/stacktrace.h>
+ 
+ asmlinkage void divide_error(void);
+ asmlinkage void debug(void);
+@@ -144,7 +145,7 @@ void printk_address(unsigned long addres
+ #endif
+ 
+ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
+-					unsigned *usedp, const char **idp)
++					unsigned *usedp, char **idp)
+ {
+ #ifndef CONFIG_X86_NO_TSS
+ 	static char ids[][8] = {
+@@ -238,15 +239,21 @@ static unsigned long *in_exception_stack
+ 	return NULL;
+ }
+ 
+-static int show_trace_unwind(struct unwind_frame_info *info, void *context)
++struct ops_and_data {
++	struct stacktrace_ops *ops;
++	void *data;
++};
++
++static int dump_trace_unwind(struct unwind_frame_info *info, void *context)
+ {
++	struct ops_and_data *oad = (struct ops_and_data *)context;
+ 	int n = 0;
+ 
+ 	while (unwind(info) == 0 && UNW_PC(info)) {
+ 		if (arch_unw_user_mode(info))
+ 			break;
+ 		n++;
+-		printk_address(UNW_PC(info));
++		oad->ops->address(oad->data, UNW_PC(info));
+ 	}
+ 	return n;
+ }
+@@ -258,46 +265,53 @@ static int show_trace_unwind(struct unwi
+  * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
+  */
+ 
+-void show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack)
++void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack,
++	struct stacktrace_ops *ops, void *data)
+ {
+ 	const unsigned cpu = safe_smp_processor_id();
+ 	unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
+ 	unsigned used = 0;
+ 
+-	printk("\nCall Trace:\n");
+-
+ 	if (!tsk)
+ 		tsk = current;
+ 
+ 	if (call_trace >= 0) {
+ 		int unw_ret = 0;
+ 		struct unwind_frame_info info;
++		struct ops_and_data oad = { .ops = ops, .data = data };
+ 
+ 		if (regs) {
+ 			if (unwind_init_frame_info(&info, tsk, regs) == 0)
+-				unw_ret = show_trace_unwind(&info, NULL);
++				unw_ret = dump_trace_unwind(&info, &oad);
+ 		} else if (tsk == current)
+-			unw_ret = unwind_init_running(&info, show_trace_unwind, NULL);
++			unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad);
+ 		else {
+ 			if (unwind_init_blocked(&info, tsk) == 0)
+-				unw_ret = show_trace_unwind(&info, NULL);
++				unw_ret = dump_trace_unwind(&info, &oad);
+ 		}
+ 		if (unw_ret > 0) {
+ 			if (call_trace == 1 && !arch_unw_user_mode(&info)) {
+-				print_symbol("DWARF2 unwinder stuck at %s\n",
++				ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n",
+ 					     UNW_PC(&info));
+ 				if ((long)UNW_SP(&info) < 0) {
+-					printk("Leftover inexact backtrace:\n");
++					ops->warning(data, "Leftover inexact backtrace:\n");
+ 					stack = (unsigned long *)UNW_SP(&info);
+ 				} else
+-					printk("Full inexact backtrace again:\n");
++					ops->warning(data, "Full inexact backtrace again:\n");
+ 			} else if (call_trace >= 1)
+ 				return;
+ 			else
+-				printk("Full inexact backtrace again:\n");
++				ops->warning(data, "Full inexact backtrace again:\n");
+ 		} else
+-			printk("Inexact backtrace:\n");
++			ops->warning(data, "Inexact backtrace:\n");
+ 	}
++	if (!stack) {
++		unsigned long dummy;
++		stack = &dummy;
++		if (tsk && tsk != current)
++			stack = (unsigned long *)tsk->thread.rsp;
++	}
++
+  	/*
+  	 * Print function call entries within a stack. 'cond' is the
+  	 * "end of stackframe" condition, that the 'stack++'
+@@ -315,7 +329,7 @@ void show_trace(struct task_struct *tsk,
+ 			 * down the cause of the crash will be able to figure \
+ 			 * out the call path that was taken. \
+ 			 */ \
+-			printk_address(addr); \
++			ops->address(data, addr); \
+ 		} \
+ 	} while (0)
+ 
+@@ -324,16 +338,17 @@ void show_trace(struct task_struct *tsk,
+ 	 * current stack address. If the stacks consist of nested
+ 	 * exceptions
+ 	 */
+-	for ( ; ; ) {
+-		const char *id;
++	for (;;) {
++		char *id;
+ 		unsigned long *estack_end;
+ 		estack_end = in_exception_stack(cpu, (unsigned long)stack,
+ 						&used, &id);
+ 
+ 		if (estack_end) {
+-			printk(" <%s>", id);
++			if (ops->stack(data, id) < 0)
++				 break;
+ 			HANDLE_STACK (stack < estack_end);
+-			printk(" <EOE>");
++			ops->stack(data, "<EOE>");
+ 			/*
+ 			 * We link to the next stack via the
+ 			 * second-to-last pointer (index -2 to end) in the
+@@ -348,7 +363,8 @@ void show_trace(struct task_struct *tsk,
+ 				(IRQSTACKSIZE - 64) / sizeof(*irqstack);
+ 
+ 			if (stack >= irqstack && stack < irqstack_end) {
+-				printk(" <IRQ>");
++				if (ops->stack(data, "IRQ") < 0)
++					break;
+ 				HANDLE_STACK (stack < irqstack_end);
+ 				/*
+ 				 * We link to the next stack (which would be
+@@ -357,7 +373,7 @@ void show_trace(struct task_struct *tsk,
+ 				 */
+ 				stack = (unsigned long *) (irqstack_end[-1]);
+ 				irqstack_end = NULL;
+-				printk(" <EOI>");
++				ops->stack(data, "EOI");
+ 				continue;
+ 			}
+ 		}
+@@ -365,15 +381,53 @@ void show_trace(struct task_struct *tsk,
+ 	}
+ 
+ 	/*
+-	 * This prints the process stack:
++	 * This handles the process stack:
+ 	 */
+ 	HANDLE_STACK (((long) stack & (THREAD_SIZE-1)) != 0);
+ #undef HANDLE_STACK
++}
++EXPORT_SYMBOL(dump_trace);
+ 
++static void
++print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
++{
++	print_symbol(msg, symbol);
++	printk("\n");
++}
++
++static void print_trace_warning(void *data, char *msg)
++{
++	printk("%s\n", msg);
++}
++
++static int print_trace_stack(void *data, char *name)
++{
++	printk(" <%s> ", name);
++	return 0;
++}
++
++static void print_trace_address(void *data, unsigned long addr)
++{
++	printk_address(addr);
++}
++
++static struct stacktrace_ops print_trace_ops = {
++	.warning = print_trace_warning,
++	.warning_symbol = print_trace_warning_symbol,
++	.stack = print_trace_stack,
++	.address = print_trace_address,
++};
++
++void
++show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack)
++{
++	printk("\nCall Trace:\n");
++	dump_trace(tsk, regs, stack, &print_trace_ops, NULL);
+ 	printk("\n");
+ }
+ 
+-static void _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long * rsp)
++static void
++_show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp)
+ {
+ 	unsigned long *stack;
+ 	int i;
 --- vanilla/include/asm-x86_64/mach-xen/asm/stacktrace.h	1969-12-31 19:00:00.000000000 -0500
 +++ linux-2.6.18.noarch/include/asm-x86_64/mach-xen/asm/stacktrace.h	2006-10-04 00:39:51.000000000 -0400
 @@ -0,0 +1,18 @@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]