backtracetest.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Simple stack backtrace regression test module
  3. *
  4. * (C) Copyright 2008 Intel Corporation
  5. * Author: Arjan van de Ven <arjan@linux.intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; version 2
  10. * of the License.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/sched.h>
  14. #include <linux/delay.h>
  15. static struct timer_list backtrace_timer;
  16. static void backtrace_test_timer(unsigned long data)
  17. {
  18. printk("Testing a backtrace from irq context.\n");
  19. printk("The following trace is a kernel self test and not a bug!\n");
  20. dump_stack();
  21. }
  22. static int backtrace_regression_test(void)
  23. {
  24. printk("====[ backtrace testing ]===========\n");
  25. printk("Testing a backtrace from process context.\n");
  26. printk("The following trace is a kernel self test and not a bug!\n");
  27. dump_stack();
  28. init_timer(&backtrace_timer);
  29. backtrace_timer.function = backtrace_test_timer;
  30. mod_timer(&backtrace_timer, jiffies + 10);
  31. msleep(10);
  32. printk("====[ end of backtrace testing ]====\n");
  33. return 0;
  34. }
  35. static void exitf(void)
  36. {
  37. }
  38. module_init(backtrace_regression_test);
  39. module_exit(exitf);
  40. MODULE_LICENSE("GPL");
  41. MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");