Re: USB transfer_buffer allocations on 64bit systems

Previous thread: [ANNOUNCE] Git 1.7.1.rc0 by Junio C Hamano on Wednesday, April 7, 2010 - 8:05 am. (1 message)

Next thread: Re: Memory policy question for NUMA arch.... by Rick Sherm on Wednesday, April 7, 2010 - 8:48 am. (2 messages)
From: Alan Stern
Date: Wednesday, April 7, 2010 - 8:46 am

No.  It says so right in the title line of the kerneldoc:

 * usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP


All right.  But there would have to be _two_ new functions: one acting 
like kmalloc and another acting like kzalloc.  I guess they should take 

There is one awkward aspect of usb_buffer_alloc which perhaps could
be fixed at the same time.  Under some conditions (for example, if the
controller needs to use internal bounce buffers) it will return
ordinary memory obtained using kmalloc rather than consistent memory.  
But it doesn't tell the caller when it has done so, and consequently
the caller will always specify URB_NO_TRANSFER_DMA_MAP when using the
buffer.  The proper flag to use should be returned to the caller.

Or alternatively, instead of allocating regular memory the routine
could simply fail.  Then the caller would be responsible for checking
and using regular memory instead of dma-consistent memory.  Of course,
that would put an even larger burden on the caller than just forcing it

I guess we could rename usb_buffer_alloc().  A more accurate name would
be something like usb_alloc_consistent() (except for the fact that
the routine falls back to regular memory if the controller can't use
consistent memory.)  Then we could have usb_malloc() and usb_zalloc()
in addition.

Alan Stern

--

From: Oliver Neukum
Date: Wednesday, April 7, 2010 - 11:12 pm

Then it would be sensible to pass it a filled URB, modify it or return
an error code.

	Regards
		Oliver
--

Previous thread: [ANNOUNCE] Git 1.7.1.rc0 by Junio C Hamano on Wednesday, April 7, 2010 - 8:05 am. (1 message)

Next thread: Re: Memory policy question for NUMA arch.... by Rick Sherm on Wednesday, April 7, 2010 - 8:48 am. (2 messages)