From: Crystal Wood <swood@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: John Keeping <john@metanate.com>,
linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: rtmutex, pi_blocked_on, and blk_flush_plug()
Date: Sat, 04 Mar 2023 23:39:57 -0600 [thread overview]
Message-ID: <84c1de84ac129de7c7597c48d3ec19ccc0672492.camel@redhat.com> (raw)
In-Reply-To: <874jrgqjsw.ffs@tglx>
On Mon, 2023-02-20 at 19:21 +0100, Thomas Gleixner wrote:
> On Mon, Feb 20 2023 at 12:42, Sebastian Andrzej Siewior wrote:
> > On 2023-02-20 12:04:56 [+0100], To Thomas Gleixner wrote:
> > > The ->pi_blocked_on field is set by __rwbase_read_lock() before
> > > schedule() is invoked while blocking on the sleeping lock. By doing
> > > this
> > > we avoid __blk_flush_plug() and as such will may deadlock because we
> > > are
> > > going to sleep and made I/O progress earlier which is not globally
> > > visibly but might be (s/might be/is/ in the deadlock case) expected by
> > > the owner of the lock.
>
> Fair enough.
>
> > --- a/kernel/locking/rtmutex.c
> > +++ b/kernel/locking/rtmutex.c
> > @@ -1700,6 +1700,13 @@ static __always_inline int __rt_mutex_lock(struct
> > rt_mutex_base *lock,
> > if (likely(rt_mutex_cmpxchg_acquire(lock, NULL, current)))
> > return 0;
> >
> > + if (state != TASK_RTLOCK_WAIT) {
> > + /*
> > + * If we are going to sleep and we have plugged IO
> > queued,
> > + * make sure to submit it to avoid deadlocks.
> > + */
> > + blk_flush_plug(tsk->plug, true);
>
> This still leaves the problem vs. io_wq_worker_sleeping() and it's
> running() counterpart after schedule().
The closest thing I can see to a problem there is io_wqe_dec_running()->
io_queue_worker_create()->io_wq_cancel_tw_create()->kfree(), but that only
happens with func == create_worker_cont(), and io_wqe_dec_running() uses
create_worker_cb().
Are there any workloads I could run to stress out that path (with my
asserts in place)?
-Scott
next prev parent reply other threads:[~2023-03-05 5:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 4:31 Crystal Wood
2023-02-16 14:17 ` Sebastian Andrzej Siewior
2023-02-16 15:05 ` Sebastian Andrzej Siewior
2023-02-20 9:49 ` Thomas Gleixner
2023-02-20 11:04 ` Sebastian Andrzej Siewior
2023-02-20 11:42 ` Sebastian Andrzej Siewior
2023-02-20 18:21 ` Thomas Gleixner
2023-03-05 5:39 ` Crystal Wood [this message]
2023-03-22 16:41 ` Sebastian Andrzej Siewior
2023-03-23 14:50 ` Sebastian Andrzej Siewior
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=84c1de84ac129de7c7597c48d3ec19ccc0672492.camel@redhat.com \
--to=swood@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=john@metanate.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®