From: John Keeping <john@metanate.com>
To: Valentin Schneider <valentin.schneider@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
linux-rt-users@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RT] BUG in sched/cpupri.c
Date: Tue, 21 Dec 2021 17:42:15 +0000 [thread overview]
Message-ID: <20211221174215.04b07f31.john@metanate.com> (raw)
In-Reply-To: <87wnjx7u05.mognet@arm.com>
On Tue, 21 Dec 2021 17:22:34 +0000
Valentin Schneider <valentin.schneider@arm.com> wrote:
> On 21/12/21 16:45, John Keeping wrote:
> > On Tue, 21 Dec 2021 16:11:34 +0000
> > Valentin Schneider <valentin.schneider@arm.com> wrote:
> >
> >> On 20/12/21 18:35, Dietmar Eggemann wrote:
> >> > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> >> > index ef8228d19382..798887f1eeff 100644
> >> > --- a/kernel/sched/rt.c
> >> > +++ b/kernel/sched/rt.c
> >> > @@ -1895,9 +1895,17 @@ static int push_rt_task(struct rq *rq, bool pull)
> >> > struct task_struct *push_task = NULL;
> >> > int cpu;
> >> >
> >> > + if (WARN_ON_ONCE(!rt_task(rq->curr))) {
> >> > + printk("next_task=[%s %d] rq->curr=[%s %d]\n",
> >> > + next_task->comm, next_task->pid, rq->curr->comm, rq->curr->pid);
> >> > + }
> >> > +
> >> > if (!pull || rq->push_busy)
> >> > return 0;
> >> >
> >> > + if (!rt_task(rq->curr))
> >> > + return 0;
> >> > +
> >>
> >> If current is a DL/stopper task, why not; if that's CFS (which IIUC is your
> >> case), that's buggered: we shouldn't be trying to pull RT tasks when we
> >> have queued RT tasks and a less-than-RT current, we should be rescheduling
> >> right now.
> >>
> >> I'm thinking this can happen via rt_mutex_setprio() when we demote an RT-boosted
> >> CFS task (or straight up sched_setscheduler()):
> >> check_class_changed()->switched_from_rt() doesn't trigger a resched_curr(),
> >> so I suspect we get to the push/pull callback before getting a
> >> resched (I actually don't see where we'd get a resched in that case other
> >> than at the next tick).
> >>
> >> IOW, feels like we want the below. Unfortunately I can't reproduce the
> >> issue locally (yet), so that's untested.
> >
> > This patch doesn't make any difference for me - I hit the BUG on the
> > first boot with this applied.
> >
>
> Thanks for the swift testing!
>
> Did you give Dietmar's patch a try? ITSM it lacks a resched_curr(), but if
> we can somehow get to the push IRQ work before rescheduling (which I think
> might happen if we try to resched_curr(this_rq)), then we need his
> bailout.
With Dietmar's patch I hit the added WARN_ON_ONCE with:
next_task=[rcu_preempt 11] rq->curr=[ksoftirqd/1 21]
next_task=[rcu_preempt 11] rq->curr=[ksoftirqd/1 21]
# ps -eTo comm,pid,lwp,pri,rtprio,nice,class
...
rcu_preempt 11 11 41 1 - FF
...
ksoftirqd/1 21 21 19 - 0 TS
Out of three reproductions, rcu_preempt as next_task is consistent, but
I've seen three different tasks in rq->curr (although all with
SCHED_OTHER).
And as expected, the added early return does stop the BUG.
next prev parent reply other threads:[~2021-12-21 17:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-18 14:25 [RT] BUG in sched/cpupri.c John Keeping
2021-12-20 17:35 ` Dietmar Eggemann
2021-12-21 16:11 ` Valentin Schneider
2021-12-21 16:45 ` John Keeping
2021-12-21 17:22 ` Valentin Schneider
2021-12-21 17:42 ` John Keeping [this message]
2021-12-22 17:46 ` Dietmar Eggemann
2021-12-22 18:45 ` John Keeping
2021-12-22 19:48 ` Valentin Schneider
2021-12-23 11:58 ` John Keeping
2021-12-23 14:05 ` Valentin Schneider
2022-01-07 10:46 ` Dietmar Eggemann
2022-01-07 11:49 ` John Keeping
2022-01-07 14:25 ` Dietmar Eggemann
2022-01-07 18:35 ` John Keeping
2022-01-14 18:25 ` Valentin Schneider
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=20211221174215.04b07f31.john@metanate.com \
--to=john@metanate.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=valentin.schneider@arm.com \
--cc=vincent.guittot@linaro.org \
/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).