[alsa-devel] out of sync capture samples with MMAP on MIPS

Takashi Iwai tiwai at suse.de
Fri May 25 14:24:58 CEST 2018


On Fri, 25 May 2018 14:20:16 +0200,
Takashi Iwai wrote:
> 
> On Wed, 23 May 2018 20:36:37 +0200,
> Daniel Danzberger wrote:
> > 
> > I am using alsa's mmap() interface to capture audio samples on some AR71xx MIPS
> > devices via USB and sometimes the sampled audio sounds very disordered.
> > 
> > After debugging deeper into this issue I found that samples are fine in the
> > kernel's vmalloc'ed buffer (runtime->dma_area). But once they get accessed from
> > userspace via mmaped memory, the samples differ.
> > 
> > I wrote a module + userspace program to demonstrate the issue:
> > git at github.com:dddaniel/mmaptest.git
> > 
> > The userspace tool reads the data a couple of times with a small delay.
> > As you see below, after a couple of reads the data gets closer to look like in
> > the kernel buffer:
> > ---
> > root at OpenWrt:/# mmaptest-user
> > mmap addr: 0x77a04000
> > [  760.464968] mmap page 7573000 at va 87573000
> > check memory ...FAIL (at byte 0)
> > check memory ...FAIL (at byte 96)
> > check memory ...FAIL (at byte 96)
> > check memory ...FAIL (at byte 96)
> > check memory ...FAIL (at byte 128)
> > ---
> > 
> > Does someone here experienced similar issues ?
> 
> It's likely because of the cache coherency issue on ARM.

Err, s/ARM/MIPS/g.  The argument is valid, though :)


Takashi


More information about the Alsa-devel mailing list