# define DEBUG_SUBSYSTEM S_LNET
#include <libcfs/libcfs.h>
-#include <libcfs/linux/portals_compat25.h>
#include "tracefile.h"
#ifdef __KERNEL__
-#ifdef HAVE_DUMP_TRACE
+#ifdef CONFIG_X86
#include <linux/nmi.h>
#include <asm/stacktrace.h>
return 0;
}
-#ifdef HAVE_TRACE_ADDRESS_RELIABLE
-# define RELIABLE reliable
-# define DUMP_TRACE_CONST const
static void print_trace_address(void *data, unsigned long addr, int reliable)
-#else
-/* before 2.6.24 there was no reliable arg */
-# define RELIABLE 1
-# define DUMP_TRACE_CONST
-static void print_trace_address(void *data, unsigned long addr)
-#endif
{
- char fmt[32];
+ char fmt[32];
+
touch_nmi_watchdog();
- sprintf(fmt, " [<%016lx>] %s%%s\n", addr, RELIABLE ? "": "? ");
+ sprintf(fmt, " [<%016lx>] %s%%s\n", addr, reliable ? "": "? ");
__print_symbol(fmt, addr);
}
-static DUMP_TRACE_CONST struct stacktrace_ops print_trace_ops = {
+static const struct stacktrace_ops print_trace_ops = {
#ifdef HAVE_STACKTRACE_WARNING
.warning = print_trace_warning,
.warning_symbol = print_trace_warning_symbol,
.walk_stack = print_context_stack,
#endif
};
-#endif
+
+static void libcfs_call_trace(struct task_struct *tsk)
+{
+ dump_trace(tsk, NULL, NULL,
+#ifdef HAVE_DUMP_TRACE_ADDRESS
+ 0,
+#endif /* HAVE_DUMP_TRACE_ADDRESS */
+ &print_trace_ops, NULL);
+ printk("\n");
+}
+
+#else /* !CONFIG_X86 */
+
+static void libcfs_call_trace(struct task_struct *tsk)
+{
+ if ((tsk == NULL) || (tsk == current))
+ dump_stack();
+ else
+ CWARN("can't show stack: kernel doesn't export show_task\n");
+}
+
+#endif /* CONFIG_X86 */
void libcfs_debug_dumpstack(struct task_struct *tsk)
{
-#if defined(HAVE_DUMP_TRACE)
/* dump_stack() */
/* show_trace() */
if (tsk == NULL)
printk("Pid: %d, comm: %.20s\n", tsk->pid, tsk->comm);
/* show_trace_log_lvl() */
printk("\nCall Trace:\n");
- dump_trace(tsk, NULL, NULL,
-#ifdef HAVE_DUMP_TRACE_ADDRESS
- 0,
-#endif /* HAVE_DUMP_TRACE_ADDRESS */
- &print_trace_ops, NULL);
- printk("\n");
-#elif defined(HAVE_SHOW_TASK)
- /* this is exported by lustre kernel version 42 */
- extern void show_task(struct task_struct *);
-
- if (tsk == NULL)
- tsk = current;
- CWARN("showing stack for process %d\n", tsk->pid);
- show_task(tsk);
-#else
- if ((tsk == NULL) || (tsk == current))
- dump_stack();
- else
- CWARN("can't show stack: kernel doesn't export show_task\n");
-#endif
+ libcfs_call_trace(tsk);
}
struct task_struct *libcfs_current(void)
if (in_interrupt()) {
cfs_trace_debug_print();
} else {
-# ifdef HAVE_KERNEL_LOCKED
+#ifdef HAVE_KERNEL_LOCKED
while (kernel_locked())
unlock_kernel();
-# endif
+#endif
libcfs_debug_dumplog_internal((void *)(long)current_pid());
}
#endif