public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Davidlohr Bueso <dave@stgolabs.net>,
	Peter Zijlstra (Intel) <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: Problem with WARN_ON in mutex_trylock() and rxrpc
Date: Thu, 05 Dec 2019 12:02:24 +0000	[thread overview]
Message-ID: <26229.1575547344@warthog.procyon.org.uk> (raw)

Hi Davidlohr,

commit a0855d24fc22d49cdc25664fb224caee16998683 ("locking/mutex: Complain upon
mutex API misuse in IRQ contexts") is a bit of a problem for rxrpc, though
nothing that shouldn't be reasonably easy to solve, I think.

What happens is that rxrpc_new_incoming_call(), which is called in softirq
context, calls mutex_trylock() to prelock a new incoming call:

	/* Lock the call to prevent rxrpc_kernel_send/recv_data() and
	 * sendmsg()/recvmsg() inconveniently stealing the mutex once the
	 * notification is generated.
	 *
	 * The BUG should never happen because the kernel should be well
	 * behaved enough not to access the call before the first notification
	 * event and userspace is prevented from doing so until the state is
	 * appropriate.
	 */
	if (!mutex_trylock(&call->user_mutex))
		BUG();

before publishing it.  This used to work fine, but now there are big splashy
warnings every time a new call comes in.

No one else can see the lock at this point, but I need to lock it so that
lockdep doesn't complain later.  However, I can't lock it in the preallocator
- again because that upsets lockdep.

David


             reply	other threads:[~2019-12-05 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 12:02 David Howells [this message]
2019-12-05 13:22 ` Problem with WARN_ON in mutex_trylock() and rxrpc Peter Zijlstra
2019-12-06 12:32   ` Peter Zijlstra
2019-12-10 18:33   ` Thomas Gleixner
2019-12-10 19:25     ` Peter Zijlstra
2019-12-10 20:32       ` Sebastian Andrzej Siewior
2019-12-10 21:53         ` 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=26229.1575547344@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=dave@stgolabs.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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