contigmalloc(9) doesn't honour M_NOWAIT.

Ian Dowse iedowse at iedowse.com
Tue May 9 21:12:16 UTC 2006


In message <4460EF33.8010909 at samsco.org>, Scott Long writes:
>Peter Jeremy wrote:
>> On Tue, 2006-May-09 16:03:12 +0200, Pawel Jakub Dawidek wrote:
>> 
>>>Using a USB pendrive can lead to kernel panic because of the issue
>>>mentioned in the subject.
>> 
>> 
>> See kern/78179.  Mark Tinguely and I have spent a far amount of time
>> fighting it.  We have made some improvement - bus_dmamem_alloc()
>> correctly supports BUS_DMA_NOWAIT so you get a runtime error instead
>> of a panic.  At this stage, the umass device needs to be re-written so
>> that it doesn't issue large contiguous mallocs at interrupt level.
>> The way forward would seem to be to make the USB subsystem support
>> scatter-gather (skeleton code already exists) to avoid the need for
>> contigmalloc().
>
>Yes, this is the correct solution.  Unfortunately, it looks to require a
>significant amount of code for UHCI controllers.  But then, the whole 
>point of UHCI is to have the OS do all the work anyways =-/

I'm very close to being ready to commit full scatter-gather support
for UHCI, OHCI and EHCI - I've just been very busy with other things
so haven't completed untangling it from some other changes.

A diff from my current tree is at

   http://people.freebsd.org/~iedowse/usb.diff

but I'm not sure if it works as-is, and it contains many unrelated
and unnecessary changes (e.g. EHCI_SCFLG_CURQTDBUG was a hunch that
turned out to make no difference on some problem cases I can
reproduce).

The bit I was trying to commit first is a set of EHCI changes that
make it follow the spec when adding qTDs to an existing QH, and
then get to the scatter-gather support.

Ian


More information about the freebsd-current mailing list