lkml.org 
[lkml]   [2006]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 15/61] lock validator: x86_64: use stacktrace to generate backtraces
    From: Ingo Molnar <mingo@elte.hu>

    this switches x86_64 to use the stacktrace infrastructure when generating
    backtrace printouts, if CONFIG_FRAME_POINTER=y. (This patch will go away
    once the dwarf2 stackframe parser in -mm goes upstream.)

    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
    ---
    arch/x86_64/kernel/traps.c | 35 +++++++++++++++++++++++++++++++++--
    1 file changed, 33 insertions(+), 2 deletions(-)

    Index: linux/arch/x86_64/kernel/traps.c
    ===================================================================
    --- linux.orig/arch/x86_64/kernel/traps.c
    +++ linux/arch/x86_64/kernel/traps.c
    @@ -235,7 +235,31 @@ in_exception_stack(unsigned cpu, unsigne
    * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
    */

    -void show_trace(unsigned long *stack)
    +#ifdef CONFIG_FRAME_POINTER
    +
    +#include <linux/stacktrace.h>
    +
    +#define MAX_TRACE_ENTRIES 64
    +
    +static void __show_trace(struct task_struct *task, unsigned long *stack)
    +{
    + unsigned long entries[MAX_TRACE_ENTRIES];
    + struct stack_trace trace;
    +
    + trace.nr_entries = 0;
    + trace.max_entries = MAX_TRACE_ENTRIES;
    + trace.entries = entries;
    +
    + save_stack_trace(&trace, task, 1, 0);
    +
    + pr_debug("got %d/%d entries.\n", trace.nr_entries, trace.max_entries);
    +
    + print_stack_trace(&trace, 4);
    +}
    +
    +#else
    +
    +void __show_trace(struct task_struct *task, unsigned long *stack)
    {
    const unsigned cpu = safe_smp_processor_id();
    unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
    @@ -319,6 +343,13 @@ void show_trace(unsigned long *stack)
    printk("\n");
    }

    +#endif
    +
    +void show_trace(unsigned long *stack)
    +{
    + __show_trace(current, stack);
    +}
    +
    void show_stack(struct task_struct *tsk, unsigned long * rsp)
    {
    unsigned long *stack;
    @@ -353,7 +384,7 @@ void show_stack(struct task_struct *tsk,
    printk("%016lx ", *stack++);
    touch_nmi_watchdog();
    }
    - show_trace((unsigned long *)rsp);
    + __show_trace(tsk, (unsigned long *)rsp);
    }

    /*
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2006-05-29 23:47    [W:0.024 / U:59.604 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site