All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	stable@vger.kernel.org
Subject: Re: [RFC PATCH 6/8] sched: Report local wake up on resched blind zone within idle loop
Date: Mon, 11 Jan 2021 13:56:55 +0100	[thread overview]
Message-ID: <20210111125655.GF242508@lothringen> (raw)
In-Reply-To: <X/xD1/yjYXi28XXs@hirez.programming.kicks-ass.net>

On Mon, Jan 11, 2021 at 01:25:59PM +0100, Peter Zijlstra wrote:
> On Sat, Jan 09, 2021 at 03:05:34AM +0100, Frederic Weisbecker wrote:
> > The idle loop has several need_resched() checks that make sure we don't
> > miss a rescheduling request. This means that any wake up performed on
> > the local runqueue after the last generic need_resched() check is going
> > to have its rescheduling silently ignored. This has happened in the
> > past with rcu kthreads awaken from rcu_idle_enter() for example.
> > 
> > Perform sanity checks to report these situations.
> 
> I really don't like this..
> 
>  - it's too specific to the actual reschedule condition, any wakeup this
>    late is dodgy, not only those that happen to cause a local
>    reschedule.

Right.

> 
>  - we can already test this with unwind and checking against __cpuidle
> 
>  - moving all of __cpuidle into noinstr would also cover this. And we're
>    going to have to do that anyway.

Ok then, I'll wait for that instead.

> 
> > +void noinstr sched_resched_local_assert_allowed(void)
> > +{
> > +	if (this_rq()->resched_local_allow)
> > +		return;
> > +
> 
> > +	/*
> > +	 * Idle interrupts break the CPU from its pause and
> > +	 * rescheduling happens on idle loop exit.
> > +	 */
> > +	if (in_hardirq())
> > +		return;
> > +
> > +	/*
> > +	 * What applies to hardirq also applies to softirq as
> > +	 * we assume they execute on hardirq tail. Ksoftirqd
> > +	 * shouldn't have resched_local_allow == 0.
> > +	 * We also assume that no local_bh_enable() call may
> > +	 * execute softirqs inline on fragile idle/entry
> > +	 * path...
> > +	 */
> > +	if (in_serving_softirq())
> > +		return;
> > +
> > +	WARN_ONCE(1, "Late current task rescheduling may be lost\n");
> 
> That seems like it wants to be:
> 
> 	WARN_ONCE(in_task(), "...");

Right! But I guess I'll drop that patch now.

Thanks.

  reply	other threads:[~2021-01-11 12:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09  2:05 [RFC PATCH 0/8] rcu/sched: Fix ignored rescheduling after rcu_eqs_enter() v3 Frederic Weisbecker
2021-01-09  2:05 ` [RFC PATCH 1/8] rcu: Remove superfluous rdp fetch Frederic Weisbecker
2021-01-09  9:03   ` Greg KH
2021-01-10 10:59     ` Frederic Weisbecker
2021-01-09  2:05 ` [RFC PATCH 2/8] rcu: Pull deferred rcuog wake up to rcu_eqs_enter() callers Frederic Weisbecker
2021-01-09  2:05 ` [RFC PATCH 3/8] rcu/nocb: Perform deferred wake up before last idle's need_resched() check Frederic Weisbecker
2021-01-09  2:05 ` [RFC PATCH 4/8] rcu/nocb: Trigger self-IPI on late deferred wake up before user resume Frederic Weisbecker
2021-01-11 12:04   ` Peter Zijlstra
2021-01-11 12:35     ` Frederic Weisbecker
2021-01-09  2:05 ` [RFC PATCH 5/8] entry: Explicitly flush pending rcuog wakeup before last rescheduling points Frederic Weisbecker
2021-01-11  0:40   ` Frederic Weisbecker
2021-01-11  5:13     ` Paul E. McKenney
2021-01-11 11:50       ` Frederic Weisbecker
2021-01-11 12:08   ` Peter Zijlstra
2021-01-11 12:54     ` Frederic Weisbecker
2021-01-09  2:05 ` [RFC PATCH 6/8] sched: Report local wake up on resched blind zone within idle loop Frederic Weisbecker
2021-01-11 12:25   ` Peter Zijlstra
2021-01-11 12:56     ` Frederic Weisbecker [this message]
2021-01-12  8:24   ` [sched] 9720a64438: WARNING:at_kernel/sched/core.c:#sched_resched_local_assert_allowed kernel test robot
2021-01-12  8:24     ` kernel test robot
     [not found]   ` <161062476680.19482.8402362019173198799@build.alporthouse.com>
2021-01-14 15:19     ` [RFC PATCH 6/8] sched: Report local wake up on resched blind zone within idle loop Paul E. McKenney
2021-01-09  2:05 ` [RFC PATCH 7/8] entry: Report local wake up on resched blind zone while resuming to user Frederic Weisbecker
2021-01-13  2:46   ` [entry] 8e01c5f104: unixbench.score -2.2% regression kernel test robot
2021-01-13  2:46     ` kernel test robot
2021-01-09  2:05 ` [RFC PATCH 8/8] timer: Report ignored local enqueue in nohz mode Frederic Weisbecker

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=20210111125655.GF242508@lothringen \
    --to=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.