~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/backtracetest.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /kernel/backtracetest.c (Version linux-6.12-rc7) and /kernel/backtracetest.c (Version linux-4.10.17)


  1 // SPDX-License-Identifier: GPL-2.0-only       << 
  2 /*                                                  1 /*
  3  * Simple stack backtrace regression test modu      2  * Simple stack backtrace regression test module
  4  *                                                  3  *
  5  * (C) Copyright 2008 Intel Corporation             4  * (C) Copyright 2008 Intel Corporation
  6  * Author: Arjan van de Ven <arjan@linux.intel      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.
  7  */                                                11  */
  8                                                    12 
  9 #include <linux/completion.h>                      13 #include <linux/completion.h>
 10 #include <linux/delay.h>                           14 #include <linux/delay.h>
 11 #include <linux/interrupt.h>                       15 #include <linux/interrupt.h>
 12 #include <linux/module.h>                          16 #include <linux/module.h>
 13 #include <linux/sched.h>                           17 #include <linux/sched.h>
 14 #include <linux/stacktrace.h>                      18 #include <linux/stacktrace.h>
 15                                                    19 
 16 static void backtrace_test_normal(void)            20 static void backtrace_test_normal(void)
 17 {                                                  21 {
 18         pr_info("Testing a backtrace from proc     22         pr_info("Testing a backtrace from process context.\n");
 19         pr_info("The following trace is a kern     23         pr_info("The following trace is a kernel self test and not a bug!\n");
 20                                                    24 
 21         dump_stack();                              25         dump_stack();
 22 }                                                  26 }
 23                                                    27 
 24 static void backtrace_test_bh_workfn(struct wo !!  28 static DECLARE_COMPLETION(backtrace_work);
                                                   >>  29 
                                                   >>  30 static void backtrace_test_irq_callback(unsigned long data)
 25 {                                                  31 {
 26         dump_stack();                              32         dump_stack();
                                                   >>  33         complete(&backtrace_work);
 27 }                                                  34 }
 28                                                    35 
 29 static DECLARE_WORK(backtrace_bh_work, &backtr !!  36 static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);
 30                                                    37 
 31 static void backtrace_test_bh(void)            !!  38 static void backtrace_test_irq(void)
 32 {                                                  39 {
 33         pr_info("Testing a backtrace from BH c !!  40         pr_info("Testing a backtrace from irq context.\n");
 34         pr_info("The following trace is a kern     41         pr_info("The following trace is a kernel self test and not a bug!\n");
 35                                                    42 
 36         queue_work(system_bh_wq, &backtrace_bh !!  43         init_completion(&backtrace_work);
 37         flush_work(&backtrace_bh_work);        !!  44         tasklet_schedule(&backtrace_tasklet);
                                                   >>  45         wait_for_completion(&backtrace_work);
 38 }                                                  46 }
 39                                                    47 
 40 #ifdef CONFIG_STACKTRACE                           48 #ifdef CONFIG_STACKTRACE
 41 static void backtrace_test_saved(void)             49 static void backtrace_test_saved(void)
 42 {                                                  50 {
                                                   >>  51         struct stack_trace trace;
 43         unsigned long entries[8];                  52         unsigned long entries[8];
 44         unsigned int nr_entries;               << 
 45                                                    53 
 46         pr_info("Testing a saved backtrace.\n"     54         pr_info("Testing a saved backtrace.\n");
 47         pr_info("The following trace is a kern     55         pr_info("The following trace is a kernel self test and not a bug!\n");
 48                                                    56 
 49         nr_entries = stack_trace_save(entries, !!  57         trace.nr_entries = 0;
 50         stack_trace_print(entries, nr_entries, !!  58         trace.max_entries = ARRAY_SIZE(entries);
                                                   >>  59         trace.entries = entries;
                                                   >>  60         trace.skip = 0;
                                                   >>  61 
                                                   >>  62         save_stack_trace(&trace);
                                                   >>  63         print_stack_trace(&trace, 0);
 51 }                                                  64 }
 52 #else                                              65 #else
 53 static void backtrace_test_saved(void)             66 static void backtrace_test_saved(void)
 54 {                                                  67 {
 55         pr_info("Saved backtrace test skipped.     68         pr_info("Saved backtrace test skipped.\n");
 56 }                                                  69 }
 57 #endif                                             70 #endif
 58                                                    71 
 59 static int backtrace_regression_test(void)         72 static int backtrace_regression_test(void)
 60 {                                                  73 {
 61         pr_info("====[ backtrace testing ]====     74         pr_info("====[ backtrace testing ]===========\n");
 62                                                    75 
 63         backtrace_test_normal();                   76         backtrace_test_normal();
 64         backtrace_test_bh();                   !!  77         backtrace_test_irq();
 65         backtrace_test_saved();                    78         backtrace_test_saved();
 66                                                    79 
 67         pr_info("====[ end of backtrace testin     80         pr_info("====[ end of backtrace testing ]====\n");
 68         return 0;                                  81         return 0;
 69 }                                                  82 }
 70                                                    83 
 71 static void exitf(void)                            84 static void exitf(void)
 72 {                                                  85 {
 73 }                                                  86 }
 74                                                    87 
 75 module_init(backtrace_regression_test);            88 module_init(backtrace_regression_test);
 76 module_exit(exitf);                                89 module_exit(exitf);
 77 MODULE_DESCRIPTION("Simple stack backtrace reg << 
 78 MODULE_LICENSE("GPL");                             90 MODULE_LICENSE("GPL");
 79 MODULE_AUTHOR("Arjan van de Ven <arjan@linux.i     91 MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
 80                                                    92 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php