sparc64: Add save_stack_trace_tsk().
authorDavid S. Miller <davem@davemloft.net>
Fri, 28 Nov 2008 09:19:41 +0000 (01:19 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Dec 2008 17:17:09 +0000 (09:17 -0800)
And this allows us to indicate HAVE_LATENCYTOP_SUPPORT.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/Kconfig
arch/sparc64/kernel/stacktrace.c

index 10945c344304a1636222265fc688ae305a83a923..e162535316240f6c39306d8f2e3c6f01c6b5bd17 100644 (file)
@@ -72,6 +72,10 @@ config LOCKDEP_SUPPORT
        bool
        default y if SPARC64
 
+config HAVE_LATENCYTOP_SUPPORT
+       bool
+       default y if SPARC64
+
 config AUDIT_ARCH
        bool
        default y if SPARC64
index 4e21d4a57d3b3f2ea536ed5707d61fbf6bc94181..acb12f6737570ebb7e4e8a98d8c4e741e1cb50b4 100644 (file)
@@ -7,17 +7,18 @@
 
 #include "kstack.h"
 
-void save_stack_trace(struct stack_trace *trace)
+static void __save_stack_trace(struct thread_info *tp,
+                              struct stack_trace *trace,
+                              bool skip_sched)
 {
-       struct thread_info *tp = task_thread_info(current);
        unsigned long ksp, fp;
 
-       stack_trace_flush();
-
-       __asm__ __volatile__(
-               "mov    %%fp, %0"
-               : "=r" (ksp)
-       );
+       if (tp == current_thread_info()) {
+               stack_trace_flush();
+               __asm__ __volatile__("mov %%fp, %0" : "=r" (ksp));
+       } else {
+               ksp = tp->ksp;
+       }
 
        fp = ksp + STACK_BIAS;
        do {
@@ -43,8 +44,21 @@ void save_stack_trace(struct stack_trace *trace)
 
                if (trace->skip > 0)
                        trace->skip--;
-               else
+               else if (!skip_sched || !in_sched_functions(pc))
                        trace->entries[trace->nr_entries++] = pc;
        } while (trace->nr_entries < trace->max_entries);
 }
+
+void save_stack_trace(struct stack_trace *trace)
+{
+       __save_stack_trace(current_thread_info(), trace, false);
+}
 EXPORT_SYMBOL_GPL(save_stack_trace);
+
+void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
+{
+       struct thread_info *tp = task_thread_info(tsk);
+
+       __save_stack_trace(tp, trace, true);
+}
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);