Re: [alsa-devel] USB transfer_buffer allocations on 64bit systems
From: Alan Stern
Date: Tue May 11 2010 - 12:06:16 EST
On Wed, 12 May 2010, FUJITA Tomonori wrote:
> > > Can you tell me all the exact process of DMA that the usb core and the
> > > driver do?
> >
> > 1. The audio driver stores data in urb->transfer_buffer.
>
> How urb->transfer_buffer is allocated?
By kmalloc(). Right, Daniel?
> > 2. The audio driver calls usb_submit_urb(urb).
> >
> > 3. The USB core does
> > urb->transfer_dma = dma_map_single(controller,
> > urb->transfer_buffer,
> > urb->transfer_buffer_length,
> > DMA_TO_DEVICE);
>
> The mapping error is checked via dma_mapping_error? Even if an mapping
> error happens, no data corruption happens due to that (needs
> something like retrying the request)?
Yes, we check dma_mapping_error(). If there's an error then the
submission fails, and presumably this failure would be logged by the
audio driver.
> > 4. The host controller driver tells the hardware to carry out the data
> > transfer.
> >
> > 5. When the hardware says the transfer is finished, the USB core does
> > dma_unmap_single(controller,
> > urb->transfer_dma,
> > urb->transfer_buffer_length,
> > DMA_TO_DEVICE);
> >
> > 6. The audio driver's completion handler is called:
> > (urb->complete)(urb);
>
> The driver does only DMA_TO_DEVICE? Or you see DMA problems only with
> DMA_TO_DEVICE?
The particular test that Pedro is running uses audio output only --
he's sending sound data to a speaker and it comes out noisy.
But the audio data has to come from somewhere, and I don't remember
where. Pedro, does the noise occur only when you're playing sound that
comes from a different USB device? What happens if you play sounds
that are stored on your hard disk, like an MP3 file?
Or what happens if you take the incoming sound data and store it in a
disk file, and then later play that file out through the speaker?
Alan Stern
--
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/