From: Benjamin Berg <benjamin@sipsolutions.net>
To: Alan Stern <stern@rowland.harvard.edu>,
Marcel Holtmann <marcel@holtmann.org>
Cc: linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org
Subject: Re: Userspace enumeration hang while btusb tries to load firmware of removed device
Date: Tue, 09 Nov 2021 18:03:48 +0100 [thread overview]
Message-ID: <76ff2cb3f687fdf0ca271fe0fe084371c4288c33.camel@sipsolutions.net> (raw)
In-Reply-To: <20211103201138.GC1529362@rowland.harvard.edu>
[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]
Hi,
On Wed, 2021-11-03 at 16:11 -0400, Alan Stern wrote:
> On Wed, Nov 03, 2021 at 08:31:03PM +0100, Marcel Holtmann wrote:
> > the problem seems to be that we hitting HCI command timeout. So the
> > firmware download is done via HCI commands. These commands are send to
> > the transport driver btusb.c via hdev->send (as btusb_send_frame).
> > This triggers the usb_submit_urb or queues them via data->deferred
> > anchor. All this reports back the error properly except that nobody
> > does anything with it.
> >
> > See hci_send_frame() last portion:
> >
> > err = hdev->send(hdev, skb);
> > if (err < 0) {
> > bt_dev_err(hdev, "sending frame failed (%d)", err);
> > kfree_skb(skb);
> > }
> >
> > And that is it. We are not checking for ENODEV or any error here. That
> > means the failure of the HCI command gets only caught via the HCI
> > command timeout. I don’t know how to do this yet, but you would have
> > to look there to fail HCI command right away instead of waiting for
> > the timeout.
>
> I have no idea how all the different layers work here. Clearly
> something has to signal hdev->req_wait_q after setting hdev->req_status
> to some appropriate value. Can this be done in btusb.c, either when the
> URB is submitted or when it completes? Or in hci_send_frame?
I submitted
https://patchwork.kernel.org/project/bluetooth/list/?series=577565
for this now.
The patchset pretty much calls hci_req_sync_cancel to set req_status
and signal req_wait_q. Doing this and hooking it up in various location
appears to work reasonably well for the synchronous commands.
Benjamin
PS: The user now reported that TLP is blocking the rfkill switch after
resume. So an good workaround is to just not use TLP.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-11-09 17:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 14:55 Userspace enumeration hang while btusb tries to load firmware of removed device Benjamin Berg
2021-11-03 18:23 ` Alan Stern
2021-11-03 19:31 ` Marcel Holtmann
2021-11-03 20:11 ` Alan Stern
2021-11-09 17:03 ` Benjamin Berg [this message]
2021-11-04 9:34 ` Benjamin Berg
2021-11-04 13:28 ` Alan Stern
2021-11-04 14:19 ` Benjamin Berg
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=76ff2cb3f687fdf0ca271fe0fe084371c4288c33.camel@sipsolutions.net \
--to=benjamin@sipsolutions.net \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=stern@rowland.harvard.edu \
/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