]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
staging: lustre: move stack-check macros to libcfs_debug.h
authorNeilBrown <neilb@suse.com>
Mon, 16 Apr 2018 00:42:37 +0000 (10:42 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2018 13:02:04 +0000 (15:02 +0200)
CDEBUG_STACK() and CHECK_STACK() are macros to help with
debugging, so move them from
   drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
to
   drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h

This seems a more fitting location, and is a step towards
removing linux/libcfs.h and simplifying the include file structure.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h

index 9290a19429e786ab0d1166d38c4ac3a84e5e3725..0dc7b91efe7c168e1bdfc58d553bc947cab694c7 100644 (file)
@@ -62,6 +62,38 @@ int libcfs_debug_str2mask(int *mask, const char *str, int is_subsys);
 extern unsigned int libcfs_catastrophe;
 extern unsigned int libcfs_panic_on_lbug;
 
+/* Enable debug-checks on stack size - except on x86_64 */
+#if !defined(__x86_64__)
+# ifdef __ia64__
+#  define CDEBUG_STACK() (THREAD_SIZE -                                 \
+                         ((unsigned long)__builtin_dwarf_cfa() &       \
+                          (THREAD_SIZE - 1)))
+# else
+#  define CDEBUG_STACK() (THREAD_SIZE -                                 \
+                         ((unsigned long)__builtin_frame_address(0) &  \
+                          (THREAD_SIZE - 1)))
+# endif /* __ia64__ */
+
+#define __CHECK_STACK(msgdata, mask, cdls)                           \
+do {                                                               \
+       if (unlikely(CDEBUG_STACK() > libcfs_stack)) {            \
+               LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL);   \
+               libcfs_stack = CDEBUG_STACK();                    \
+               libcfs_debug_msg(msgdata,                              \
+                                "maximum lustre stack %lu\n",    \
+                                CDEBUG_STACK());                      \
+               (msgdata)->msg_mask = mask;                          \
+               (msgdata)->msg_cdls = cdls;                          \
+               dump_stack();                                      \
+             /*panic("LBUG");*/                                        \
+       }                                                              \
+} while (0)
+#define CFS_CHECK_STACK(msgdata, mask, cdls)  __CHECK_STACK(msgdata, mask, cdls)
+#else /* __x86_64__ */
+#define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0)
+#define CDEBUG_STACK() (0L)
+#endif /* __x86_64__ */
+
 #ifndef DEBUG_SUBSYSTEM
 # define DEBUG_SUBSYSTEM S_UNDEFINED
 #endif
index 07d3cb2217d16e8ca1d73acf9683a78e85d8a68c..83aec9c7698fdabb92eea8eade3e1b1e369af577 100644 (file)
 #include <stdarg.h>
 #include "linux-cpu.h"
 
-#if !defined(__x86_64__)
-# ifdef __ia64__
-#  define CDEBUG_STACK() (THREAD_SIZE -                                 \
-                         ((unsigned long)__builtin_dwarf_cfa() &       \
-                          (THREAD_SIZE - 1)))
-# else
-#  define CDEBUG_STACK() (THREAD_SIZE -                                 \
-                         ((unsigned long)__builtin_frame_address(0) &  \
-                          (THREAD_SIZE - 1)))
-# endif /* __ia64__ */
-
-#define __CHECK_STACK(msgdata, mask, cdls)                           \
-do {                                                               \
-       if (unlikely(CDEBUG_STACK() > libcfs_stack)) {            \
-               LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL);   \
-               libcfs_stack = CDEBUG_STACK();                    \
-               libcfs_debug_msg(msgdata,                              \
-                                "maximum lustre stack %lu\n",    \
-                                CDEBUG_STACK());                      \
-               (msgdata)->msg_mask = mask;                          \
-               (msgdata)->msg_cdls = cdls;                          \
-               dump_stack();                                      \
-             /*panic("LBUG");*/                                        \
-       }                                                              \
-} while (0)
-#define CFS_CHECK_STACK(msgdata, mask, cdls)  __CHECK_STACK(msgdata, mask, cdls)
-#else /* __x86_64__ */
-#define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0)
-#define CDEBUG_STACK() (0L)
-#endif /* __x86_64__ */
-
 #endif /* _LINUX_LIBCFS_H */