All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mart van de Wege <mvdwege@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@intel.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org, tglx@linutronix.de,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: Possible BT deadlock due to recursive read locking (Was: Re: kernel BUG at kernel/locking/rtmutex.c:1059)
Date: Fri, 1 Sep 2017 10:51:07 +0200	[thread overview]
Message-ID: <20170901105107.753617a1@gmail.com> (raw)
In-Reply-To: <20170831145211.xlu6cvocqdkzevsl@linutronix.de>

On Thu, 31 Aug 2017 16:52:12 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> On 2017-08-30 23:25:53 [+0200], Mart van de Wege wrote:
> > Hi,  
> Hi,
> 
> > The issue persists up to v4.11.12-rt10  
> Does
> 	CONFIG_RWLOCK_RT_READER_BIASED=y
> make it go away?
> 
Yes, that does make it go away. -rt8 now boots cleanly, and works fine.
Building -rt10 now to be sure.

> > Stacktrace:
> > 
> > Aug 29 17:28:04 localhost kernel: [   46.483810] ------------[ cut
> > here ]------------ Aug 29 17:28:04 localhost kernel: [   46.483812]
> > kernel BUG at kernel/locking/rtmutex.c:1059!  
> 
> this is a deadlock on RT however !RT has a hidden problem which not
> yelled at by lockdep. We have the following call path:
> 
> | hci_send_monitor_ctrl_event()
> |   read_lock(&hci_sk_list.lock);
> |
> |   hci_send_to_channel()
> |      read_lock(&hci_sk_list.lock);
> 
> So both functions acquire the same read_lock. If a write comes along
> between the first read_lock() and second read_lock() then we have a
> deadlock because the write_lock() will lock down further readers from
> acquiring the read-lock until the writer completed its task.
> 
> This recursive locking was introduced in 38ceaa00d02d ("Bluetooth: Add
> support for sending MGMT commands and events to monitor").
> 
> Sebastian

  parent reply	other threads:[~2017-09-01  8:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 21:25 kernel BUG at kernel/locking/rtmutex.c:1059 Mart van de Wege
2017-08-31 10:59 ` Pratyush Patel
2017-08-31 14:54   ` Sebastian Andrzej Siewior
2017-08-31 16:02     ` Pratyush Patel
2017-08-31 14:52 ` Possible BT deadlock due to recursive read locking (Was: Re: kernel BUG at kernel/locking/rtmutex.c:1059) Sebastian Andrzej Siewior
2017-08-31 14:56   ` Thomas Gleixner
2017-09-01  8:51   ` Mart van de Wege [this message]
2017-09-02  7:27     ` Mart van de Wege
2017-09-02  7:27       ` Mart van de Wege
2017-09-02  7:27       ` Mart van de Wege
2017-09-21 13:51   ` [PATCH] Bluetooth: avoid recursive locking in hci_send_to_channel() Sebastian Andrzej Siewior
2017-09-24 14:53     ` Mart van de Wege
2017-09-24 14:53       ` Mart van de Wege
2017-10-30  8:05     ` Marcel Holtmann

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=20170901105107.753617a1@gmail.com \
    --to=mvdwege@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=gustavo@padovan.org \
    --cc=johan.hedberg@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=marcel@holtmann.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.