Whamcloud - gitweb
LU-2800 autoconf: remove LIBCFS_FUNC_DUMP_TRACE test 03/5403/9
authorJames Simmons <uja.ornl@gmail.com>
Wed, 11 Sep 2013 16:47:53 +0000 (12:47 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 25 Oct 2013 01:39:47 +0000 (01:39 +0000)
dump_trace has been upstream since v2.6.23. The reliable argument was
added in v2.6.25. The other bits were added in v2.6.19.
We can remove the test and dead code.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I3b998f62ce4908adf377acd395725493dd717c3a
Reviewed-on: http://review.whamcloud.com/5403
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/linux/linux-debug.c

index e6d7e5d..210fa2f 100644 (file)
@@ -115,80 +115,6 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
 ])
 ])
 
-#
-# LIBCFS_FUNC_DUMP_TRACE
-#
-# 2.6.23 exports dump_trace() so we can dump_stack() on any task
-# 2.6.24 has stacktrace_ops.address with "reliable" parameter
-#
-AC_DEFUN([LIBCFS_FUNC_DUMP_TRACE],
-[LB_CHECK_SYMBOL_EXPORT([dump_trace],
-[kernel/ksyms.c arch/${LINUX_ARCH%_64}/kernel/traps_64.c arch/x86/kernel/dumpstack_32.c arch/x86/kernel/dumpstack_64.c],[
-       tmp_flags="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="-Werror"
-       AC_MSG_CHECKING([whether we can really use dump_trace])
-       LB_LINUX_TRY_COMPILE([
-               struct task_struct;
-               struct pt_regs;
-               #include <asm/stacktrace.h>
-       ],[
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_DUMP_TRACE, 1, [dump_trace is exported])
-       ],[
-               AC_MSG_RESULT(no)
-       ],[
-       ])
-       AC_MSG_CHECKING([whether print_trace_address has reliable argument])
-       LB_LINUX_TRY_COMPILE([
-               struct task_struct;
-               struct pt_regs;
-               #include <asm/stacktrace.h>
-       ],[
-               ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_TRACE_ADDRESS_RELIABLE, 1,
-                         [print_trace_address has reliable argument])
-       ],[
-               AC_MSG_RESULT(no)
-       ],[
-       ])
-       AC_MSG_CHECKING([whether stacktrace_ops.warning is exist])
-       LB_LINUX_TRY_COMPILE([
-               struct task_struct;
-               struct pt_regs;
-               #include <asm/stacktrace.h>
-       ],[
-               ((struct stacktrace_ops *)0)->warning(NULL, NULL);
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_STACKTRACE_WARNING, 1, [stacktrace_ops.warning is exist])
-       ],[
-               AC_MSG_RESULT(no)
-       ],[
-       ])
-       AC_MSG_CHECKING([dump_trace want address])
-       LB_LINUX_TRY_COMPILE([
-               struct task_struct;
-               struct pt_regs;
-               #include <asm/stacktrace.h>
-       ],[
-               dump_trace(NULL, NULL, NULL, 0, NULL, NULL);
-       ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_DUMP_TRACE_ADDRESS, 1,
-                         [dump_trace want address argument])
-       ],[
-               AC_MSG_RESULT(no)
-       ],[
-       ])
-
-EXTRA_KCFLAGS="$tmp_flags"
-])
-])
-
-
 # 2.6.27 have second argument to sock_map_fd
 AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
 [AC_MSG_CHECKING([sock_map_fd have second argument])
 # 2.6.27 have second argument to sock_map_fd
 AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
 [AC_MSG_CHECKING([sock_map_fd have second argument])
@@ -308,6 +234,26 @@ LB_LINUX_TRY_COMPILE([
         AC_DEFINE(HAVE_SK_SLEEP, 1, [kernel has sk_sleep])
 ],[
         AC_MSG_RESULT(no)
         AC_DEFINE(HAVE_SK_SLEEP, 1, [kernel has sk_sleep])
 ],[
         AC_MSG_RESULT(no)
+],[
+])
+])
+
+# 2.6.39 adds a base pointer address argument to dump_trace
+AC_DEFUN([LIBCFS_DUMP_TRACE_ADDRESS],
+[AC_MSG_CHECKING([dump_trace want address])
+LB_LINUX_TRY_COMPILE([
+       struct task_struct;
+       struct pt_regs;
+       #include <asm/stacktrace.h>
+],[
+       dump_trace(NULL, NULL, NULL, 0, NULL, NULL);
+],[
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_DUMP_TRACE_ADDRESS, 1,
+               [dump_trace want address argument])
+],[
+       AC_MSG_RESULT(no)
+],[
 ])
 ])
 
 ])
 ])
 
@@ -331,6 +277,24 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
 ])
 ])
 
+# 3.0 removes stacktrace_ops warning* functions
+AC_DEFUN([LIBCFS_STACKTRACE_WARNING],
+[AC_MSG_CHECKING([whether stacktrace_ops.warning is exist])
+LB_LINUX_TRY_COMPILE([
+       struct task_struct;
+       struct pt_regs;
+       #include <asm/stacktrace.h>
+],[
+       ((struct stacktrace_ops *)0)->warning(NULL, NULL);
+],[
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_STACKTRACE_WARNING, 1, [stacktrace_ops.warning is exist])
+],[
+       AC_MSG_RESULT(no)
+],[
+])
+])
+
 #
 # FC18 3.7.2-201 unexport sock_map_fd() change to
 # use sock_alloc_file().
 #
 # FC18 3.7.2-201 unexport sock_map_fd() change to
 # use sock_alloc_file().
@@ -368,7 +332,6 @@ LIBCFS_CONFIG_PANIC_DUMPLOG
 LIBCFS_U64_LONG_LONG_LINUX
 # 2.6.24
 LIBCFS_SYSCTL_UNNUMBERED
 LIBCFS_U64_LONG_LONG_LINUX
 # 2.6.24
 LIBCFS_SYSCTL_UNNUMBERED
-LIBCFS_FUNC_DUMP_TRACE
 LIBCFS_HAVE_KEYTYPE_H
 # 2.6.30
 LIBCFS_SOCK_MAP_FD_2ARG
 LIBCFS_HAVE_KEYTYPE_H
 # 2.6.30
 LIBCFS_SOCK_MAP_FD_2ARG
@@ -381,8 +344,12 @@ LIBCFS_SYSCTL_CTLNAME
 LIBCFS_ADD_WAIT_QUEUE_EXCLUSIVE
 # 2.6.35
 LC_SK_SLEEP
 LIBCFS_ADD_WAIT_QUEUE_EXCLUSIVE
 # 2.6.35
 LC_SK_SLEEP
+# 2.6.39
+LIBCFS_DUMP_TRACE_ADDRESS
 # 2.6.40 fc15
 LC_SHRINK_CONTROL
 # 2.6.40 fc15
 LC_SHRINK_CONTROL
+# 3.0
+LIBCFS_STACKTRACE_WARNING
 # 3.7
 LIBCFS_SOCK_ALLOC_FILE
 ])
 # 3.7
 LIBCFS_SOCK_ALLOC_FILE
 ])
index 6c27049..fe93f0c 100644 (file)
@@ -184,7 +184,6 @@ void lbug_with_loc(struct libcfs_debug_msg_data *msgdata)
 
 #ifdef __KERNEL__
 
 
 #ifdef __KERNEL__
 
-#ifdef HAVE_DUMP_TRACE
 #include <linux/nmi.h>
 #include <asm/stacktrace.h>
 
 #include <linux/nmi.h>
 #include <asm/stacktrace.h>
 
@@ -209,24 +208,16 @@ static int print_trace_stack(void *data, char *name)
        return 0;
 }
 
        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)
 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();
        touch_nmi_watchdog();
-        sprintf(fmt, " [<%016lx>] %s%%s\n", addr, RELIABLE ? "": "? ");
+       sprintf(fmt, " [<%016lx>] %s%%s\n", addr, reliable ? "": "? ");
        __print_symbol(fmt, addr);
 }
 
        __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,
 #ifdef HAVE_STACKTRACE_WARNING
        .warning = print_trace_warning,
        .warning_symbol = print_trace_warning_symbol,
@@ -237,11 +228,9 @@ static DUMP_TRACE_CONST struct stacktrace_ops print_trace_ops = {
        .walk_stack = print_context_stack,
 #endif
 };
        .walk_stack = print_context_stack,
 #endif
 };
-#endif
 
 void libcfs_debug_dumpstack(struct task_struct *tsk)
 {
 
 void libcfs_debug_dumpstack(struct task_struct *tsk)
 {
-#if defined(HAVE_DUMP_TRACE)
         /* dump_stack() */
         /* show_trace() */
         if (tsk == NULL)
         /* dump_stack() */
         /* show_trace() */
         if (tsk == NULL)
@@ -255,20 +244,6 @@ void libcfs_debug_dumpstack(struct task_struct *tsk)
 #endif /* HAVE_DUMP_TRACE_ADDRESS */
                    &print_trace_ops, NULL);
        printk("\n");
 #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
 }
 
 struct task_struct *libcfs_current(void)
 }
 
 struct task_struct *libcfs_current(void)