]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/panic.c
timerfd: wire the new timerfd API to the x86 family
[linux-2.6-omap-h63xx.git] / kernel / panic.c
index 6f6e03e91595f7f1959a282c5a35697efb02c79d..d9e90cfe3298ca09947aca7b562479c5fcacb6f8 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/nmi.h>
 #include <linux/kexec.h>
 #include <linux/debug_locks.h>
+#include <linux/random.h>
+#include <linux/kallsyms.h>
 
 int panic_on_oops;
 int tainted;
@@ -265,6 +267,27 @@ void oops_enter(void)
        do_oops_enter_exit();
 }
 
+/*
+ * 64-bit random ID for oopses:
+ */
+static u64 oops_id;
+
+static int init_oops_id(void)
+{
+       if (!oops_id)
+               get_random_bytes(&oops_id, sizeof(oops_id));
+
+       return 0;
+}
+late_initcall(init_oops_id);
+
+static void print_oops_end_marker(void)
+{
+       init_oops_id();
+       printk(KERN_WARNING "---[ end trace %016llx ]---\n",
+               (unsigned long long)oops_id);
+}
+
 /*
  * Called when the architecture exits its oops handler, after printing
  * everything.
@@ -272,7 +295,25 @@ void oops_enter(void)
 void oops_exit(void)
 {
        do_oops_enter_exit();
+       print_oops_end_marker();
+}
+
+#ifdef WANT_WARN_ON_SLOWPATH
+void warn_on_slowpath(const char *file, int line)
+{
+       char function[KSYM_SYMBOL_LEN];
+       unsigned long caller = (unsigned long) __builtin_return_address(0);
+       sprint_symbol(function, caller);
+
+       printk(KERN_WARNING "------------[ cut here ]------------\n");
+       printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file,
+               line, function);
+       print_modules();
+       dump_stack();
+       print_oops_end_marker();
 }
+EXPORT_SYMBOL(warn_on_slowpath);
+#endif
 
 #ifdef CONFIG_CC_STACKPROTECTOR
 /*