Blame view
Documentation/RCU/stallwarn.txt
5.81 KB
4c54005ca rcu: 1Q2010 updat... |
1 |
Using RCU's CPU Stall Detector |
a00e0d714 rcu: Remove condi... |
2 3 4 5 6 7 |
The rcu_cpu_stall_suppress module parameter enables RCU's CPU stall detector, which detects conditions that unduly delay RCU grace periods. This module parameter enables CPU stall detection by default, but may be overridden via boot-time parameter or at runtime via sysfs. The stall detector's idea of what constitutes "unduly delayed" is controlled by a set of kernel configuration variables and cpp macros: |
4c54005ca rcu: 1Q2010 updat... |
8 |
|
a00e0d714 rcu: Remove condi... |
9 |
CONFIG_RCU_CPU_STALL_TIMEOUT |
4c54005ca rcu: 1Q2010 updat... |
10 |
|
a00e0d714 rcu: Remove condi... |
11 12 13 14 |
This kernel configuration parameter defines the period of time that RCU will wait from the beginning of a grace period until it issues an RCU CPU stall warning. This time period is normally ten seconds. |
4c54005ca rcu: 1Q2010 updat... |
15 16 17 18 |
RCU_SECONDS_TILL_STALL_RECHECK This macro defines the period of time that RCU will wait after |
f1d507bee rcu: improve the ... |
19 |
issuing a stall warning until it issues another stall warning |
a00e0d714 rcu: Remove condi... |
20 21 |
for the same stall. This time period is normally set to three times the check interval plus thirty seconds. |
4c54005ca rcu: 1Q2010 updat... |
22 23 |
RCU_STALL_RAT_DELAY |
f1d507bee rcu: improve the ... |
24 25 26 27 28 29 |
The CPU stall detector tries to make the offending CPU print its own warnings, as this often gives better-quality stack traces. However, if the offending CPU does not detect its own stall in the number of jiffies specified by RCU_STALL_RAT_DELAY, then some other CPU will complain. This delay is normally set to two jiffies. |
4c54005ca rcu: 1Q2010 updat... |
30 |
|
f1d507bee rcu: improve the ... |
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
When a CPU detects that it is stalling, it will print a message similar to the following: INFO: rcu_sched_state detected stall on CPU 5 (t=2500 jiffies) This message indicates that CPU 5 detected that it was causing a stall, and that the stall was affecting RCU-sched. This message will normally be followed by a stack dump of the offending CPU. On TREE_RCU kernel builds, RCU and RCU-sched are implemented by the same underlying mechanism, while on TREE_PREEMPT_RCU kernel builds, RCU is instead implemented by rcu_preempt_state. On the other hand, if the offending CPU fails to print out a stall-warning message quickly enough, some other CPU will print a message similar to the following: INFO: rcu_bh_state detected stalls on CPUs/tasks: { 3 5 } (detected by 2, 2502 jiffies) This message indicates that CPU 2 detected that CPUs 3 and 5 were both causing stalls, and that the stall was affecting RCU-bh. This message will normally be followed by stack dumps for each CPU. Please note that TREE_PREEMPT_RCU builds can be stalled by tasks as well as by CPUs, and that the tasks will be indicated by PID, for example, "P3421". It is even possible for a rcu_preempt_state stall to be caused by both CPUs -and- tasks, in which case the offending CPUs and tasks will all be called out in the list. Finally, if the grace period ends just as the stall warning starts printing, there will be a spurious stall-warning message: INFO: rcu_bh_state detected stalls on CPUs/tasks: { } (detected by 4, 2502 jiffies) This is rare, but does happen from time to time in real life. So your kernel printed an RCU CPU stall warning. The next question is "What caused it?" The following problems can result in RCU CPU stall warnings: |
4c54005ca rcu: 1Q2010 updat... |
68 69 70 |
o A CPU looping in an RCU read-side critical section. |
f1d507bee rcu: improve the ... |
71 72 |
o A CPU looping with interrupts disabled. This condition can result in RCU-sched and RCU-bh stalls. |
4c54005ca rcu: 1Q2010 updat... |
73 |
|
f1d507bee rcu: improve the ... |
74 75 76 77 78 79 |
o A CPU looping with preemption disabled. This condition can result in RCU-sched stalls and, if ksoftirqd is in use, RCU-bh stalls. o A CPU looping with bottom halves disabled. This condition can result in RCU-sched and RCU-bh stalls. |
4c54005ca rcu: 1Q2010 updat... |
80 81 82 |
o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel without invoking schedule(). |
2c96c7751 rcu: upgrade stal... |
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
o A CPU-bound real-time task in a CONFIG_PREEMPT kernel, which might happen to preempt a low-priority task in the middle of an RCU read-side critical section. This is especially damaging if that low-priority task is not permitted to run on any other CPU, in which case the next RCU grace period can never complete, which will eventually cause the system to run out of memory and hang. While the system is in the process of running itself out of memory, you might see stall-warning messages. o A CPU-bound real-time task in a CONFIG_PREEMPT_RT kernel that is running at a higher priority than the RCU softirq threads. This will prevent RCU callbacks from ever being invoked, and in a CONFIG_TREE_PREEMPT_RCU kernel will further prevent RCU grace periods from ever completing. Either way, the system will eventually run out of memory and hang. In the CONFIG_TREE_PREEMPT_RCU case, you might see stall-warning messages. |
2c01531f0 rcu: Document fai... |
100 101 102 103 |
o A hardware or software issue shuts off the scheduler-clock interrupt on a CPU that is not in dyntick-idle mode. This problem really has happened, and seems to be most likely to result in RCU CPU stall warnings for CONFIG_NO_HZ=n kernels. |
4c54005ca rcu: 1Q2010 updat... |
104 105 106 |
o A bug in the RCU implementation. o A hardware failure. This is quite unlikely, but has occurred |
f1d507bee rcu: improve the ... |
107 |
at least once in real life. A CPU failed in a running system, |
4c54005ca rcu: 1Q2010 updat... |
108 109 110 |
becoming unresponsive, but not causing an immediate crash. This resulted in a series of RCU CPU stall warnings, eventually leading the realization that the CPU had failed. |
9ceae0e24 rcu: Add document... |
111 112 113 114 115 |
The RCU, RCU-sched, and RCU-bh implementations have CPU stall warning. SRCU does not have its own CPU stall warnings, but its calls to synchronize_sched() will result in RCU-sched detecting RCU-sched-related CPU stalls. Please note that RCU only detects CPU stalls when there is a grace period in progress. No grace period, no CPU stall warnings. |
f1d507bee rcu: improve the ... |
116 117 118 119 120 121 122 123 |
To diagnose the cause of the stall, inspect the stack traces. The offending function will usually be near the top of the stack. If you have a series of stall warnings from a single extended stall, comparing the stack traces can often help determine where the stall is occurring, which will usually be in the function nearest the top of that portion of the stack which remains the same from trace to trace. If you can reliably trigger the stall, ftrace can be quite helpful. |
4c54005ca rcu: 1Q2010 updat... |
124 125 |
RCU bugs can often be debugged with the help of CONFIG_RCU_TRACE. |