aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@us.ibm.com>2005-10-30 18:03:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:27 -0500
commita241ec65aeac3d69a08a7b153cccbdb7ea35063f (patch)
treee96585e8b1e699f31bad1fa61f34d2ec7c3a187c /Documentation
parentb3099b48da23686d8378133b0264ee00385ee5fa (diff)
[PATCH] RCU torture-testing kernel module
This patch is a rewrite of the one submitted on October 1st, using modules (http://marc.theaimsgroup.com/?l=linux-kernel&m=112819093522998&w=2). This rewrite adds a tristate CONFIG_RCU_TORTURE_TEST, which enables an intense torture test of the RCU infratructure. This is needed due to the continued changes to the RCU infrastructure to accommodate dynamic ticks, CPU hotplug, realtime, and so on. Most of the code is in a separate file that is compiled only if the CONFIG variable is set. Documentation on how to run the test and interpret the output is also included. This code has been tested on i386 and ppc64, and an earlier version of the code has received extensive testing on a number of architectures as part of the PREEMPT_RT patchset. Signed-off-by: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/RCU/torture.txt122
1 files changed, 122 insertions, 0 deletions
diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt
new file mode 100644
index 000000000000..e4c38152f7f7
--- /dev/null
+++ b/Documentation/RCU/torture.txt
@@ -0,0 +1,122 @@
1RCU Torture Test Operation
2
3
4CONFIG_RCU_TORTURE_TEST
5
6The CONFIG_RCU_TORTURE_TEST config option is available for all RCU
7implementations. It creates an rcutorture kernel module that can
8be loaded to run a torture test. The test periodically outputs
9status messages via printk(), which can be examined via the dmesg
10command (perhaps grepping for "rcutorture"). The test is started
11when the module is loaded, and stops when the module is unloaded.
12
13However, actually setting this config option to "y" results in the system
14running the test immediately upon boot, and ending only when the system
15is taken down. Normally, one will instead want to build the system
16with CONFIG_RCU_TORTURE_TEST=m and to use modprobe and rmmod to control
17the test, perhaps using a script similar to the one shown at the end of
18this document. Note that you will need CONFIG_MODULE_UNLOAD in order
19to be able to end the test.
20
21
22MODULE PARAMETERS
23
24This module has the following parameters:
25
26nreaders This is the number of RCU reading threads supported.
27 The default is twice the number of CPUs. Why twice?
28 To properly exercise RCU implementations with preemptible
29 read-side critical sections.
30
31stat_interval The number of seconds between output of torture
32 statistics (via printk()). Regardless of the interval,
33 statistics are printed when the module is unloaded.
34 Setting the interval to zero causes the statistics to
35 be printed -only- when the module is unloaded, and this
36 is the default.
37
38verbose Enable debug printk()s. Default is disabled.
39
40
41OUTPUT
42
43The statistics output is as follows:
44
45 rcutorture: --- Start of test: nreaders=16 stat_interval=0 verbose=0
46 rcutorture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915
47 rcutorture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0
48 rcutorture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0
49 rcutorture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0
50 rcutorture: --- End of test
51
52The command "dmesg | grep rcutorture:" will extract this information on
53most systems. On more esoteric configurations, it may be necessary to
54use other commands to access the output of the printk()s used by
55the RCU torture test. The printk()s use KERN_ALERT, so they should
56be evident. ;-)
57
58The entries are as follows:
59
60o "ggp": The number of counter flips (or batches) since boot.
61
62o "rtc": The hexadecimal address of the structure currently visible
63 to readers.
64
65o "ver": The number of times since boot that the rcutw writer task
66 has changed the structure visible to readers.
67
68o "tfle": If non-zero, indicates that the "torture freelist"
69 containing structure to be placed into the "rtc" area is empty.
70 This condition is important, since it can fool you into thinking
71 that RCU is working when it is not. :-/
72
73o "rta": Number of structures allocated from the torture freelist.
74
75o "rtaf": Number of allocations from the torture freelist that have
76 failed due to the list being empty.
77
78o "rtf": Number of frees into the torture freelist.
79
80o "Reader Pipe": Histogram of "ages" of structures seen by readers.
81 If any entries past the first two are non-zero, RCU is broken.
82 And rcutorture prints the error flag string "!!!" to make sure
83 you notice. The age of a newly allocated structure is zero,
84 it becomes one when removed from reader visibility, and is
85 incremented once per grace period subsequently -- and is freed
86 after passing through (RCU_TORTURE_PIPE_LEN-2) grace periods.
87
88 The output displayed above was taken from a correctly working
89 RCU. If you want to see what it looks like when broken, break
90 it yourself. ;-)
91
92o "Reader Batch": Another histogram of "ages" of structures seen
93 by readers, but in terms of counter flips (or batches) rather
94 than in terms of grace periods. The legal number of non-zero
95 entries is again two. The reason for this separate view is
96 that it is easier to get the third entry to show up in the
97 "Reader Batch" list than in the "Reader Pipe" list.
98
99o "Free-Block Circulation": Shows the number of torture structures
100 that have reached a given point in the pipeline. The first element
101 should closely correspond to the number of structures allocated,
102 the second to the number that have been removed from reader view,
103 and all but the last remaining to the corresponding number of
104 passes through a grace period. The last entry should be zero,
105 as it is only incremented if a torture structure's counter
106 somehow gets incremented farther than it should.
107
108
109USAGE
110
111The following script may be used to torture RCU:
112
113 #!/bin/sh
114
115 modprobe rcutorture
116 sleep 100
117 rmmod rcutorture
118 dmesg | grep rcutorture:
119
120The output can be manually inspected for the error flag of "!!!".
121One could of course create a more elaborate script that automatically
122checked for such errors.