[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X/xD1/yjYXi28XXs@hirez.programming.kicks-ass.net>
Date:   Mon, 11 Jan 2021 13:25:59 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     "Paul E . McKenney" <paulmck@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>, stable@...r.kernel.org
Subject: Re: [RFC PATCH 6/8] sched: Report local wake up on resched blind
 zone within idle loop
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.
 - 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.
> +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(), "...");
> +}
Powered by blists - more mailing lists
 
