Re: [PATCH] 6fire: fix URB transfer buffer for midi output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 7 Aug 2013, Takashi Iwai wrote:

> [Cc'ed to linux-usb ML]
> 
> At Wed, 7 Aug 2013 16:51:49 +0200,
> Torsten Schenk wrote:
> > 
> > Patch fixes URB transfer buffer allocation for midi output to be DMA-able.
> 
> Is this really needed?
> That is, can't a transfer buffer be at middle of kmalloc'ed space, but
> must be always the head of the kmalloc'ed space?

A buffer _can_ be in the middle of a kmalloc'ed space, but the CPU must
not access any of the fields around it that might occupy the same cache
line while the buffer is being used for DMA.  In general, it's safest
not to put any other data in the same kmalloc'ed region with a DMA
buffer.

> > @@ -32,7 +28,7 @@
> >  	struct snd_rawmidi_substream *out;
> >  	struct urb out_urb;
> >  	u8 out_serial; /* serial number of out packet */
> > -	u8 out_buffer[MIDI_BUFSIZE];
> > +	u8 *out_buffer;
> >  	int buffer_offset;

In this case, the CPU would access out_urb while out_buffer was in use.

Alan Stern

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux