linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with WARN_ON in mutex_trylock() and rxrpc
@ 2019-12-05 12:02 David Howells
  2019-12-05 13:22 ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: David Howells @ 2019-12-05 12:02 UTC (permalink / raw)
  To: Davidlohr Bueso, Peter Zijlstra, Ingo Molnar; +Cc: dhowells, linux-kernel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-10 21:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 12:02 Problem with WARN_ON in mutex_trylock() and rxrpc David Howells
2019-12-05 13:22 ` 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

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).