Subject: Re: aue panic in 3.0
To: Iain Hibbert <plunky@rya-online.net>
From: Hans Petter Selasky <hselasky@c2i.net>
List: tech-net
Date: 09/16/2006 17:39:08
On Saturday 16 September 2006 15:54, Iain Hibbert wrote:
> On Sat, 16 Sep 2006, Hans Petter Selasky wrote:
> > On Friday 15 September 2006 21:56, Iain Hibbert wrote:
> > > On Thu, 14 Sep 2006, Hans Petter Selasky wrote:
> > > > On Thursday 14 September 2006 20:38, Iain Hibbert wrote:
> > > > > Is usbd_transfer allowed to be called from interrupt context?
> > > >
> > > > The answer is no. Deep inside the [old] USB system, usbd_transfer can
> > > > allocate memory when it is called, that can sleep
> > >
> > > That is true but I think 'can' is not 'will' - if the driver wants to
> > > call usbd_transfer from interrupt context, the allocation can be
> > > arranged safely in advance, so far as I can tell..?
> >
> > Last time I checked, the NetBSD USB stack will start allocating memory
> > at the moment usbd_transfer() is called. This is USB hardware memory
> > like transfer descriptors and DMA memory for the data-buffers.s And it
> > can sleep! The old system is simply wrong. It is not possible to
> > pre-allocate all memory. Only some parts like the "struct usbd_xfer" and
> > "struct usbd_xfer -> buffer".
>
> The allocation inside usbd_transfer() seems to be those parts that you
> mention can be pre-allocated, and the sleep is only when USBD_SYNCHRONOUS
> is set..
>
> Further down _NOWAIT does seem to be used where it is needed (so far as I
> can see :)

That is correct. But at least on FreeBSD, the NOWAIT option is not available 
for bus_dma_xxx(). That means the bus_dma system ignores the NOWAIT option, 
and will sleep regardless of that. I don't know how it is on NetBSD. 
bus_dma_xxx() is used when you allocate DMA'able memory.

>
> My concern is the ubt(4) driver which I wrote, but that seems (to me) to
> safely allocate everything in advance and deals transfers asynchronously -
> certainly I've had no issues with it in a fairly low memory system and
> running Firefox & gcc etc (with painful swapping)

Ok.

Maybe you want to have a look here:

http://www.turbocat.net/~hselasky/isdn4bsd/sources/src/sys/netgraph/bluetooth/drivers/ubt/

Does the "ubt" driver support isochronous transfers or not ?

--HPS