Whamcloud - gitweb
LU-9183 libcfs: handle dump_trace() and related callbacks removal 16/25816/6
authorDmitry Eremin <dmitry.eremin@intel.com>
Thu, 2 Mar 2017 19:23:00 +0000 (22:23 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Apr 2017 04:46:52 +0000 (04:46 +0000)
In commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b all previous users
of dump_trace() have been converted to use the new unwind interfaces,
so the dump_trace() and the related print_context_stack() and
print_context_stack_bp() callback functions were removed.

Test-Parameters: trivial
Change-Id: Ifa7a112d622b23f733d6daab05f9838afdf31a86
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: https://review.whamcloud.com/25816
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/linux/linux-debug.c

index 175d98b..c7199f5 100644 (file)
@@ -534,6 +534,27 @@ get_user_pages_6arg, [
 ]) # LIBCFS_GET_USER_PAGES_6ARG
 
 #
+# LIBCFS_STACKTRACE_OPS
+#
+# Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
+# removed both struct stacktrace_ops and dump_trace() function
+#
+AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
+LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
+stacktrace_ops, [
+       struct task_struct;
+       struct pt_regs;
+       #include <asm/stacktrace.h>
+],[
+       struct stacktrace_ops ops;
+       ops.stack = NULL;
+],[
+       AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
+               [struct stacktrace_ops exists])
+])
+]) # LIBCFS_STACKTRACE_OPS
+
+#
 # LIBCFS_PROG_LINUX
 #
 # LibCFS linux kernel checks
@@ -589,6 +610,8 @@ LIBCFS_CRYPTO_HASH_HELPERS
 # 4.6
 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
 LIBCFS_GET_USER_PAGES_6ARG
+# 4.8
+LIBCFS_STACKTRACE_OPS
 ]) # LIBCFS_PROG_LINUX
 
 #
index 128f8aa..4db7b4a 100644 (file)
@@ -127,11 +127,12 @@ EXPORT_SYMBOL(lbug_with_loc);
 #include <linux/nmi.h>
 #include <asm/stacktrace.h>
 
+#ifdef HAVE_STACKTRACE_OPS
 #ifdef HAVE_STACKTRACE_WARNING
 static void
 print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
 {
-        printk("%s", (char *)data);
+       printk("%s", (char *)data);
        print_symbol(msg, symbol);
        printk("\n");
 }
@@ -176,22 +177,32 @@ static const struct stacktrace_ops print_trace_ops = {
        .walk_stack = print_context_stack,
 #endif
 };
+#endif /* HAVE_STACKTRACE_OPS */
 
 static void libcfs_call_trace(struct task_struct *tsk)
 {
+#ifdef HAVE_STACKTRACE_OPS
+       printk("Pid: %d, comm: %.20s\n", tsk->pid, tsk->comm);
+       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");
+#else /* !HAVE_STACKTRACE_OPS */
+       if (tsk == current)
+               dump_stack();
+       else
+               CWARN("can't show stack: kernel doesn't export show_task\n");
+#endif /* HAVE_STACKTRACE_OPS */
 }
 
 #else /* !CONFIG_X86 */
 
 static void libcfs_call_trace(struct task_struct *tsk)
 {
-       if ((tsk == NULL) || (tsk == current))
+       if (tsk == current)
                dump_stack();
        else
                CWARN("can't show stack: kernel doesn't export show_task\n");
@@ -201,14 +212,7 @@ static void libcfs_call_trace(struct task_struct *tsk)
 
 void libcfs_debug_dumpstack(struct task_struct *tsk)
 {
-        /* dump_stack() */
-        /* show_trace() */
-        if (tsk == NULL)
-                tsk = current;
-       printk("Pid: %d, comm: %.20s\n", tsk->pid, tsk->comm);
-        /* show_trace_log_lvl() */
-       printk("\nCall Trace:\n");
-       libcfs_call_trace(tsk);
+       libcfs_call_trace(tsk ?: current);
 }
 EXPORT_SYMBOL(libcfs_debug_dumpstack);