linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Laurence Oberman <loberman@redhat.com>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>,
	Michal Hocko <mhocko@suse.com>,
	linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>
Subject: [PATCH v2 2/7] watchdog: Explicitly update timestamp when reporting softlockup
Date: Thu, 10 Dec 2020 17:00:33 +0100	[thread overview]
Message-ID: <20201210160038.31441-3-pmladek@suse.com> (raw)
In-Reply-To: <20201210160038.31441-1-pmladek@suse.com>

The softlockup situation might stay for a long time or even forever.
When it happens, the softlockup debug messages are printed in regular
intervals defined by get_softlockup_thresh().

There is a mystery. The repeated message is printed after the full interval
that is defined by get_softlockup_thresh(). But the timer callback is called
more often as defined by sample_period. The code looks like the soflockup
should get reported in every sample_period when it was once behind the thresh.

It works only by chance. The watchdog is touched when printing the stall
report, for example, in printk_stack_address().

Make the behavior clear and predictable by explicitly updating
the timestamp in watchdog_timer_fn() when the report gets printed.

Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 kernel/watchdog.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index c58244064de8..7776d53a015c 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -409,6 +409,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
 			}
 		}
 
+		/* Start period for the next softlockup warning. */
+		update_touch_ts();
+
 		pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n",
 			smp_processor_id(), duration,
 			current->comm, task_pid_nr(current));
-- 
2.26.2


  parent reply	other threads:[~2020-12-10 16:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 16:00 [PATCH v2 0/7] watchdog/softlockup: Report overall time and some cleanup Petr Mladek
2020-12-10 16:00 ` [PATCH v2 1/7] watchdog: Rename __touch_watchdog() to a better descriptive name Petr Mladek
2020-12-10 16:00 ` Petr Mladek [this message]
2020-12-10 16:00 ` [PATCH v2 3/7] watchdog/softlockup: Report the overall time of softlockups Petr Mladek
2020-12-10 16:00 ` [PATCH v2 4/7] watchdog/softlockup: Remove logic that tried to prevent repeated reports Petr Mladek
2020-12-10 16:00 ` [PATCH v2 5/7] watchdog: Fix barriers when printing backtraces from all CPUs Petr Mladek
2020-12-10 16:00 ` [PATCH v2 6/7] watchdog: Cleanup handling of false positives Petr Mladek
2020-12-10 16:00 ` [PATCH v2 7/7] Test softlockup Petr Mladek
2021-01-03 15:03   ` 3cc3ef45b2: RIP:version_proc_show kernel test robot
2021-01-05  9:37     ` Petr Mladek
2021-03-11 12:21 [PATCH v2 0/7] watchdog/softlockup: Report overall time and some cleanup Petr Mladek
2021-03-11 12:21 ` [PATCH v2 2/7] watchdog: Explicitly update timestamp when reporting softlockup Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210160038.31441-3-pmladek@suse.com \
    --to=pmladek@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.whitchurch@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).