From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Phil Auld <pauld@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH 3/5] sched: Detect call to schedule from critical entry code
Date: Mon, 5 Oct 2020 13:23:53 +0200 [thread overview]
Message-ID: <20201005112353.GI2628@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201005104919.5250-4-frederic@kernel.org>
On Mon, Oct 05, 2020 at 12:49:17PM +0200, Frederic Weisbecker wrote:
> Detect calls to schedule() between user_enter() and user_exit(). Those
> are symptoms of early entry code that either forgot to protect a call
> to schedule() inside exception_enter()/exception_exit() or, in the case
> of HAVE_CONTEXT_TRACKING_OFFSTACK, enabled interrupts or preemption in
> a wrong spot.
>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> Cc: Paul E. McKenney <paulmck@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Phil Auld <pauld@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> ---
> kernel/sched/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 2d95dc3f4644..d31a79e073e3 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4295,6 +4295,7 @@ static inline void schedule_debug(struct task_struct *prev, bool preempt)
> preempt_count_set(PREEMPT_DISABLED);
> }
> rcu_sleep_check();
> + WARN_ON_ONCE(ct_state() == CONTEXT_USER);
SCHED_WARN_ON() ?
No point in unconditionally polluting that path. Although, per MeL, we
should probably invest in CONFIG_SCHED_DEBUG_I_MEANS_IT :/
next prev parent reply other threads:[~2020-10-05 11:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 10:49 [PATCH 0/5] context_tracking: Flatter archs not using exception_enter/exit() Frederic Weisbecker
2020-10-05 10:49 ` [PATCH 1/5] context_tracking: Introduce HAVE_CONTEXT_TRACKING_OFFSTACK Frederic Weisbecker
2020-10-05 10:49 ` [PATCH 2/5] context_tracking: Don't implement exception_enter/exit() on CONFIG_HAVE_CONTEXT_TRACKING_OFFSTACK Frederic Weisbecker
2020-10-05 10:49 ` [PATCH 3/5] sched: Detect call to schedule from critical entry code Frederic Weisbecker
2020-10-05 11:23 ` Peter Zijlstra [this message]
2020-10-05 12:26 ` Frederic Weisbecker
2020-10-07 9:34 ` Mel Gorman
2020-10-26 14:37 ` Frederic Weisbecker
2020-10-05 10:49 ` [PATCH 4/5] context_tracking: Only define schedule_user() on !HAVE_CONTEXT_TRACKING_OFFSTACK archs Frederic Weisbecker
2020-10-05 10:49 ` [PATCH 5/5] x86: Support HAVE_CONTEXT_TRACKING_OFFSTACK Frederic Weisbecker
2020-10-27 15:08 [PATCH 0/5] context_tracking: Flatter archs not using exception_enter/exit() v2 Frederic Weisbecker
2020-10-27 15:08 ` [PATCH 3/5] sched: Detect call to schedule from critical entry code Frederic Weisbecker
2020-11-17 15:16 [PATCH 0/5] context_tracking: Flatter archs not using exception_enter/exit() v3 Frederic Weisbecker
2020-11-17 15:16 ` [PATCH 3/5] sched: Detect call to schedule from critical entry code 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=20201005112353.GI2628@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mtosatti@redhat.com \
--cc=pauld@redhat.com \
--cc=paulmck@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 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).