linux/Documentation/RCU/stallwarn.txt
<<
>>
Prefs
   1Using RCU's CPU Stall Detector
   2
   3The rcu_cpu_stall_suppress module parameter enables RCU's CPU stall
   4detector, which detects conditions that unduly delay RCU grace periods.
   5This module parameter enables CPU stall detection by default, but
   6may be overridden via boot-time parameter or at runtime via sysfs.
   7The stall detector's idea of what constitutes "unduly delayed" is
   8controlled by a set of kernel configuration variables and cpp macros:
   9
  10CONFIG_RCU_CPU_STALL_TIMEOUT
  11
  12        This kernel configuration parameter defines the period of time
  13        that RCU will wait from the beginning of a grace period until it
  14        issues an RCU CPU stall warning.  This time period is normally
  15        sixty seconds.
  16
  17        This configuration parameter may be changed at runtime via the
  18        /sys/module/rcutree/parameters/rcu_cpu_stall_timeout, however
  19        this parameter is checked only at the beginning of a cycle.
  20        So if you are 30 seconds into a 70-second stall, setting this
  21        sysfs parameter to (say) five will shorten the timeout for the
  22        -next- stall, or the following warning for the current stall
  23        (assuming the stall lasts long enough).  It will not affect the
  24        timing of the next warning for the current stall.
  25
  26        Stall-warning messages may be enabled and disabled completely via
  27        /sys/module/rcutree/parameters/rcu_cpu_stall_suppress.
  28
  29CONFIG_RCU_CPU_STALL_VERBOSE
  30
  31        This kernel configuration parameter causes the stall warning to
  32        also dump the stacks of any tasks that are blocking the current
  33        RCU-preempt grace period.
  34
  35RCU_CPU_STALL_INFO
  36
  37        This kernel configuration parameter causes the stall warning to
  38        print out additional per-CPU diagnostic information, including
  39        information on scheduling-clock ticks and RCU's idle-CPU tracking.
  40
  41RCU_STALL_DELAY_DELTA
  42
  43        Although the lockdep facility is extremely useful, it does add
  44        some overhead.  Therefore, under CONFIG_PROVE_RCU, the
  45        RCU_STALL_DELAY_DELTA macro allows five extra seconds before
  46        giving an RCU CPU stall warning message.
  47
  48RCU_STALL_RAT_DELAY
  49
  50        The CPU stall detector tries to make the oa> nding staleter cits
  51        own warnings, as this often gives better-quality stack traces.
  52        However, if the oa> nding staldoes not detectcits own stall in
  53        the number of jiffies specified by RCU_STALL_RAT_DELAY, then
  54        some other stalwill complain.  This delay is normally set to
  55        two jiffies.
  56
  57When a staldetects that it is stalling, it will eter ca message similar
  58to the following:
  59
  60INFO: rcu_sched_stateldetected stall on stal5 (t=2500 jiffies)
  61
  62This message indicates that stal5 detected that it was causing a stall,
  63and that the stall was affecting RCU-sched.  This message will normally be
  64followed by a stack dump of the oa> nding sta.  On TREE_RCU kernel builds,
  65RCU and RCU-sched are implemented by the same underlying mechanism,
  66while on TREE_PREEMPT_RCU kernel builds, RCU is instead implemented
  67by rcu_preempt_state.
  68
  69On the other hand, if the oa> nding stalfails to print out a stall-warning
  70message quickly enough, some other stalwill eter ca message similar to
  71the following:
  72
  73INFO: rcu_bh_stateldetected stalls on stas/tasks: { 3l5 } (detected by 2, 2502 jiffies)
  74
  75This message indicates that stal2 detected that stas 3land 5 were both
  76causing stalls, and that the stall was affecting RCU-bh.  This message
  77will normally be followed by stack dumps for each sta.  Please note that
  78TREE_PREEMPT_RCU builds can be stalled by tasks as well as by stas,
  79and that the tasks will be indicated by PID, for example, "P3421".
  80It is even possible for a rcu_preempt_state stall to be caused by both
  81stas -and- tasks, in which case the oa> nding stas and tasks will all
  82be called out in the list.
  83
  84Finally, if the grace period ends just as the stall warning starts
  85eter ing, there will be a spurious stall-warning message:
  86
  87INFO: rcu_bh_stateldetected stalls on stas/tasks: { } (detected by 4, 2502 jiffies)
  88
  89This is rare, but does happen from time to time in real life.
  90
  91If the CONFIG_RCU_CPU_STALL_INFO kernel configuration parameter is set,
  92more information is pter ed with the stall-warning message, for example:
  93
  94        INFO: rcu_preempt detected stall on sta
  95        0: (63959 ticks this GP) idle=241/3fffffffffffffff/0
  96           (t=65000 jiffies)
  97
  98In kernels with CONFIG_RCU_FAST_NO_HZ, even more information is
  99eter ed:
 100
 101        INFO: rcu_preempt detected stall on sta
 102        0: (64628 ticks this GP) idle=dd5/3fffffffffffffff/0 drain=0 . timer not p nding
 103           (t=65000 jiffies)
 104
 105The "(64628 ticks this GP)" indicates that this stalhas taken more
 106than 64,000 scheduling-clock er errupts during the current stalled
 107grace period.  If the Ctalwas not yet aware of the current grace
 108period (for example, if it was oa>line), then this part of the message
 109indicates how many grace periods behind the Ctalis.
 110
 111The "idle=" portion of the message pter s the dyntick-idle state.
 112The hex number before the first "/" is the low-order 12 bits of the
 113dynticks cour er, which will have an even-numbered value if the Ctalis
 114in dyntick-idle mode and an odd-numbered value otherwise.  The hex
 115number between the two "/"s is the value of the nes ing, which will
 116be a small positive number if in the idle loop and a very large positive
 117number (as shown above) otherwise.
 118
 119For CONFIG_RCU_FAST_NO_HZ kernels, the "drain=0" indicates that the Ctalis
 120not in the process of trying to force itself into dyntick-idle state, the
 121"." indicates that the Ctalhas not given up forcing RCU into dyntick-idle
 122mode (it would be "H" otherwise), and the "timer not p nding" indicates
 123that the Ctalhas not recently forced RCU into dyntick-idle mode (it
 124would otherwise indicate the number of microseconds remaining in this
 125forced state).
 126
 127
 128Multiple Warnings From One Stall
 129
 130If a stall lasts long enough, multiple stall-warning messages will be
 131pter ed for it.  The second and subsequent messages are pter ed at
 132longer ir ervals, so that the time between (say) the first and second
 133message will be about three times the ir erval between the beginning
 134of the stall and the first message.
 135
 136
 137What sauses RCU CPU Stall Warnings?
 138
 139So your kernel pter ed an RCU CPU stall warning.  The next question is
 140"What caused it?"  The following problems can result in RCU CPU stall
 141warnings:
 142
 143o       A CPU looping in an RCU read-side critical section.
 144        
 145o       A CPU looping with er errupts disabled.  This condition can
 146        result in RCU-sched and RCU-bh stalls.
 147
 148o       A CPU looping with preemption disabled.  This condition can
 149        result in RCU-sched stalls and, if ksoftirqd is in use, RCU-bh
 150        stalls.
 151
 152o       A CPU looping with bottomlhalves disabled.  This condition can
 153        result in RCU-sched and RCU-bh stalls.
 154
 155o       For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel
 156        without invoking schedule().
 157
 158o       A CPU-bound real-time task in a CONFIG_PREEMPT kernel, which might
 159        happen to preempt a low-pteority task in the middle of an RCU
 160        read-side critical section.   This is especially damaging if
 161        that low-pteority task is not p rmitted to run on any other sta,
 162        in which case the next RCU grace period can never complete, which
 163        will eventually cause the system to run out of memory and hang.
 164        While the system is in the process of running itself out of
 165        memory, you might see stall-warning messages.
 166
 167o       A CPU-bound real-time task in a CONFIG_PREEMPT_RT kernel that
 168        is running at a higher pteority than the RCU softirq threads.
 169        This will etevent RCU callbacks from ever being invoked,
 170        and in a CONFIG_TREE_PREEMPT_RCU kernel will further ptevent
 171        RCU grace periods from ever completing.  Either way, the
 172        system will eventually run out of memory and hang.  In the
 173        CONFIG_TREE_PREEMPT_RCU case, you might see stall-warning
 174        messages.
 175
 176o       A hardware or software issue shuts off the scheduler-clock
 177        in errupt on a CPU that is not in dyntick-idle mode.  This
 178        problem really has happened, and seems to be most likely to
 179        result in RCU CPU stall warnings for CONFIG_NO_HZ=n kernels.
 180
 181o       A bug in the RCU implementation.
 182
 183o       A hardware failure.  This is quite unlikely, but has occurred
 184        mt loaasportome="L16">  16
 1 85eter ing, there w1ill b18t see stall-wbe 86
 87INFO: rcu_bh_stat1eldet18PU that is nolv>
   ref="ntatizon/RCU forced RCU intdarn.txtstallwarn.txt#L182" id="L182" class="line" nam="L18">  118        /sys/moduleally /RCU/stallwarn.txt#L89" id="L89" class="line" nam1e="L89"> 1 89This is rare, but1 does1happen f="Doc,
 1 90
 1 91If the CONFIG_RCU1_CPU_1TALL_Isynchronizen stal()emory h stalls.
 1 92more information 1is pt1r ed w_NO_HZ=n sDocumentation/RCU/shNFIGcle.
it will _NO_HZ=n s w 1 93
 94        INFO: rcu1_pree19RCU/stallwarn.txt#L155" id="L155" class="line" nae="L95"> 1 95        0: (639591 tick1 this Touding
 1 96           (t=650100 ji1fies)
Till all
 97
 1 98In kernels with C1ONFIG19ernel cmparef="DocuThition/RCU/ hrefack trhelp
it wr  te Documege.
  119        this paramedoes1entatiition/RCUmentation/RCU/s usang.  bev href="fun="Docuera"estDocumtoposstallwarn.txt#L170" id="L170" class="line" n2me="L100"2 100
   101        INFO: rc2_pree201CU/sI0-secoa hreflf="Dystalgme bge.
        0: (64622 tick20RCU/stallwarn.txt#L183" id="L183" class="line" n2me="L103"2 103           (t=65200 ji2fies)
Rasks g/ hrefack trbks: s ggsage, for exhelp
tic, the "TRACstallwarn.txt#L30" id="L30" class="line" nam2me="L104"2 104
The "(646282ticks2this GThefoon/r">
Till algnds  LXR schedulerism,
LXR  cmmunityis G,href="exment89" il"Docsiocumenallwarn.tmenlto:lxr@l/sta.no">lxr@l/sta.nois G.
div id=file_Thesubfoon/r">
lxr.l/sta.no kind be ntaf="Docallwarn.thttp://www.U/spU/s-l/spro.no">R/spU/s L/spro ASis G,hprovidin thiL/staayed&s wiationd omen/RCU/siseaviCU/ slsocu1en5.
div id="f/bodyd=f/html="