• Zhen Lei's avatar
    rcu: Add RCU stall diagnosis information · be42f00b
    Zhen Lei authored
    Because RCU CPU stall warnings are driven from the scheduling-clock
    interrupt handler, a workload consisting of a very large number of
    short-duration hardware interrupts can result in misleading stall-warning
    messages.  On systems supporting only a single level of interrupts,
    that is, where interrupts handlers cannot be interrupted, this can
    produce misleading diagnostics.  The stack traces will show the
    innocent-bystander interrupted task, not the interrupts that are
    at the very least exacerbating the stall.
    
    This situation can be improved by displaying the number of interrupts
    and the CPU time that they have consumed.  Diagnosing other types
    of stalls can be eased by also providing the count of softirqs and
    the CPU time that they consumed as well as the number of context
    switches and the task-level CPU time consumed.
    
    Consider the following output given this change:
    
    rcu: INFO: rcu_preempt self-detected stall on CPU
    rcu:     0-....: (1250 ticks this GP) <omitted>
    rcu:          hardirqs   softirqs   csw/system
    rcu:  number:      624         45            0
    rcu: cputime:       69          1         2425   ==> 2500(ms)
    
    This output shows that the number of hard and soft interrupts is small,
    there are no context switches, and the system takes up a lot of time. This
    indicates that the current task is looping with preemption disabled.
    
    The impact on system performance is negligible because snapshot is
    recorded only once for all continuous RCU stalls.
    
    This added debugging information is suppressed by default and can be
    enabled by building the kernel with CONFIG_RCU_CPU_STALL_CPUTIME=y or
    by booting with rcupdate.rcu_cpu_stall_cputime=1.
    Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
    Reviewed-by: default avatarMukesh Ojha <quic_mojha@quicinc.com>
    Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    be42f00b
tree.h 21 KB