From: Peter Zijlstra <peterz@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org, Ingo Molnar <mingo@redhat.com>,
Will Deacon <will@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [PATCH] rxrpc: Mutexes are unusable from softirq context, so use rwsem instead
Date: Tue, 10 Dec 2019 20:30:11 +0100 [thread overview]
Message-ID: <20191210193011.GA11802@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20191210191009.GA11457@worktop.programming.kicks-ass.net>
On Tue, Dec 10, 2019 at 08:10:09PM +0100, Peter Zijlstra wrote:
> On Tue, Dec 10, 2019 at 05:32:58PM +0000, David Howells wrote:
> > rxrpc_call::user_mutex is of type struct mutex, but it's required to start
> > off locked on an incoming call as it is being set up in softirq context to
> > prevent sendmsg and recvmsg interfering with it until it is ready. It is
> > then unlocked in rxrpc_input_packet() to make the call live.
> >
> > Unfortunately, commit a0855d24fc22d49cdc25664fb224caee16998683
> > ("locking/mutex: Complain upon mutex API misuse in IRQ contexts") causes
> > big warnings to be splashed in dmesg for each a new call that comes in from
> > the server.
> >
> > It *seems* like it should be okay, since the accept path trylocks the mutex
> > when no one else can see it and drops the mutex before it leaves softirq
> > context.
> >
> > Fix this by switching to using an rw_semaphore instead as that is permitted
> > to be used in softirq context.
>
> This really has the very same problem. It just avoids the WARN. We do PI
> boosting for rwsem write side identical to what we do for mutexes.
>
> I would rather we revert David's patch for now and more carefully
> consider what to do about this.
To clarify (I only just reliazed David is a bit ambiguous here), take
this patch out for now:
a0855d24fc22 ("locking/mutex: Complain upon mutex API misuse in IRQ contexts")
The RXRPC code has been there for a while... and like I wrote, both
mutex and rwsem have the exact same issue, the rwsem code just doesn't
have a WARN on it.
next prev parent reply other threads:[~2019-12-10 19:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 17:32 [PATCH] rxrpc: Mutexes are unusable from softirq context, so use rwsem instead David Howells
2019-12-10 19:10 ` Peter Zijlstra
2019-12-10 19:30 ` Peter Zijlstra [this message]
2019-12-10 22:05 ` [PATCH] Revert "locking/mutex: Complain upon mutex API misuse in IRQ contexts" Davidlohr Bueso
2019-12-10 22:32 ` David Howells
2019-12-10 23:26 ` Ingo Molnar
2019-12-10 23:35 ` [tip: locking/urgent] " tip-bot2 for Davidlohr Bueso
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=20191210193011.GA11802@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave@stgolabs.net \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.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