From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: David Herrmann <dh.herrmann@googlemail.com>
Cc: Alexander Holler <holler@ahsoftware.de>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
"Gustavo F. Padovan" <padovan@profusion.mobi>
Subject: Re: bluetooth: fix deadlock on device reset and power down
Date: Mon, 2 Apr 2012 12:03:46 +0300 [thread overview]
Message-ID: <20120402090337.GB29687@aemeltch-MOBL1> (raw)
In-Reply-To: <CANq1E4RCQvQX6deGOTjdhbEkAahZD9MmAmfgz-Y-+wDfRtx0dw@mail.gmail.com>
Hi guys,
On Mon, Apr 02, 2012 at 10:44:43AM +0200, David Herrmann wrote:
> Hi Andrei and Alexander
>
> On Mon, Apr 2, 2012 at 10:29 AM, Alexander Holler <holler@ahsoftware.de> wrote:
> > Am 02.04.2012 08:55, schrieb Andrei Emeltchenko:
> >> Hi Alexander,
> >>
> >> On Sat, Mar 31, 2012 at 03:23:38PM +0200, Alexander Holler wrote:
> >>> I've experienced a deadlock on shutdown using kernel 3.3 and tracked
> >>> it down. Because I'm not very familiar with the bluetooth stack I'm
> >>> not sure if the below patch is correct, but it fixed the problem
> >>> here.
> >>
> >> Could you please attach deadlock dump?
> >>
> >>>
> >>> Commit 09fd0de5bd8f8ef3317e5365f92f1a13dcd89aa9 introduced a deadlock:
> >>>
> >>> bluetoothd calls ioctl HCIDEVDOWN
> >>> hci_sock_ioctl()
> >>> hci_dev_close()
> >>> hci_dev_do_close()
> >>> hci_dev_lock(hdev);
> >>> inquiry_cache_flush();
> >>> hci_conn_hash_flush();
> >>> hci_conn_del()
> >>> cancel_delayed_work_sync()
> >>> hci_conn_timeout()
> >>> hci_dev_lock(hdev); /* DEADLOCK */
> >>
> >> I am actually not sure that hci_conn_timeout locks hdev. Why do you think
> >> so?
> >
> > By reading the source, printk and suffering through the deadlock. It's
> > especially painfull when using a bt-keyboard and systemd, because
> > systemd tries 4 times (~ some minutes) to kill bluetoothd before it
> > marks the service as failed and finally continues to shut down.
>
> hci_conn_timeout does lock the device. See the source. But the problem
I think you need to check commit e72acc13c770a82b4ce4a07e9716f29320eae0f8
commit e72acc13c770a82b4ce4a07e9716f29320eae0f8
Author: Andre Guedes <andre.guedes@openbossa.org>
Date: Fri Jan 27 19:42:03 2012 -0300
Bluetooth: Remove unneeded locking
We don't need locking hdev in hci_conn_timeout() since it doesn't
access any hdev's shared resources, it basically queues HCI commands.
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2012-04-02 9:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 13:23 Alexander Holler
2012-04-02 6:55 ` Andrei Emeltchenko
2012-04-02 8:29 ` Alexander Holler
2012-04-02 8:44 ` David Herrmann
2012-04-02 9:03 ` Andrei Emeltchenko [this message]
2012-04-02 9:17 ` Alexander Holler
2012-04-02 10:16 ` Alexander Holler
2012-04-02 13:52 ` Andre Guedes
2012-04-02 14:27 ` Genes MailLists
2012-04-03 8:37 ` Alexander Holler
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=20120402090337.GB29687@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=dh.herrmann@googlemail.com \
--cc=holler@ahsoftware.de \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=padovan@profusion.mobi \
/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®