linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] Bluetooth: virtio_bt: fix device removal
Date: Thu, 25 Nov 2021 21:02:01 +0100	[thread overview]
Message-ID: <F52F65FE-6A07-486B-8E84-684ED85709E9@holtmann.org> (raw)
In-Reply-To: <20211125174200.133230-1-mst@redhat.com>

Hi Michael,

> Device removal is clearly out of virtio spec: it attempts to remove
> unused buffers from a VQ before invoking device reset. To fix, make
> open/close NOPs and do all cleanup/setup in probe/remove.

so the virtbt_{open,close} as NOP is not really what a driver is suppose
to be doing. These are transport enable/disable callbacks from the BT
Core towards the driver. It maps to a device being enabled/disabled by
something like bluetoothd for example. So if disabled, I expect that no
resources/queues are in use.

Maybe I misunderstand the virtio spec in that regard, but I would like
to keep this fundamental concept of a Bluetooth driver. It does work
with all other transports like USB, SDIO, UART etc.

> The cost here is a single skb wasted on an unused bt device - which
> seems modest.

There should be no buffer used if the device is powered off. We also don’t
have any USB URBs in-flight if the transport is not active.

> NB: with this fix in place driver still suffers from a race condition if
> an interrupt triggers while device is being reset. Work on a fix for
> that issue is in progress.

In the virtbt_close() callback we should deactivate all interrupts.

Regards

Marcel


  reply	other threads:[~2021-11-25 20:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25 17:44 [PATCH] Bluetooth: virtio_bt: fix device removal Michael S. Tsirkin
2021-11-25 20:02 ` Marcel Holtmann [this message]
2021-11-25 20:44   ` Michael S. Tsirkin
2021-11-25 21:01     ` Marcel Holtmann
2021-11-25 21:23       ` Michael S. Tsirkin
2021-11-25 21:58         ` Marcel Holtmann
2021-11-26  1:02           ` Michael S. Tsirkin
2021-12-09 21:22   ` Michael S. Tsirkin
2021-12-13 10:44     ` Michael S. Tsirkin
2021-12-13 23:57       ` Michael S. Tsirkin
2021-12-16 19:58         ` Marcel Holtmann
2022-01-14 20:12           ` Michael S. Tsirkin
2022-06-13  6:58             ` Michael S. Tsirkin
2022-06-28  4:59               ` Michael S. Tsirkin

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=F52F65FE-6A07-486B-8E84-684ED85709E9@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).