Subject: kern/19803: usbd_alloc_buffer fails often
To: None <>
From: None <>
List: netbsd-bugs
Date: 01/12/2003 12:21:56
>Number:         19803
>Category:       kern
>Synopsis:       usbd_alloc_buffer fails often
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 11 19:23:00 PST 2003
>Originator:     IWAMOTO Toshihiro
>Release:        NetBSD 1.6L
System: NetBSD 1.6L NetBSD 1.6L (PEPPER) #111: Sat Jan 11 00:53:18 JST 2003 i386
Architecture: i386
Machine: i386
	umass ATTACH and ulpt_do_write need to allocate some memory,
	but this fails often.  See kern/19326 for the umass case.
	For ulpt, write(2) returns ENOMEM.

	Use enough memory (using X with gnome, emacs, mozilla... seems to
	be enough for my system (with 512M ram)) so that kernel memory
	allocation fails.
	Then plug a umass device or try to print something through ulpt.

	Then terminate mozilla to free some memory and try again. They
	should work.
	usbd_alloc_buffer calls ohci_allocm to allocate memory,
	which after all calls bus_dmamem_alloc(..., BUS_DMA_NOWAIT) in
	(This is my speculation and I haven't confirmed. Memory allocation
	 failures might be happening elsewhere.)

	I guess bus_dmamem_alloc with BUS_DMA_WAITOK would fix this problem,
	but doing this isn't trivial for me.