From: Corey Minyard <minyard@acm.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Corey Minyard <cminyard@mvista.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
tglx@linutronix.de
Subject: Re: [PATCH RT v2] Fix a lockup in wait_for_completion() and friends
Date: Mon, 1 Jul 2019 16:34:48 -0500 [thread overview]
Message-ID: <20190701213448.GC4336@minyard.net> (raw)
In-Reply-To: <20190701172825.7d861e85@gandalf.local.home>
On Mon, Jul 01, 2019 at 05:28:25PM -0400, Steven Rostedt wrote:
> On Mon, 1 Jul 2019 17:13:33 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > On Mon, 1 Jul 2019 17:06:02 -0400
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > > On Mon, 1 Jul 2019 15:43:25 -0500
> > > Corey Minyard <cminyard@mvista.com> wrote:
> > >
> > >
> > > > I show that patch is already applied at
> > > >
> > > > 1921ea799b7dc561c97185538100271d88ee47db
> > > > sched/completion: Fix a lockup in wait_for_completion()
> > > >
> > > > git describe --contains 1921ea799b7dc561c97185538100271d88ee47db
> > > > v4.19.37-rt20~1
> > > >
> > > > So I'm not sure what is going on.
> > >
> > > Bah, I'm replying to the wrong commit that I'm having issues with.
> > >
> > > I searched your name to find the patch that is of trouble, and picked
> > > this one.
> > >
> > > I'll go find the problem patch, sorry for the noise on this one.
> > >
> >
> > No, I did reply to the right email, but it wasn't the top patch I was
> > having issues with. It was the patch I replied to:
> >
> > This change below that Sebastian marked as stable-rt is what is causing
> > me an issue. Not the patch that started the thread.
> >
>
> In fact, my system doesn't boot with this commit in 5.0-rt.
>
> If I revert 90e1b18eba2ae4a729 ("swait: Delete the task from after a
> wakeup occured") the machine boots again.
>
> Sebastian, I think that's a bad commit, please revert it.
Yeah. d_wait_lookup() does not use __SWAITQUEUE_INITIALIZER() to
intitialize it's queue item, but uses swake_up_all(), so it goes
into an infinite loop since it won't remove the item because remove
isn't set.
I'd suspect there are other places this is the case.
-corey
>
> Thanks!
>
> -- Steve
>
> >
> >
> > > Now.. that will fix it, but I think it is also wrong.
> > >
> > > The problem being that it violates FIFO, something that might be more
> > > important on -RT than elsewhere.
> > >
> > > The regular wait API seems confused/inconsistent when it uses
> > > autoremove_wake_function and default_wake_function, which doesn't help,
> > > but we can easily support this with swait -- the problematic thing is
> > > the custom wake functions, we musn't do that.
> > >
> > > (also, mingo went and renamed a whole bunch of wait_* crap and didn't do
> > > the same to swait_ so now its named all different :/)
> > >
> > > Something like the below perhaps.
> > >
> > > ---
> > > diff --git a/include/linux/swait.h b/include/linux/swait.h
> > > index 73e06e9986d4..f194437ae7d2 100644
> > > --- a/include/linux/swait.h
> > > +++ b/include/linux/swait.h
> > > @@ -61,11 +61,13 @@ struct swait_queue_head {
> > > struct swait_queue {
> > > struct task_struct *task;
> > > struct list_head task_list;
> > > + unsigned int remove;
> > > };
> > >
> > > #define __SWAITQUEUE_INITIALIZER(name) { \
> > > .task = current, \
> > > .task_list = LIST_HEAD_INIT((name).task_list), \
> > > + .remove = 1, \
> > > }
> > >
> > > #define DECLARE_SWAITQUEUE(name) \
> > > diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
> > > index e83a3f8449f6..86974ecbabfc 100644
> > > --- a/kernel/sched/swait.c
> > > +++ b/kernel/sched/swait.c
> > > @@ -28,7 +28,8 @@ void swake_up_locked(struct swait_queue_head *q)
> > >
> > > curr = list_first_entry(&q->task_list, typeof(*curr), task_list);
> > > wake_up_process(curr->task);
> > > - list_del_init(&curr->task_list);
> > > + if (curr->remove)
> > > + list_del_init(&curr->task_list);
> > > }
> > > EXPORT_SYMBOL(swake_up_locked);
> > >
> > > @@ -57,7 +58,8 @@ void swake_up_all(struct swait_queue_head *q)
> > > curr = list_first_entry(&tmp, typeof(*curr), task_list);
> > >
> > > wake_up_state(curr->task, TASK_NORMAL);
> > > - list_del_init(&curr->task_list);
> > > + if (curr->remove)
> > > + list_del_init(&curr->task_list);
> > >
> > > if (list_empty(&tmp))
> > > break;
> >
>
next prev parent reply other threads:[~2019-07-01 21:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 19:33 [PATCH RT v2] Fix a lockup in wait_for_completion() and friends minyard
2019-05-09 19:51 ` Steven Rostedt
2019-05-10 10:33 ` Sebastian Andrzej Siewior
2019-05-10 12:08 ` Corey Minyard
2019-05-10 12:26 ` Sebastian Andrzej Siewior
2019-06-29 1:49 ` Steven Rostedt
2019-07-01 19:09 ` Corey Minyard
[not found] ` <20190701161840.1a53c9e4@gandalf.local.home>
2019-07-01 20:43 ` Corey Minyard
2019-07-01 21:06 ` Steven Rostedt
2019-07-01 21:13 ` Steven Rostedt
2019-07-01 21:28 ` Steven Rostedt
2019-07-01 21:34 ` Corey Minyard [this message]
2019-07-02 7:04 ` Kurt Kanzenbach
2019-07-02 8:35 ` Sebastian Andrzej Siewior
2019-07-02 11:40 ` Corey Minyard
2019-07-02 11:53 ` Sebastian Andrzej Siewior
-- strict thread matches above, loose matches on Subject: below --
2019-05-08 20:57 [PATCH " minyard
2019-05-09 16:19 ` [PATCH RT " Sebastian Andrzej Siewior
2019-05-09 17:46 ` Corey Minyard
2019-05-14 8:43 ` Peter Zijlstra
2019-05-14 9:12 ` Sebastian Andrzej Siewior
2019-05-14 11:35 ` Peter Zijlstra
2019-05-14 15:25 ` Sebastian Andrzej Siewior
2019-05-14 12:13 ` Corey Minyard
2019-05-14 15:36 ` Sebastian Andrzej Siewior
2019-05-15 16:22 ` Corey Minyard
2019-06-26 10:35 ` Peter Zijlstra
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=20190701213448.GC4336@minyard.net \
--to=minyard@acm.org \
--cc=bigeasy@linutronix.de \
--cc=cminyard@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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).