# HG changeset patch # User root@vmi15.sky.yk.fujitsu.co.jp # Date 1201701338 -32400 # Node ID c60150a6af125c5c5a4685765da03a0a3e393b78 # Parent b79802517a75a23abb88eda900ff802810a6add6 This patch avoids debugger_trap when we don't expect it. kexec_crash() is called after debugger_trap_immediate(). Because we want to use the safe path at kexecing, we should avoid the debugger path. And the trap is a needless work. diff -r b79802517a75 -r c60150a6af12 xen/common/gdbstub.c --- a/xen/common/gdbstub.c Tue Jan 22 09:04:41 2008 -0700 +++ b/xen/common/gdbstub.c Wed Jan 30 22:55:38 2008 +0900 @@ -516,13 +516,13 @@ process_command(struct cpu_user_regs *re return resume; } -static struct gdb_context +struct gdb_context __gdb_ctx = { .serhnd = -1, .running = ATOMIC_INIT(1), .signum = 1 }; -static struct gdb_context *gdb_ctx = &__gdb_ctx; +struct gdb_context *gdb_ctx = &__gdb_ctx; static void gdbstub_console_puts(const char *str) diff -r b79802517a75 -r c60150a6af12 xen/include/asm-ia64/debugger.h --- a/xen/include/asm-ia64/debugger.h Tue Jan 22 09:04:41 2008 -0700 +++ b/xen/include/asm-ia64/debugger.h Wed Jan 30 22:55:38 2008 +0900 @@ -67,7 +67,11 @@ static inline int debugger_trap_fatal( #define ____debugger_trap_immediate(b) __asm__ __volatile__ ("break.m "#b"\n") #define __debugger_trap_immediate(b) ____debugger_trap_immediate(b) -#define debugger_trap_immediate() __debugger_trap_immediate(CDB_BREAK_NUM) +#define debugger_trap_immediate() \ +do { \ + if ( gdb_ctx->serhnd >= 0 ) \ + __debugger_trap_immediate(CDB_BREAK_NUM); \ +} while (0) //XXX temporal work around #ifndef CONFIG_SMP diff -r b79802517a75 -r c60150a6af12 xen/include/asm-powerpc/debugger.h --- a/xen/include/asm-powerpc/debugger.h Tue Jan 22 09:04:41 2008 -0700 +++ b/xen/include/asm-powerpc/debugger.h Wed Jan 30 22:55:38 2008 +0900 @@ -23,6 +23,9 @@ #define _ASM_DEBUGGER_H_ #include +#ifdef CRASH_DEBUG +#include +#endif extern void show_backtrace_regs(struct cpu_user_regs *); extern void show_backtrace(ulong sp, ulong lr, ulong pc); @@ -56,7 +59,8 @@ static inline void debugger_trap_immedia { dump_all_execution_state(); #ifdef CRASH_DEBUG - __builtin_trap(); + if ( gdb_ctx->serhnd >= 0 ) + __builtin_trap(); #endif } diff -r b79802517a75 -r c60150a6af12 xen/include/asm-x86/debugger.h --- a/xen/include/asm-x86/debugger.h Tue Jan 22 09:04:41 2008 -0700 +++ b/xen/include/asm-x86/debugger.h Wed Jan 30 22:55:38 2008 +0900 @@ -51,7 +51,11 @@ static inline int debugger_trap_fatal( } /* Int3 is a trivial way to gather cpu_user_regs context. */ -#define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); +#define debugger_trap_immediate() \ +do { \ + if ( gdb_ctx->serhnd >= 0 ) \ + __asm__ __volatile__ ( "int3" ); \ +} while (0) #else diff -r b79802517a75 -r c60150a6af12 xen/include/xen/gdbstub.h --- a/xen/include/xen/gdbstub.h Tue Jan 22 09:04:41 2008 -0700 +++ b/xen/include/xen/gdbstub.h Wed Jan 30 22:55:38 2008 +0900 @@ -47,6 +47,7 @@ struct gdb_context { unsigned long out_offset; u8 out_csum; }; +extern struct gdb_context *gdb_ctx; /* interface to arch specific routines */ void gdb_write_to_packet(