• Petr Mladek's avatar
    watchdog/softlockup: report the overall time of softlockups · fef06efc
    Petr Mladek authored
    The softlockup detector currently shows the time spent since the last
    report.  As a result it is not clear whether a CPU is infinitely hogged by
    a single task or if it is a repeated event.
    
    The situation can be simulated with a simply busy loop:
    
    	while (true)
    	      cpu_relax();
    
    The softlockup detector produces:
    
    [  168.277520] watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [cat:4865]
    [  196.277604] watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [cat:4865]
    [  236.277522] watchdog: BUG: soft lockup - CPU#1 stuck for 23s! [cat:4865]
    
    But it should be, something like:
    
    [  480.372418] watchdog: BUG: soft lockup - CPU#2 stuck for 26s! [cat:4943]
    [  508.372359] watchdog: BUG: soft lockup - CPU#2 stuck for 52s! [cat:4943]
    [  548.372359] watchdog: BUG: soft lockup - CPU#2 stuck for 89s! [cat:4943]
    [  576.372351] watchdog: BUG: soft lockup - CPU#2 stuck for 115s! [cat:4943]
    
    For the better output, add an additional timestamp of the last report.
    Only this timestamp is reset when the watchdog is intentionally touched
    from slow code paths or when printing the report.
    
    Link: https://lkml.kernel.org/r/20210311122130.6788-4-pmladek@suse.comSigned-off-by: default avatarPetr Mladek <pmladek@suse.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Laurence Oberman <loberman@redhat.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    fef06efc
watchdog.c 20.8 KB