netns xfrm: fix "ip xfrm state|policy count" misreport
[safe/jmp/linux-2.6] / kernel / panic.c
index 934fb37..5827f7b 100644 (file)
@@ -10,6 +10,7 @@
  */
 #include <linux/debug_locks.h>
 #include <linux/interrupt.h>
+#include <linux/kmsg_dump.h>
 #include <linux/kallsyms.h>
 #include <linux/notifier.h>
 #include <linux/module.h>
@@ -74,6 +75,7 @@ NORET_TYPE void panic(const char * fmt, ...)
        dump_stack();
 #endif
 
+       kmsg_dump(KMSG_DUMP_PANIC);
        /*
         * If we have crashed and we have a crash kernel loaded let it handle
         * everything else.
@@ -90,6 +92,8 @@ NORET_TYPE void panic(const char * fmt, ...)
 
        atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
 
+       bust_spinlocks(0);
+
        if (!panic_blink)
                panic_blink = no_blink;
 
@@ -136,7 +140,6 @@ NORET_TYPE void panic(const char * fmt, ...)
                mdelay(1);
                i++;
        }
-       bust_spinlocks(0);
 }
 
 EXPORT_SYMBOL(panic);
@@ -177,7 +180,7 @@ static const struct tnt tnts[] = {
  *  'W' - Taint on warning.
  *  'C' - modules from drivers/staging are loaded.
  *
- *     The string is overwritten by the next call to print_taint().
+ *     The string is overwritten by the next call to print_tainted().
  */
 const char *print_tainted(void)
 {
@@ -221,7 +224,7 @@ void add_taint(unsigned flag)
         * post-warning case.
         */
        if (flag != TAINT_CRAP && flag != TAINT_WARN && __debug_locks_off())
-               printk(KERN_WARNING "Disabling lockdep due to kernel taint\n");
+               printk(KERN_WARNING "Disabling lock debugging due to kernel taint\n");
 
        set_bit(flag, &tainted_mask);
 }
@@ -301,6 +304,7 @@ int oops_may_print(void)
  */
 void oops_enter(void)
 {
+       tracing_off();
        /* can't trust the integrity of the kernel anymore: */
        debug_locks_off();
        do_oops_enter_exit();
@@ -337,37 +341,50 @@ void oops_exit(void)
 {
        do_oops_enter_exit();
        print_oops_end_marker();
+       kmsg_dump(KMSG_DUMP_OOPS);
 }
 
 #ifdef WANT_WARN_ON_SLOWPATH
-void warn_slowpath(const char *file, int line, const char *fmt, ...)
-{
+struct slowpath_args {
+       const char *fmt;
        va_list args;
-       char function[KSYM_SYMBOL_LEN];
-       unsigned long caller = (unsigned long)__builtin_return_address(0);
-       const char *board;
+};
 
-       sprint_symbol(function, caller);
+static void warn_slowpath_common(const char *file, int line, void *caller, struct slowpath_args *args)
+{
+       const char *board;
 
        printk(KERN_WARNING "------------[ cut here ]------------\n");
-       printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file,
-               line, function);
+       printk(KERN_WARNING "WARNING: at %s:%d %pS()\n", file, line, caller);
        board = dmi_get_system_info(DMI_PRODUCT_NAME);
        if (board)
                printk(KERN_WARNING "Hardware name: %s\n", board);
 
-       if (fmt) {
-               va_start(args, fmt);
-               vprintk(fmt, args);
-               va_end(args);
-       }
+       if (args)
+               vprintk(args->fmt, args->args);
 
        print_modules();
        dump_stack();
        print_oops_end_marker();
        add_taint(TAINT_WARN);
 }
-EXPORT_SYMBOL(warn_slowpath);
+
+void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
+{
+       struct slowpath_args args;
+
+       args.fmt = fmt;
+       va_start(args.args, fmt);
+       warn_slowpath_common(file, line, __builtin_return_address(0), &args);
+       va_end(args.args);
+}
+EXPORT_SYMBOL(warn_slowpath_fmt);
+
+void warn_slowpath_null(const char *file, int line)
+{
+       warn_slowpath_common(file, line, __builtin_return_address(0), NULL);
+}
+EXPORT_SYMBOL(warn_slowpath_null);
 #endif
 
 #ifdef CONFIG_CC_STACKPROTECTOR