diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 10:26:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 10:26:53 -0400 |
commit | 19b4a8d520a6e0176dd52aaa429261ad4fcaa545 (patch) | |
tree | 6dcf5a780718fc50b9cd79cc803daa7c7e080a02 /Documentation | |
parent | 3cfef9524677a4ecb392d6fbffe6ebce6302f1d4 (diff) | |
parent | 048b718029033af117870d3da47da12995be14a3 (diff) |
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (45 commits)
rcu: Move propagation of ->completed from rcu_start_gp() to rcu_report_qs_rsp()
rcu: Remove rcu_needs_cpu_flush() to avoid false quiescent states
rcu: Wire up RCU_BOOST_PRIO for rcutree
rcu: Make rcu_torture_boost() exit loops at end of test
rcu: Make rcu_torture_fqs() exit loops at end of test
rcu: Permit rt_mutex_unlock() with irqs disabled
rcu: Avoid having just-onlined CPU resched itself when RCU is idle
rcu: Suppress NMI backtraces when stall ends before dump
rcu: Prohibit grace periods during early boot
rcu: Simplify unboosting checks
rcu: Prevent early boot set_need_resched() from __rcu_pending()
rcu: Dump local stack if cannot dump all CPUs' stacks
rcu: Move __rcu_read_unlock()'s barrier() within if-statement
rcu: Improve rcu_assign_pointer() and RCU_INIT_POINTER() documentation
rcu: Make rcu_assign_pointer() unconditionally insert a memory barrier
rcu: Make rcu_implicit_dynticks_qs() locals be correct size
rcu: Eliminate in_irq() checks in rcu_enter_nohz()
nohz: Remove nohz_cpu_mask
rcu: Document interpretation of RCU-lockdep splats
rcu: Allow rcutorture's stat_interval parameter to be changed at runtime
...
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/RCU/NMI-RCU.txt | 2 | ||||
-rw-r--r-- | Documentation/RCU/lockdep-splat.txt | 110 | ||||
-rw-r--r-- | Documentation/RCU/lockdep.txt | 34 | ||||
-rw-r--r-- | Documentation/RCU/torture.txt | 137 | ||||
-rw-r--r-- | Documentation/RCU/trace.txt | 38 |
5 files changed, 259 insertions, 62 deletions
diff --git a/Documentation/RCU/NMI-RCU.txt b/Documentation/RCU/NMI-RCU.txt index bf82851a0e57..687777f83b23 100644 --- a/Documentation/RCU/NMI-RCU.txt +++ b/Documentation/RCU/NMI-RCU.txt | |||
@@ -95,7 +95,7 @@ not to return until all ongoing NMI handlers exit. It is therefore safe | |||
95 | to free up the handler's data as soon as synchronize_sched() returns. | 95 | to free up the handler's data as soon as synchronize_sched() returns. |
96 | 96 | ||
97 | Important note: for this to work, the architecture in question must | 97 | Important note: for this to work, the architecture in question must |
98 | invoke irq_enter() and irq_exit() on NMI entry and exit, respectively. | 98 | invoke nmi_enter() and nmi_exit() on NMI entry and exit, respectively. |
99 | 99 | ||
100 | 100 | ||
101 | Answer to Quick Quiz | 101 | Answer to Quick Quiz |
diff --git a/Documentation/RCU/lockdep-splat.txt b/Documentation/RCU/lockdep-splat.txt new file mode 100644 index 000000000000..bf9061142827 --- /dev/null +++ b/Documentation/RCU/lockdep-splat.txt | |||
@@ -0,0 +1,110 @@ | |||
1 | Lockdep-RCU was added to the Linux kernel in early 2010 | ||
2 | (http://lwn.net/Articles/371986/). This facility checks for some common | ||
3 | misuses of the RCU API, most notably using one of the rcu_dereference() | ||
4 | family to access an RCU-protected pointer without the proper protection. | ||
5 | When such misuse is detected, an lockdep-RCU splat is emitted. | ||
6 | |||
7 | The usual cause of a lockdep-RCU slat is someone accessing an | ||
8 | RCU-protected data structure without either (1) being in the right kind of | ||
9 | RCU read-side critical section or (2) holding the right update-side lock. | ||
10 | This problem can therefore be serious: it might result in random memory | ||
11 | overwriting or worse. There can of course be false positives, this | ||
12 | being the real world and all that. | ||
13 | |||
14 | So let's look at an example RCU lockdep splat from 3.0-rc5, one that | ||
15 | has long since been fixed: | ||
16 | |||
17 | =============================== | ||
18 | [ INFO: suspicious RCU usage. ] | ||
19 | ------------------------------- | ||
20 | block/cfq-iosched.c:2776 suspicious rcu_dereference_protected() usage! | ||
21 | |||
22 | other info that might help us debug this: | ||
23 | |||
24 | |||
25 | rcu_scheduler_active = 1, debug_locks = 0 | ||
26 | 3 locks held by scsi_scan_6/1552: | ||
27 | #0: (&shost->scan_mutex){+.+.+.}, at: [<ffffffff8145efca>] | ||
28 | scsi_scan_host_selected+0x5a/0x150 | ||
29 | #1: (&eq->sysfs_lock){+.+...}, at: [<ffffffff812a5032>] | ||
30 | elevator_exit+0x22/0x60 | ||
31 | #2: (&(&q->__queue_lock)->rlock){-.-...}, at: [<ffffffff812b6233>] | ||
32 | cfq_exit_queue+0x43/0x190 | ||
33 | |||
34 | stack backtrace: | ||
35 | Pid: 1552, comm: scsi_scan_6 Not tainted 3.0.0-rc5 #17 | ||
36 | Call Trace: | ||
37 | [<ffffffff810abb9b>] lockdep_rcu_dereference+0xbb/0xc0 | ||
38 | [<ffffffff812b6139>] __cfq_exit_single_io_context+0xe9/0x120 | ||
39 | [<ffffffff812b626c>] cfq_exit_queue+0x7c/0x190 | ||
40 | [<ffffffff812a5046>] elevator_exit+0x36/0x60 | ||
41 | [<ffffffff812a802a>] blk_cleanup_queue+0x4a/0x60 | ||
42 | [<ffffffff8145cc09>] scsi_free_queue+0x9/0x10 | ||
43 | [<ffffffff81460944>] __scsi_remove_device+0x84/0xd0 | ||
44 | [<ffffffff8145dca3>] scsi_probe_and_add_lun+0x353/0xb10 | ||
45 | [<ffffffff817da069>] ? error_exit+0x29/0xb0 | ||
46 | [<ffffffff817d98ed>] ? _raw_spin_unlock_irqrestore+0x3d/0x80 | ||
47 | [<ffffffff8145e722>] __scsi_scan_target+0x112/0x680 | ||
48 | [<ffffffff812c690d>] ? trace_hardirqs_off_thunk+0x3a/0x3c | ||
49 | [<ffffffff817da069>] ? error_exit+0x29/0xb0 | ||
50 | [<ffffffff812bcc60>] ? kobject_del+0x40/0x40 | ||
51 | [<ffffffff8145ed16>] scsi_scan_channel+0x86/0xb0 | ||
52 | [<ffffffff8145f0b0>] scsi_scan_host_selected+0x140/0x150 | ||
53 | [<ffffffff8145f149>] do_scsi_scan_host+0x89/0x90 | ||
54 | [<ffffffff8145f170>] do_scan_async+0x20/0x160 | ||
55 | [<ffffffff8145f150>] ? do_scsi_scan_host+0x90/0x90 | ||
56 | [<ffffffff810975b6>] kthread+0xa6/0xb0 | ||
57 | [<ffffffff817db154>] kernel_thread_helper+0x4/0x10 | ||
58 | [<ffffffff81066430>] ? finish_task_switch+0x80/0x110 | ||
59 | [<ffffffff817d9c04>] ? retint_restore_args+0xe/0xe | ||
60 | [<ffffffff81097510>] ? __init_kthread_worker+0x70/0x70 | ||
61 | [<ffffffff817db150>] ? gs_change+0xb/0xb | ||
62 | |||
63 | Line 2776 of block/cfq-iosched.c in v3.0-rc5 is as follows: | ||
64 | |||
65 | if (rcu_dereference(ioc->ioc_data) == cic) { | ||
66 | |||
67 | This form says that it must be in a plain vanilla RCU read-side critical | ||
68 | section, but the "other info" list above shows that this is not the | ||
69 | case. Instead, we hold three locks, one of which might be RCU related. | ||
70 | And maybe that lock really does protect this reference. If so, the fix | ||
71 | is to inform RCU, perhaps by changing __cfq_exit_single_io_context() to | ||
72 | take the struct request_queue "q" from cfq_exit_queue() as an argument, | ||
73 | which would permit us to invoke rcu_dereference_protected as follows: | ||
74 | |||
75 | if (rcu_dereference_protected(ioc->ioc_data, | ||
76 | lockdep_is_held(&q->queue_lock)) == cic) { | ||
77 | |||
78 | With this change, there would be no lockdep-RCU splat emitted if this | ||
79 | code was invoked either from within an RCU read-side critical section | ||
80 | or with the ->queue_lock held. In particular, this would have suppressed | ||
81 | the above lockdep-RCU splat because ->queue_lock is held (see #2 in the | ||
82 | list above). | ||
83 | |||
84 | On the other hand, perhaps we really do need an RCU read-side critical | ||
85 | section. In this case, the critical section must span the use of the | ||
86 | return value from rcu_dereference(), or at least until there is some | ||
87 | reference count incremented or some such. One way to handle this is to | ||
88 | add rcu_read_lock() and rcu_read_unlock() as follows: | ||
89 | |||
90 | rcu_read_lock(); | ||
91 | if (rcu_dereference(ioc->ioc_data) == cic) { | ||
92 | spin_lock(&ioc->lock); | ||
93 | rcu_assign_pointer(ioc->ioc_data, NULL); | ||
94 | spin_unlock(&ioc->lock); | ||
95 | } | ||
96 | rcu_read_unlock(); | ||
97 | |||
98 | With this change, the rcu_dereference() is always within an RCU | ||
99 | read-side critical section, which again would have suppressed the | ||
100 | above lockdep-RCU splat. | ||
101 | |||
102 | But in this particular case, we don't actually deference the pointer | ||
103 | returned from rcu_dereference(). Instead, that pointer is just compared | ||
104 | to the cic pointer, which means that the rcu_dereference() can be replaced | ||
105 | by rcu_access_pointer() as follows: | ||
106 | |||
107 | if (rcu_access_pointer(ioc->ioc_data) == cic) { | ||
108 | |||
109 | Because it is legal to invoke rcu_access_pointer() without protection, | ||
110 | this change would also suppress the above lockdep-RCU splat. | ||
diff --git a/Documentation/RCU/lockdep.txt b/Documentation/RCU/lockdep.txt index d7a49b2f6994..a102d4b3724b 100644 --- a/Documentation/RCU/lockdep.txt +++ b/Documentation/RCU/lockdep.txt | |||
@@ -32,9 +32,27 @@ checking of rcu_dereference() primitives: | |||
32 | srcu_dereference(p, sp): | 32 | srcu_dereference(p, sp): |
33 | Check for SRCU read-side critical section. | 33 | Check for SRCU read-side critical section. |
34 | rcu_dereference_check(p, c): | 34 | rcu_dereference_check(p, c): |
35 | Use explicit check expression "c". This is useful in | 35 | Use explicit check expression "c" along with |
36 | code that is invoked by both readers and updaters. | 36 | rcu_read_lock_held(). This is useful in code that is |
37 | rcu_dereference_raw(p) | 37 | invoked by both RCU readers and updaters. |
38 | rcu_dereference_bh_check(p, c): | ||
39 | Use explicit check expression "c" along with | ||
40 | rcu_read_lock_bh_held(). This is useful in code that | ||
41 | is invoked by both RCU-bh readers and updaters. | ||
42 | rcu_dereference_sched_check(p, c): | ||
43 | Use explicit check expression "c" along with | ||
44 | rcu_read_lock_sched_held(). This is useful in code that | ||
45 | is invoked by both RCU-sched readers and updaters. | ||
46 | srcu_dereference_check(p, c): | ||
47 | Use explicit check expression "c" along with | ||
48 | srcu_read_lock_held()(). This is useful in code that | ||
49 | is invoked by both SRCU readers and updaters. | ||
50 | rcu_dereference_index_check(p, c): | ||
51 | Use explicit check expression "c", but the caller | ||
52 | must supply one of the rcu_read_lock_held() functions. | ||
53 | This is useful in code that uses RCU-protected arrays | ||
54 | that is invoked by both RCU readers and updaters. | ||
55 | rcu_dereference_raw(p): | ||
38 | Don't check. (Use sparingly, if at all.) | 56 | Don't check. (Use sparingly, if at all.) |
39 | rcu_dereference_protected(p, c): | 57 | rcu_dereference_protected(p, c): |
40 | Use explicit check expression "c", and omit all barriers | 58 | Use explicit check expression "c", and omit all barriers |
@@ -48,13 +66,11 @@ checking of rcu_dereference() primitives: | |||
48 | value of the pointer itself, for example, against NULL. | 66 | value of the pointer itself, for example, against NULL. |
49 | 67 | ||
50 | The rcu_dereference_check() check expression can be any boolean | 68 | The rcu_dereference_check() check expression can be any boolean |
51 | expression, but would normally include one of the rcu_read_lock_held() | 69 | expression, but would normally include a lockdep expression. However, |
52 | family of functions and a lockdep expression. However, any boolean | 70 | any boolean expression can be used. For a moderately ornate example, |
53 | expression can be used. For a moderately ornate example, consider | 71 | consider the following: |
54 | the following: | ||
55 | 72 | ||
56 | file = rcu_dereference_check(fdt->fd[fd], | 73 | file = rcu_dereference_check(fdt->fd[fd], |
57 | rcu_read_lock_held() || | ||
58 | lockdep_is_held(&files->file_lock) || | 74 | lockdep_is_held(&files->file_lock) || |
59 | atomic_read(&files->count) == 1); | 75 | atomic_read(&files->count) == 1); |
60 | 76 | ||
@@ -62,7 +78,7 @@ This expression picks up the pointer "fdt->fd[fd]" in an RCU-safe manner, | |||
62 | and, if CONFIG_PROVE_RCU is configured, verifies that this expression | 78 | and, if CONFIG_PROVE_RCU is configured, verifies that this expression |
63 | is used in: | 79 | is used in: |
64 | 80 | ||
65 | 1. An RCU read-side critical section, or | 81 | 1. An RCU read-side critical section (implicit), or |
66 | 2. with files->file_lock held, or | 82 | 2. with files->file_lock held, or |
67 | 3. on an unshared files_struct. | 83 | 3. on an unshared files_struct. |
68 | 84 | ||
diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt index 5d9016795fd8..783d6c134d3f 100644 --- a/Documentation/RCU/torture.txt +++ b/Documentation/RCU/torture.txt | |||
@@ -42,7 +42,7 @@ fqs_holdoff Holdoff time (in microseconds) between consecutive calls | |||
42 | fqs_stutter Wait time (in seconds) between consecutive bursts | 42 | fqs_stutter Wait time (in seconds) between consecutive bursts |
43 | of calls to force_quiescent_state(). | 43 | of calls to force_quiescent_state(). |
44 | 44 | ||
45 | irqreaders Says to invoke RCU readers from irq level. This is currently | 45 | irqreader Says to invoke RCU readers from irq level. This is currently |
46 | done via timers. Defaults to "1" for variants of RCU that | 46 | done via timers. Defaults to "1" for variants of RCU that |
47 | permit this. (Or, more accurately, variants of RCU that do | 47 | permit this. (Or, more accurately, variants of RCU that do |
48 | -not- permit this know to ignore this variable.) | 48 | -not- permit this know to ignore this variable.) |
@@ -79,19 +79,68 @@ stutter The length of time to run the test before pausing for this | |||
79 | Specifying "stutter=0" causes the test to run continuously | 79 | Specifying "stutter=0" causes the test to run continuously |
80 | without pausing, which is the old default behavior. | 80 | without pausing, which is the old default behavior. |
81 | 81 | ||
82 | test_boost Whether or not to test the ability of RCU to do priority | ||
83 | boosting. Defaults to "test_boost=1", which performs | ||
84 | RCU priority-inversion testing only if the selected | ||
85 | RCU implementation supports priority boosting. Specifying | ||
86 | "test_boost=0" never performs RCU priority-inversion | ||
87 | testing. Specifying "test_boost=2" performs RCU | ||
88 | priority-inversion testing even if the selected RCU | ||
89 | implementation does not support RCU priority boosting, | ||
90 | which can be used to test rcutorture's ability to | ||
91 | carry out RCU priority-inversion testing. | ||
92 | |||
93 | test_boost_interval | ||
94 | The number of seconds in an RCU priority-inversion test | ||
95 | cycle. Defaults to "test_boost_interval=7". It is | ||
96 | usually wise for this value to be relatively prime to | ||
97 | the value selected for "stutter". | ||
98 | |||
99 | test_boost_duration | ||
100 | The number of seconds to do RCU priority-inversion testing | ||
101 | within any given "test_boost_interval". Defaults to | ||
102 | "test_boost_duration=4". | ||
103 | |||
82 | test_no_idle_hz Whether or not to test the ability of RCU to operate in | 104 | test_no_idle_hz Whether or not to test the ability of RCU to operate in |
83 | a kernel that disables the scheduling-clock interrupt to | 105 | a kernel that disables the scheduling-clock interrupt to |
84 | idle CPUs. Boolean parameter, "1" to test, "0" otherwise. | 106 | idle CPUs. Boolean parameter, "1" to test, "0" otherwise. |
85 | Defaults to omitting this test. | 107 | Defaults to omitting this test. |
86 | 108 | ||
87 | torture_type The type of RCU to test: "rcu" for the rcu_read_lock() API, | 109 | torture_type The type of RCU to test, with string values as follows: |
88 | "rcu_sync" for rcu_read_lock() with synchronous reclamation, | 110 | |
89 | "rcu_bh" for the rcu_read_lock_bh() API, "rcu_bh_sync" for | 111 | "rcu": rcu_read_lock(), rcu_read_unlock() and call_rcu(). |
90 | rcu_read_lock_bh() with synchronous reclamation, "srcu" for | 112 | |
91 | the "srcu_read_lock()" API, "sched" for the use of | 113 | "rcu_sync": rcu_read_lock(), rcu_read_unlock(), and |
92 | preempt_disable() together with synchronize_sched(), | 114 | synchronize_rcu(). |
93 | and "sched_expedited" for the use of preempt_disable() | 115 | |
94 | with synchronize_sched_expedited(). | 116 | "rcu_expedited": rcu_read_lock(), rcu_read_unlock(), and |
117 | synchronize_rcu_expedited(). | ||
118 | |||
119 | "rcu_bh": rcu_read_lock_bh(), rcu_read_unlock_bh(), and | ||
120 | call_rcu_bh(). | ||
121 | |||
122 | "rcu_bh_sync": rcu_read_lock_bh(), rcu_read_unlock_bh(), | ||
123 | and synchronize_rcu_bh(). | ||
124 | |||
125 | "rcu_bh_expedited": rcu_read_lock_bh(), rcu_read_unlock_bh(), | ||
126 | and synchronize_rcu_bh_expedited(). | ||
127 | |||
128 | "srcu": srcu_read_lock(), srcu_read_unlock() and | ||
129 | synchronize_srcu(). | ||
130 | |||
131 | "srcu_expedited": srcu_read_lock(), srcu_read_unlock() and | ||
132 | synchronize_srcu_expedited(). | ||
133 | |||
134 | "sched": preempt_disable(), preempt_enable(), and | ||
135 | call_rcu_sched(). | ||
136 | |||
137 | "sched_sync": preempt_disable(), preempt_enable(), and | ||
138 | synchronize_sched(). | ||
139 | |||
140 | "sched_expedited": preempt_disable(), preempt_enable(), and | ||
141 | synchronize_sched_expedited(). | ||
142 | |||
143 | Defaults to "rcu". | ||
95 | 144 | ||
96 | verbose Enable debug printk()s. Default is disabled. | 145 | verbose Enable debug printk()s. Default is disabled. |
97 | 146 | ||
@@ -100,12 +149,12 @@ OUTPUT | |||
100 | 149 | ||
101 | The statistics output is as follows: | 150 | The statistics output is as follows: |
102 | 151 | ||
103 | rcu-torture: --- Start of test: nreaders=16 stat_interval=0 verbose=0 | 152 | rcu-torture:--- Start of test: nreaders=16 nfakewriters=4 stat_interval=30 verbose=0 test_no_idle_hz=1 shuffle_interval=3 stutter=5 irqreader=1 fqs_duration=0 fqs_holdoff=0 fqs_stutter=3 test_boost=1/0 test_boost_interval=7 test_boost_duration=4 |
104 | rcu-torture: rtc: 0000000000000000 ver: 1916 tfle: 0 rta: 1916 rtaf: 0 rtf: 1915 | 153 | rcu-torture: rtc: (null) ver: 155441 tfle: 0 rta: 155441 rtaf: 8884 rtf: 155440 rtmbe: 0 rtbke: 0 rtbre: 0 rtbf: 0 rtb: 0 nt: 3055767 |
105 | rcu-torture: Reader Pipe: 1466408 9747 0 0 0 0 0 0 0 0 0 | 154 | rcu-torture: Reader Pipe: 727860534 34213 0 0 0 0 0 0 0 0 0 |
106 | rcu-torture: Reader Batch: 1464477 11678 0 0 0 0 0 0 0 0 | 155 | rcu-torture: Reader Batch: 727877838 17003 0 0 0 0 0 0 0 0 0 |
107 | rcu-torture: Free-Block Circulation: 1915 1915 1915 1915 1915 1915 1915 1915 1915 1915 0 | 156 | rcu-torture: Free-Block Circulation: 155440 155440 155440 155440 155440 155440 155440 155440 155440 155440 0 |
108 | rcu-torture: --- End of test | 157 | rcu-torture:--- End of test: SUCCESS: nreaders=16 nfakewriters=4 stat_interval=30 verbose=0 test_no_idle_hz=1 shuffle_interval=3 stutter=5 irqreader=1 fqs_duration=0 fqs_holdoff=0 fqs_stutter=3 test_boost=1/0 test_boost_interval=7 test_boost_duration=4 |
109 | 158 | ||
110 | The command "dmesg | grep torture:" will extract this information on | 159 | The command "dmesg | grep torture:" will extract this information on |
111 | most systems. On more esoteric configurations, it may be necessary to | 160 | most systems. On more esoteric configurations, it may be necessary to |
@@ -113,26 +162,55 @@ use other commands to access the output of the printk()s used by | |||
113 | the RCU torture test. The printk()s use KERN_ALERT, so they should | 162 | the RCU torture test. The printk()s use KERN_ALERT, so they should |
114 | be evident. ;-) | 163 | be evident. ;-) |
115 | 164 | ||
165 | The first and last lines show the rcutorture module parameters, and the | ||
166 | last line shows either "SUCCESS" or "FAILURE", based on rcutorture's | ||
167 | automatic determination as to whether RCU operated correctly. | ||
168 | |||
116 | The entries are as follows: | 169 | The entries are as follows: |
117 | 170 | ||
118 | o "rtc": The hexadecimal address of the structure currently visible | 171 | o "rtc": The hexadecimal address of the structure currently visible |
119 | to readers. | 172 | to readers. |
120 | 173 | ||
121 | o "ver": The number of times since boot that the rcutw writer task | 174 | o "ver": The number of times since boot that the RCU writer task |
122 | has changed the structure visible to readers. | 175 | has changed the structure visible to readers. |
123 | 176 | ||
124 | o "tfle": If non-zero, indicates that the "torture freelist" | 177 | o "tfle": If non-zero, indicates that the "torture freelist" |
125 | containing structure to be placed into the "rtc" area is empty. | 178 | containing structures to be placed into the "rtc" area is empty. |
126 | This condition is important, since it can fool you into thinking | 179 | This condition is important, since it can fool you into thinking |
127 | that RCU is working when it is not. :-/ | 180 | that RCU is working when it is not. :-/ |
128 | 181 | ||
129 | o "rta": Number of structures allocated from the torture freelist. | 182 | o "rta": Number of structures allocated from the torture freelist. |
130 | 183 | ||
131 | o "rtaf": Number of allocations from the torture freelist that have | 184 | o "rtaf": Number of allocations from the torture freelist that have |
132 | failed due to the list being empty. | 185 | failed due to the list being empty. It is not unusual for this |
186 | to be non-zero, but it is bad for it to be a large fraction of | ||
187 | the value indicated by "rta". | ||
133 | 188 | ||
134 | o "rtf": Number of frees into the torture freelist. | 189 | o "rtf": Number of frees into the torture freelist. |
135 | 190 | ||
191 | o "rtmbe": A non-zero value indicates that rcutorture believes that | ||
192 | rcu_assign_pointer() and rcu_dereference() are not working | ||
193 | correctly. This value should be zero. | ||
194 | |||
195 | o "rtbke": rcutorture was unable to create the real-time kthreads | ||
196 | used to force RCU priority inversion. This value should be zero. | ||
197 | |||
198 | o "rtbre": Although rcutorture successfully created the kthreads | ||
199 | used to force RCU priority inversion, it was unable to set them | ||
200 | to the real-time priority level of 1. This value should be zero. | ||
201 | |||
202 | o "rtbf": The number of times that RCU priority boosting failed | ||
203 | to resolve RCU priority inversion. | ||
204 | |||
205 | o "rtb": The number of times that rcutorture attempted to force | ||
206 | an RCU priority inversion condition. If you are testing RCU | ||
207 | priority boosting via the "test_boost" module parameter, this | ||
208 | value should be non-zero. | ||
209 | |||
210 | o "nt": The number of times rcutorture ran RCU read-side code from | ||
211 | within a timer handler. This value should be non-zero only | ||
212 | if you specified the "irqreader" module parameter. | ||
213 | |||
136 | o "Reader Pipe": Histogram of "ages" of structures seen by readers. | 214 | o "Reader Pipe": Histogram of "ages" of structures seen by readers. |
137 | If any entries past the first two are non-zero, RCU is broken. | 215 | If any entries past the first two are non-zero, RCU is broken. |
138 | And rcutorture prints the error flag string "!!!" to make sure | 216 | And rcutorture prints the error flag string "!!!" to make sure |
@@ -162,26 +240,15 @@ o "Free-Block Circulation": Shows the number of torture structures | |||
162 | somehow gets incremented farther than it should. | 240 | somehow gets incremented farther than it should. |
163 | 241 | ||
164 | Different implementations of RCU can provide implementation-specific | 242 | Different implementations of RCU can provide implementation-specific |
165 | additional information. For example, SRCU provides the following: | 243 | additional information. For example, SRCU provides the following |
244 | additional line: | ||
166 | 245 | ||
167 | srcu-torture: rtc: f8cf46a8 ver: 355 tfle: 0 rta: 356 rtaf: 0 rtf: 346 rtmbe: 0 | ||
168 | srcu-torture: Reader Pipe: 559738 939 0 0 0 0 0 0 0 0 0 | ||
169 | srcu-torture: Reader Batch: 560434 243 0 0 0 0 0 0 0 0 | ||
170 | srcu-torture: Free-Block Circulation: 355 354 353 352 351 350 349 348 347 346 0 | ||
171 | srcu-torture: per-CPU(idx=1): 0(0,1) 1(0,1) 2(0,0) 3(0,1) | 246 | srcu-torture: per-CPU(idx=1): 0(0,1) 1(0,1) 2(0,0) 3(0,1) |
172 | 247 | ||
173 | The first four lines are similar to those for RCU. The last line shows | 248 | This line shows the per-CPU counter state. The numbers in parentheses are |
174 | the per-CPU counter state. The numbers in parentheses are the values | 249 | the values of the "old" and "current" counters for the corresponding CPU. |
175 | of the "old" and "current" counters for the corresponding CPU. The | 250 | The "idx" value maps the "old" and "current" values to the underlying |
176 | "idx" value maps the "old" and "current" values to the underlying array, | 251 | array, and is useful for debugging. |
177 | and is useful for debugging. | ||
178 | |||
179 | Similarly, sched_expedited RCU provides the following: | ||
180 | |||
181 | sched_expedited-torture: rtc: d0000000016c1880 ver: 1090796 tfle: 0 rta: 1090796 rtaf: 0 rtf: 1090787 rtmbe: 0 nt: 27713319 | ||
182 | sched_expedited-torture: Reader Pipe: 12660320201 95875 0 0 0 0 0 0 0 0 0 | ||
183 | sched_expedited-torture: Reader Batch: 12660424885 0 0 0 0 0 0 0 0 0 0 | ||
184 | sched_expedited-torture: Free-Block Circulation: 1090795 1090795 1090794 1090793 1090792 1090791 1090790 1090789 1090788 1090787 0 | ||
185 | 252 | ||
186 | 253 | ||
187 | USAGE | 254 | USAGE |
diff --git a/Documentation/RCU/trace.txt b/Documentation/RCU/trace.txt index 8173cec473aa..aaf65f6c6cd7 100644 --- a/Documentation/RCU/trace.txt +++ b/Documentation/RCU/trace.txt | |||
@@ -33,23 +33,23 @@ rcu/rcuboost: | |||
33 | The output of "cat rcu/rcudata" looks as follows: | 33 | The output of "cat rcu/rcudata" looks as follows: |
34 | 34 | ||
35 | rcu_sched: | 35 | rcu_sched: |
36 | 0 c=20972 g=20973 pq=1 pqc=20972 qp=0 dt=545/1/0 df=50 of=0 ri=0 ql=163 qs=NRW. kt=0/W/0 ktl=ebc3 b=10 ci=153737 co=0 ca=0 | 36 | 0 c=20972 g=20973 pq=1 pgp=20973 qp=0 dt=545/1/0 df=50 of=0 ri=0 ql=163 qs=NRW. kt=0/W/0 ktl=ebc3 b=10 ci=153737 co=0 ca=0 |
37 | 1 c=20972 g=20973 pq=1 pqc=20972 qp=0 dt=967/1/0 df=58 of=0 ri=0 ql=634 qs=NRW. kt=0/W/1 ktl=58c b=10 ci=191037 co=0 ca=0 | 37 | 1 c=20972 g=20973 pq=1 pgp=20973 qp=0 dt=967/1/0 df=58 of=0 ri=0 ql=634 qs=NRW. kt=0/W/1 ktl=58c b=10 ci=191037 co=0 ca=0 |
38 | 2 c=20972 g=20973 pq=1 pqc=20972 qp=0 dt=1081/1/0 df=175 of=0 ri=0 ql=74 qs=N.W. kt=0/W/2 ktl=da94 b=10 ci=75991 co=0 ca=0 | 38 | 2 c=20972 g=20973 pq=1 pgp=20973 qp=0 dt=1081/1/0 df=175 of=0 ri=0 ql=74 qs=N.W. kt=0/W/2 ktl=da94 b=10 ci=75991 co=0 ca=0 |
39 | 3 c=20942 g=20943 pq=1 pqc=20942 qp=1 dt=1846/0/0 df=404 of=0 ri=0 ql=0 qs=.... kt=0/W/3 ktl=d1cd b=10 ci=72261 co=0 ca=0 | 39 | 3 c=20942 g=20943 pq=1 pgp=20942 qp=1 dt=1846/0/0 df=404 of=0 ri=0 ql=0 qs=.... kt=0/W/3 ktl=d1cd b=10 ci=72261 co=0 ca=0 |
40 | 4 c=20972 g=20973 pq=1 pqc=20972 qp=0 dt=369/1/0 df=83 of=0 ri=0 ql=48 qs=N.W. kt=0/W/4 ktl=e0e7 b=10 ci=128365 co=0 ca=0 | 40 | 4 c=20972 g=20973 pq=1 pgp=20973 qp=0 dt=369/1/0 df=83 of=0 ri=0 ql=48 qs=N.W. kt=0/W/4 ktl=e0e7 b=10 ci=128365 co=0 ca=0 |
41 | 5 c=20972 g=20973 pq=1 pqc=20972 qp=0 dt=381/1/0 df=64 of=0 ri=0 ql=169 qs=NRW. kt=0/W/5 ktl=fb2f b=10 ci=164360 co=0 ca=0 | 41 | 5 c=20972 g=20973 pq=1 pgp=20973 qp=0 dt=381/1/0 df=64 of=0 ri=0 ql=169 qs=NRW. kt=0/W/5 ktl=fb2f b=10 ci=164360 co=0 ca=0 |
42 | 6 c=20972 g=20973 pq=1 pqc=20972 qp=0 dt=1037/1/0 df=183 of=0 ri=0 ql=62 qs=N.W. kt=0/W/6 ktl=d2ad b=10 ci=65663 co=0 ca=0 | 42 | 6 c=20972 g=20973 pq=1 pgp=20973 qp=0 dt=1037/1/0 df=183 of=0 ri=0 ql=62 qs=N.W. kt=0/W/6 ktl=d2ad b=10 ci=65663 co=0 ca=0 |
43 | 7 c=20897 g=20897 pq=1 pqc=20896 qp=0 dt=1572/0/0 df=382 of=0 ri=0 ql=0 qs=.... kt=0/W/7 ktl=cf15 b=10 ci=75006 co=0 ca=0 | 43 | 7 c=20897 g=20897 pq=1 pgp=20896 qp=0 dt=1572/0/0 df=382 of=0 ri=0 ql=0 qs=.... kt=0/W/7 ktl=cf15 b=10 ci=75006 co=0 ca=0 |
44 | rcu_bh: | 44 | rcu_bh: |
45 | 0 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=545/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/0 ktl=ebc3 b=10 ci=0 co=0 ca=0 | 45 | 0 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=545/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/0 ktl=ebc3 b=10 ci=0 co=0 ca=0 |
46 | 1 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=967/1/0 df=3 of=0 ri=1 ql=0 qs=.... kt=0/W/1 ktl=58c b=10 ci=151 co=0 ca=0 | 46 | 1 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=967/1/0 df=3 of=0 ri=1 ql=0 qs=.... kt=0/W/1 ktl=58c b=10 ci=151 co=0 ca=0 |
47 | 2 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=1081/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/2 ktl=da94 b=10 ci=0 co=0 ca=0 | 47 | 2 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=1081/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/2 ktl=da94 b=10 ci=0 co=0 ca=0 |
48 | 3 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=1846/0/0 df=8 of=0 ri=1 ql=0 qs=.... kt=0/W/3 ktl=d1cd b=10 ci=0 co=0 ca=0 | 48 | 3 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=1846/0/0 df=8 of=0 ri=1 ql=0 qs=.... kt=0/W/3 ktl=d1cd b=10 ci=0 co=0 ca=0 |
49 | 4 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=369/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/4 ktl=e0e7 b=10 ci=0 co=0 ca=0 | 49 | 4 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=369/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/4 ktl=e0e7 b=10 ci=0 co=0 ca=0 |
50 | 5 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=381/1/0 df=4 of=0 ri=1 ql=0 qs=.... kt=0/W/5 ktl=fb2f b=10 ci=0 co=0 ca=0 | 50 | 5 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=381/1/0 df=4 of=0 ri=1 ql=0 qs=.... kt=0/W/5 ktl=fb2f b=10 ci=0 co=0 ca=0 |
51 | 6 c=1480 g=1480 pq=1 pqc=1479 qp=0 dt=1037/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/6 ktl=d2ad b=10 ci=0 co=0 ca=0 | 51 | 6 c=1480 g=1480 pq=1 pgp=1480 qp=0 dt=1037/1/0 df=6 of=0 ri=1 ql=0 qs=.... kt=0/W/6 ktl=d2ad b=10 ci=0 co=0 ca=0 |
52 | 7 c=1474 g=1474 pq=1 pqc=1473 qp=0 dt=1572/0/0 df=8 of=0 ri=1 ql=0 qs=.... kt=0/W/7 ktl=cf15 b=10 ci=0 co=0 ca=0 | 52 | 7 c=1474 g=1474 pq=1 pgp=1473 qp=0 dt=1572/0/0 df=8 of=0 ri=1 ql=0 qs=.... kt=0/W/7 ktl=cf15 b=10 ci=0 co=0 ca=0 |
53 | 53 | ||
54 | The first section lists the rcu_data structures for rcu_sched, the second | 54 | The first section lists the rcu_data structures for rcu_sched, the second |
55 | for rcu_bh. Note that CONFIG_TREE_PREEMPT_RCU kernels will have an | 55 | for rcu_bh. Note that CONFIG_TREE_PREEMPT_RCU kernels will have an |
@@ -84,7 +84,7 @@ o "pq" indicates that this CPU has passed through a quiescent state | |||
84 | CPU has not yet reported that fact, (2) some other CPU has not | 84 | CPU has not yet reported that fact, (2) some other CPU has not |
85 | yet reported for this grace period, or (3) both. | 85 | yet reported for this grace period, or (3) both. |
86 | 86 | ||
87 | o "pqc" indicates which grace period the last-observed quiescent | 87 | o "pgp" indicates which grace period the last-observed quiescent |
88 | state for this CPU corresponds to. This is important for handling | 88 | state for this CPU corresponds to. This is important for handling |
89 | the race between CPU 0 reporting an extended dynticks-idle | 89 | the race between CPU 0 reporting an extended dynticks-idle |
90 | quiescent state for CPU 1 and CPU 1 suddenly waking up and | 90 | quiescent state for CPU 1 and CPU 1 suddenly waking up and |
@@ -184,10 +184,14 @@ o "kt" is the per-CPU kernel-thread state. The digit preceding | |||
184 | The number after the final slash is the CPU that the kthread | 184 | The number after the final slash is the CPU that the kthread |
185 | is actually running on. | 185 | is actually running on. |
186 | 186 | ||
187 | This field is displayed only for CONFIG_RCU_BOOST kernels. | ||
188 | |||
187 | o "ktl" is the low-order 16 bits (in hexadecimal) of the count of | 189 | o "ktl" is the low-order 16 bits (in hexadecimal) of the count of |
188 | the number of times that this CPU's per-CPU kthread has gone | 190 | the number of times that this CPU's per-CPU kthread has gone |
189 | through its loop servicing invoke_rcu_cpu_kthread() requests. | 191 | through its loop servicing invoke_rcu_cpu_kthread() requests. |
190 | 192 | ||
193 | This field is displayed only for CONFIG_RCU_BOOST kernels. | ||
194 | |||
191 | o "b" is the batch limit for this CPU. If more than this number | 195 | o "b" is the batch limit for this CPU. If more than this number |
192 | of RCU callbacks is ready to invoke, then the remainder will | 196 | of RCU callbacks is ready to invoke, then the remainder will |
193 | be deferred. | 197 | be deferred. |