Re: pci_alloc_consistent from interrupt == BAD

David Brownell
2002-01-19T17:23:49Z

"> > " == David Miller
"> " == Russell King

> > BTW, the USB host controller drivers do this (allocate potentially
> > from interrupts) so anyone using USB on ARM...
>
> Well, I've got a BUG() in there that'll trigger when pci_alloc_consistent()
> is called from IRQ, and so far no one has reported an incidence of
> that occuring, despite there being USB OHCI controllers available on ARM.

Yes, that'd be rare -- but legal.

The USB host controller drivers would do that primarily in the
case where (a) some driver submitted a new URB in_interrupt(),
so the HCD needed to queue new requests to the hardware,
and (b) the pools of endpoint or transfer descriptors didn't have
enough free entries.

The main reason for (a) is that the last URB just completed, and
freed its resources, and a new request for that endpoint needs to
get submitted. As for (b), endpoint descriptors are normally
preserved until the device is disconnected. That leaves transport
descriptors (TDs). OHCI (and EHCI) don't need many of those;
typically one per request. So if one was just put back into the pool,
it'd typically still be available. UHCI needs more memory, but
the same general rules apply.

- Dave