public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Petr Mladek <pmladek@suse.com>, 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: Re: [PATCH 2/3] watchdog/softlockup: Report the overall time of softlockups
Date: Thu, 16 Jan 2020 14:39:31 +0100	[thread overview]
Message-ID: <8736cfwmek.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20191024114928.15377-3-pmladek@suse.com>

Petr,

Petr Mladek <pmladek@suse.com> writes:
> -	if (touch_ts == 0) {
> +	/* Was the watchdog touched externally by a known slow code? */
> +	if (period_ts == 0) {
>  		if (unlikely(__this_cpu_read(softlockup_touch_sync))) {
>  			/*
>  			 * If the time stamp was touched atomically
> @@ -394,7 +405,12 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
>  
>  		/* Clear the guest paused flag on watchdog reset */
>  		kvm_check_and_clear_guest_paused();
> -		__touch_watchdog();
> +		/*
> +		 * The above kvm*() function could touch the watchdog.
> +		 * Set the real timestamp later to avoid an infinite
>  		loop.

This comment makes no sense whatsoever. If period_ts is 0,
i.e. something invoked touch_softlockup_watchdog*() then it does not
make any difference whether the kvm function invokes one of those
functions once more. The result is the same. The per cpu period_ts is
still 0.

The point is that _AFTER_ a intentional watchdog reset, the reporting
base time needs to be set to now() in order to make it functional again.

> +		 */
> +		reset_report_period_ts();

Btw, the function name is misleading. I got confused several times
because I expected the reset to set the timestamp to 0, which is not the
case. update_report_period_ts() is far more intuitive.

> @@ -404,8 +420,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
>  	 * indicate it is getting cpu time.  If it hasn't then
>  	 * this is a good indication some task is hogging the cpu
>  	 */
> -	duration = is_softlockup(touch_ts);
> +	duration = is_softlockup(touch_ts, period_ts);
>  	if (unlikely(duration)) {

This lacks a comment. Your changelog paragraph:

 > Also the timestamp should get reset explicitly. It is done also by the code
 > printing the backtrace. But it is just a side effect and far from
 > obvious.

is probably referring to this, but it confused me more than it helped
simply because the update of the timestamp happens unconditionally even
when the backtrace code is not reached due to the KVM check

So this is a change vs. the current implementation which is not
documented and explained.

> +		reset_report_period_ts();
>  		/*
>  		 * If a virtual machine is stopped by the host it can look to
>  		 * the watchdog like a soft lockup, check to see if the host

Thanks,

        tglx

  reply	other threads:[~2020-01-16 13:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 11:49 [PATCH 0/3] watchdog/softlockup: Report overall time and some cleanup Petr Mladek
2019-10-24 11:49 ` [PATCH 1/3] watchdog/softlockup: Remove obsolete check of last reported task Petr Mladek
2020-01-16 13:55   ` [tip: core/core] " tip-bot2 for Petr Mladek
2019-10-24 11:49 ` [PATCH 2/3] watchdog/softlockup: Report the overall time of softlockups Petr Mladek
2020-01-16 13:39   ` Thomas Gleixner [this message]
2020-01-17 10:00     ` Petr Mladek
2019-10-24 11:49 ` [PATCH 3/3] watchdog/softlockup: Remove logic that tried to prevent repeated reports Petr Mladek
2019-11-08 10:13 ` [PATCH 0/3] watchdog/softlockup: Report overall time and some cleanup 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=8736cfwmek.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --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