public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Xi Wang <xii@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Josh Don <joshdon@google.com>,
	linux-kernel@vger.kernel.org, Paul Turner <pjt@google.com>
Subject: Re: [PATCH v2 1/1] sched: watchdog: Touch kernel watchdog with sched count
Date: Wed, 21 Oct 2020 12:12:57 +0200	[thread overview]
Message-ID: <20201021101257.GC2628@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201020205704.1741543-2-xii@google.com>

On Tue, Oct 20, 2020 at 01:57:04PM -0700, Xi Wang wrote:

> +	if (watchdog_touch_with_sched) {
> +		/* Trigger reschedule for the next round */
> +		set_tsk_need_resched(current);
> +		set_preempt_need_resched();

Blergh.. that's gross. This relies on this being in IRQ context and
either: PREEMPT=y *OR* this always being from userspace. Otherwise
there's no guarantee the return-from-interrupt will actually schedule.

> +		/* sched_count increase in __schedule is taken as watchdog touched */
> +		if (sched_get_count(smp_processor_id()) -
> +		    __this_cpu_read(watchdog_sched_prev)) {
> +			__touch_watchdog();
> +			__this_cpu_write(soft_watchdog_warn, false);
> +			return HRTIMER_RESTART;
> +		}
> +	}
> +
>  	/* check for a softlockup
>  	 * This is done by making sure a high priority task is
>  	 * being scheduled.  The task touches the watchdog to
> -- 
> 2.29.0.rc1.297.gfa9743e501-goog
> 

  parent reply	other threads:[~2020-10-21 10:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 20:57 [PATCH v2 0/1] Touch kernel watchdog with sched count Xi Wang
2020-10-20 20:57 ` [PATCH v2 1/1] sched: watchdog: " Xi Wang
2020-10-21  9:59   ` Peter Zijlstra
2020-10-21 10:12   ` Peter Zijlstra [this message]
2020-10-21 10:24     ` Peter Zijlstra
2020-10-21 11:11       ` Peter Zijlstra
2020-10-21 23:48     ` Xi Wang

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=20201021101257.GC2628@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pjt@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=xii@google.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