Re: Bugs in usb-skeleton.c??? :)

From: Arjan van de Ven
Date: Thu Jul 13 2006 - 08:59:10 EST


On Thu, 2006-07-13 at 16:33 +0400, Sergej Pupykin wrote:
> >> As I understand, USB subsystem uses urb->transfer_buffer directly with
> >> DMA. I see that usb-skeleton.c and (at least) bluez's hci_usb allocates it
> >> without GFP_DMA flag. (skeleton with GFP_KERNEL, bluez with GFP_ATOMIC)
>
> AvdV> I think GFP_DMA means something different than that you think it means.
> AvdV> GFP_DMA is a bad old hack that means "this is for ISA bus cards to DMA
> AvdV> to/from". Since there are no ISA bus USB controllers... the USB code
> AvdV> doesn't need to use GFP_DMA.
>
> Does kmalloc always allocate pages that can be used in DMA?

normally yes. HOWEVER....
>
> I see pci_map_single gives address that incremented later without page
> boundary checking. Are allocated pages sequented? (usb-ohci.c)

..it is nicer to use the DMA allocation API (which internally may fall
back to kmalloc etc), while kmalloc may work, it can be quite slow in
how it's made to work. So it's just nicer to just use the DMA memory
allocators... (see Documentation/DMA-API.txt file for a description of
this)

Greetings,
Arjan van de Ven

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/