On Fri, Jan 14, 2022 at 03:12:47PM -0500, Michael S. Tsirkin
wrote:> On Thu, Dec 16, 2021 at 08:58:31PM +0100, Marcel Holtmann wrote:
> > 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
> > >>>
> > >>> So Marcel, do I read it right that you are working on a
fix
> > >>> and I can drop this patch for now?
> > >>
> > >> ping
> > >
> > >
> > > If I don't hear otherwise I'll queue my version - it
might not
> > > be ideal but it at least does not violate the spec.
> > > We can work on not allocating/freeing buffers later
> > > as appropriate.
> >
> > I have a patch, but it is not fully tested yet.
> >
> > Regards
> >
> > Marcel
>
> ping
>
> it's been a month ...
>
> I'm working on cleaning up module/device removal in virtio and bt
> is kind of sticking out.
I am inclined to make this driver depend on BROKEN for now.
Any objections?
> --
> MST