Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Guenter Roeck <linux@roeck-us.net>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"open list:BLUETOOTH SUBSYSTEM" <linux-bluetooth@vger.kernel.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] Bluetooth: Move shutdown callback before flushing tx and rx queue
Date: Mon, 16 Aug 2021 17:49:25 +0200	[thread overview]
Message-ID: <453AB6D8-9CA8-42B8-9807-5AC249E8618B@holtmann.org> (raw)
In-Reply-To: <20210810045315.184383-1-kai.heng.feng@canonical.com>

Hi Kai-Heng,

> Commit 0ea9fd001a14 ("Bluetooth: Shutdown controller after workqueues
> are flushed or cancelled") introduced a regression that makes mtkbtsdio
> driver stops working:
> [   36.593956] Bluetooth: hci0: Firmware already downloaded
> [   46.814613] Bluetooth: hci0: Execution of wmt command timed out
> [   46.814619] Bluetooth: hci0: Failed to send wmt func ctrl (-110)
> 
> The shutdown callback depends on the result of hdev->rx_work, so we
> should call it before flushing rx_work:
> -> btmtksdio_shutdown()
> -> mtk_hci_wmt_sync()
>  -> __hci_cmd_send()
>   -> wait for BTMTKSDIO_TX_WAIT_VND_EVT gets cleared
> 
> -> btmtksdio_recv_event()
> -> hci_recv_frame()
>  -> queue_work(hdev->workqueue, &hdev->rx_work)
>   -> clears BTMTKSDIO_TX_WAIT_VND_EVT
> 
> So move the shutdown callback before flushing TX/RX queue to resolve the
> issue.
> 
> Reported-and-tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Fixes: 0ea9fd001a14 ("Bluetooth: Shutdown controller after workqueues are flushed or cancelled")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
> v2: 
> Move the shutdown callback before clearing HCI_UP, otherwise 1)
> shutdown callback won't be called and 2) other routines that depend on
> HCI_UP won't work.
> 
> net/bluetooth/hci_core.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


      parent reply	other threads:[~2021-08-16 15:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  4:53 Kai-Heng Feng
2021-08-11  8:25 ` Mattijs Korpershoek
2021-08-16 15:49 ` Marcel Holtmann [this message]

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=453AB6D8-9CA8-42B8-9807-5AC249E8618B@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=davem@davemloft.net \
    --cc=hsinyi@chromium.org \
    --cc=johan.hedberg@gmail.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=luiz.dentz@gmail.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH v2] Bluetooth: Move shutdown callback before flushing tx and rx queue' \
    /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

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