diff options
| -rw-r--r-- | Documentation/RCU/stallwarn.txt | 94 | ||||
| -rw-r--r-- | Documentation/RCU/trace.txt | 35 | ||||
| -rw-r--r-- | include/linux/debugobjects.h | 11 | ||||
| -rw-r--r-- | include/linux/init_task.h | 1 | ||||
| -rw-r--r-- | include/linux/rcupdate.h | 50 | ||||
| -rw-r--r-- | include/linux/rcutiny.h | 29 | ||||
| -rw-r--r-- | include/linux/rcutree.h | 6 | ||||
| -rw-r--r-- | include/linux/srcu.h | 6 | ||||
| -rw-r--r-- | kernel/lockdep.c | 3 | ||||
| -rw-r--r-- | kernel/rcupdate.c | 19 | ||||
| -rw-r--r-- | kernel/rcutiny.c | 35 | ||||
| -rw-r--r-- | kernel/rcutiny_plugin.h | 39 | ||||
| -rw-r--r-- | kernel/rcutorture.c | 2 | ||||
| -rw-r--r-- | kernel/rcutree.c | 131 | ||||
| -rw-r--r-- | kernel/rcutree.h | 2 | ||||
| -rw-r--r-- | kernel/rcutree_plugin.h | 69 | ||||
| -rw-r--r-- | kernel/rcutree_trace.c | 4 | ||||
| -rw-r--r-- | kernel/sched.c | 2 | ||||
| -rw-r--r-- | kernel/softirq.c | 2 | ||||
| -rw-r--r-- | lib/Kconfig.debug | 14 | ||||
| -rw-r--r-- | lib/debugobjects.c | 59 |
21 files changed, 470 insertions, 143 deletions
diff --git a/Documentation/RCU/stallwarn.txt b/Documentation/RCU/stallwarn.txt index 1423d2570d78..44c6dcc93d6d 100644 --- a/Documentation/RCU/stallwarn.txt +++ b/Documentation/RCU/stallwarn.txt | |||
| @@ -3,35 +3,79 @@ Using RCU's CPU Stall Detector | |||
| 3 | The CONFIG_RCU_CPU_STALL_DETECTOR kernel config parameter enables | 3 | The CONFIG_RCU_CPU_STALL_DETECTOR kernel config parameter enables |
| 4 | RCU's CPU stall detector, which detects conditions that unduly delay | 4 | RCU's CPU stall detector, which detects conditions that unduly delay |
| 5 | RCU grace periods. The stall detector's idea of what constitutes | 5 | RCU grace periods. The stall detector's idea of what constitutes |
| 6 | "unduly delayed" is controlled by a pair of C preprocessor macros: | 6 | "unduly delayed" is controlled by a set of C preprocessor macros: |
| 7 | 7 | ||
| 8 | RCU_SECONDS_TILL_STALL_CHECK | 8 | RCU_SECONDS_TILL_STALL_CHECK |
| 9 | 9 | ||
| 10 | This macro defines the period of time that RCU will wait from | 10 | This macro defines the period of time that RCU will wait from |
| 11 | the beginning of a grace period until it issues an RCU CPU | 11 | the beginning of a grace period until it issues an RCU CPU |
| 12 | stall warning. It is normally ten seconds. | 12 | stall warning. This time period is normally ten seconds. |
| 13 | 13 | ||
| 14 | RCU_SECONDS_TILL_STALL_RECHECK | 14 | RCU_SECONDS_TILL_STALL_RECHECK |
| 15 | 15 | ||
| 16 | This macro defines the period of time that RCU will wait after | 16 | This macro defines the period of time that RCU will wait after |
| 17 | issuing a stall warning until it issues another stall warning. | 17 | issuing a stall warning until it issues another stall warning |
| 18 | It is normally set to thirty seconds. | 18 | for the same stall. This time period is normally set to thirty |
| 19 | seconds. | ||
| 19 | 20 | ||
| 20 | RCU_STALL_RAT_DELAY | 21 | RCU_STALL_RAT_DELAY |
| 21 | 22 | ||
| 22 | The CPU stall detector tries to make the offending CPU rat on itself, | 23 | The CPU stall detector tries to make the offending CPU print its |
| 23 | as this often gives better-quality stack traces. However, if | 24 | own warnings, as this often gives better-quality stack traces. |
| 24 | the offending CPU does not detect its own stall in the number | 25 | However, if the offending CPU does not detect its own stall in |
| 25 | of jiffies specified by RCU_STALL_RAT_DELAY, then other CPUs will | 26 | the number of jiffies specified by RCU_STALL_RAT_DELAY, then |
| 26 | complain. This is normally set to two jiffies. | 27 | some other CPU will complain. This delay is normally set to |
| 28 | two jiffies. | ||
| 27 | 29 | ||
| 28 | The following problems can result in an RCU CPU stall warning: | 30 | When a CPU detects that it is stalling, it will print a message similar |
| 31 | to the following: | ||
| 32 | |||
| 33 | INFO: rcu_sched_state detected stall on CPU 5 (t=2500 jiffies) | ||
| 34 | |||
| 35 | This message indicates that CPU 5 detected that it was causing a stall, | ||
| 36 | and that the stall was affecting RCU-sched. This message will normally be | ||
| 37 | followed by a stack dump of the offending CPU. On TREE_RCU kernel builds, | ||
| 38 | RCU and RCU-sched are implemented by the same underlying mechanism, | ||
| 39 | while on TREE_PREEMPT_RCU kernel builds, RCU is instead implemented | ||
| 40 | by rcu_preempt_state. | ||
| 41 | |||
| 42 | On the other hand, if the offending CPU fails to print out a stall-warning | ||
| 43 | message quickly enough, some other CPU will print a message similar to | ||
| 44 | the following: | ||
| 45 | |||
| 46 | INFO: rcu_bh_state detected stalls on CPUs/tasks: { 3 5 } (detected by 2, 2502 jiffies) | ||
| 47 | |||
| 48 | This message indicates that CPU 2 detected that CPUs 3 and 5 were both | ||
| 49 | causing stalls, and that the stall was affecting RCU-bh. This message | ||
| 50 | will normally be followed by stack dumps for each CPU. Please note that | ||
| 51 | TREE_PREEMPT_RCU builds can be stalled by tasks as well as by CPUs, | ||
| 52 | and that the tasks will be indicated by PID, for example, "P3421". | ||
| 53 | It is even possible for a rcu_preempt_state stall to be caused by both | ||
| 54 | CPUs -and- tasks, in which case the offending CPUs and tasks will all | ||
| 55 | be called out in the list. | ||
| 56 | |||
| 57 | Finally, if the grace period ends just as the stall warning starts | ||
| 58 | printing, there will be a spurious stall-warning message: | ||
| 59 | |||
| 60 | INFO: rcu_bh_state detected stalls on CPUs/tasks: { } (detected by 4, 2502 jiffies) | ||
| 61 | |||
| 62 | This is rare, but does happen from time to time in real life. | ||
| 63 | |||
| 64 | So your kernel printed an RCU CPU stall warning. The next question is | ||
| 65 | "What caused it?" The following problems can result in RCU CPU stall | ||
| 66 | warnings: | ||
| 29 | 67 | ||
| 30 | o A CPU looping in an RCU read-side critical section. | 68 | o A CPU looping in an RCU read-side critical section. |
| 31 | 69 | ||
| 32 | o A CPU looping with interrupts disabled. | 70 | o A CPU looping with interrupts disabled. This condition can |
| 71 | result in RCU-sched and RCU-bh stalls. | ||
| 33 | 72 | ||
| 34 | o A CPU looping with preemption disabled. | 73 | o A CPU looping with preemption disabled. This condition can |
| 74 | result in RCU-sched stalls and, if ksoftirqd is in use, RCU-bh | ||
| 75 | stalls. | ||
| 76 | |||
| 77 | o A CPU looping with bottom halves disabled. This condition can | ||
| 78 | result in RCU-sched and RCU-bh stalls. | ||
| 35 | 79 | ||
| 36 | o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel | 80 | o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel |
| 37 | without invoking schedule(). | 81 | without invoking schedule(). |
| @@ -39,20 +83,24 @@ o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel | |||
| 39 | o A bug in the RCU implementation. | 83 | o A bug in the RCU implementation. |
| 40 | 84 | ||
| 41 | o A hardware failure. This is quite unlikely, but has occurred | 85 | o A hardware failure. This is quite unlikely, but has occurred |
| 42 | at least once in a former life. A CPU failed in a running system, | 86 | at least once in real life. A CPU failed in a running system, |
| 43 | becoming unresponsive, but not causing an immediate crash. | 87 | becoming unresponsive, but not causing an immediate crash. |
| 44 | This resulted in a series of RCU CPU stall warnings, eventually | 88 | This resulted in a series of RCU CPU stall warnings, eventually |
| 45 | leading the realization that the CPU had failed. | 89 | leading the realization that the CPU had failed. |
| 46 | 90 | ||
| 47 | The RCU, RCU-sched, and RCU-bh implementations have CPU stall warning. | 91 | The RCU, RCU-sched, and RCU-bh implementations have CPU stall |
| 48 | SRCU does not do so directly, but its calls to synchronize_sched() will | 92 | warning. SRCU does not have its own CPU stall warnings, but its |
| 49 | result in RCU-sched detecting any CPU stalls that might be occurring. | 93 | calls to synchronize_sched() will result in RCU-sched detecting |
| 50 | 94 | RCU-sched-related CPU stalls. Please note that RCU only detects | |
| 51 | To diagnose the cause of the stall, inspect the stack traces. The offending | 95 | CPU stalls when there is a grace period in progress. No grace period, |
| 52 | function will usually be near the top of the stack. If you have a series | 96 | no CPU stall warnings. |
| 53 | of stall warnings from a single extended stall, comparing the stack traces | 97 | |
| 54 | can often help determine where the stall is occurring, which will usually | 98 | To diagnose the cause of the stall, inspect the stack traces. |
| 55 | be in the function nearest the top of the stack that stays the same from | 99 | The offending function will usually be near the top of the stack. |
| 56 | trace to trace. | 100 | If you have a series of stall warnings from a single extended stall, |
| 101 | comparing the stack traces can often help determine where the stall | ||
| 102 | is occurring, which will usually be in the function nearest the top of | ||
| 103 | that portion of the stack which remains the same from trace to trace. | ||
| 104 | If you can reliably trigger the stall, ftrace can be quite helpful. | ||
| 57 | 105 | ||
| 58 | RCU bugs can often be debugged with the help of CONFIG_RCU_TRACE. | 106 | RCU bugs can often be debugged with the help of CONFIG_RCU_TRACE. |
diff --git a/Documentation/RCU/trace.txt b/Documentation/RCU/trace.txt index 8608fd85e921..efd8cc95c06b 100644 --- a/Documentation/RCU/trace.txt +++ b/Documentation/RCU/trace.txt | |||
| @@ -256,23 +256,23 @@ o Each element of the form "1/1 0:127 ^0" represents one struct | |||
| 256 | The output of "cat rcu/rcu_pending" looks as follows: | 256 | The output of "cat rcu/rcu_pending" looks as follows: |
| 257 | 257 | ||
| 258 | rcu_sched: | 258 | rcu_sched: |
| 259 | 0 np=255892 qsp=53936 cbr=0 cng=14417 gpc=10033 gps=24320 nf=6445 nn=146741 | 259 | 0 np=255892 qsp=53936 rpq=85 cbr=0 cng=14417 gpc=10033 gps=24320 nf=6445 nn=146741 |
| 260 | 1 np=261224 qsp=54638 cbr=0 cng=25723 gpc=16310 gps=2849 nf=5912 nn=155792 | 260 | 1 np=261224 qsp=54638 rpq=33 cbr=0 cng=25723 gpc=16310 gps=2849 nf=5912 nn=155792 |
| 261 | 2 np=237496 qsp=49664 cbr=0 cng=2762 gpc=45478 gps=1762 nf=1201 nn=136629 | 261 | 2 np=237496 qsp=49664 rpq=23 cbr=0 cng=2762 gpc=45478 gps=1762 nf=1201 nn=136629 |
| 262 | 3 np=236249 qsp=48766 cbr=0 cng=286 gpc=48049 gps=1218 nf=207 nn=137723 | 262 | 3 np=236249 qsp=48766 rpq=98 cbr=0 cng=286 gpc=48049 gps=1218 nf=207 nn=137723 |
| 263 | 4 np=221310 qsp=46850 cbr=0 cng=26 gpc=43161 gps=4634 nf=3529 nn=123110 | 263 | 4 np=221310 qsp=46850 rpq=7 cbr=0 cng=26 gpc=43161 gps=4634 nf=3529 nn=123110 |
| 264 | 5 np=237332 qsp=48449 cbr=0 cng=54 gpc=47920 gps=3252 nf=201 nn=137456 | 264 | 5 np=237332 qsp=48449 rpq=9 cbr=0 cng=54 gpc=47920 gps=3252 nf=201 nn=137456 |
| 265 | 6 np=219995 qsp=46718 cbr=0 cng=50 gpc=42098 gps=6093 nf=4202 nn=120834 | 265 | 6 np=219995 qsp=46718 rpq=12 cbr=0 cng=50 gpc=42098 gps=6093 nf=4202 nn=120834 |
| 266 | 7 np=249893 qsp=49390 cbr=0 cng=72 gpc=38400 gps=17102 nf=41 nn=144888 | 266 | 7 np=249893 qsp=49390 rpq=42 cbr=0 cng=72 gpc=38400 gps=17102 nf=41 nn=144888 |
