From: Takashi Iwai Subject: Re: out of sync capture samples with MMAP on MIPS Date: Fri, 25 May 2018 14:24:58 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BF0E8267663 for ; Fri, 25 May 2018 14:24:58 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Daniel Danzberger Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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@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@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