From: Takashi Iwai <tiwai@suse.de>
To: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>,
Linux-ALSA <alsa-devel@alsa-project.org>,
Mark Brown <broonie@linaro.org>
Subject: Re: Poor performace on mmap reading arm64 on audio device
Date: Mon, 23 Nov 2020 14:23:18 +0100 [thread overview]
Message-ID: <s5hzh388awp.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAOf5uwmtixmz+RgimC_2Z31+NwRF03RJ-u0mN3NKpzhks1dzEw@mail.gmail.com>
On Sat, 21 Nov 2020 10:40:04 +0100,
Michael Nazzareno Trimarchi wrote:
>
> Hi all
>
> I'm trying to figure out how to increase performance on audio reading
> using the mmap interface. Right now what I understand it's that
> allocation comes from core/memalloc.c ops that allocate the memory for
> dma under driver/dma.
> The reference platform I have is an imx8mm and the allocation in arm64 is:
>
> 0xffff800011ff5000-0xffff800012005000 64K PTE RW NX SHD
> AF UXN MEM/NORMAL-NC
>
> This is the reason that is allocated for dma interface.
>
> Now access linear on the multichannel interface the performance is bad
> but worse if I try to access a channel a time on read.
> So it looks like it is better to copy the block using memcpy on a
> cached area and then operate on a single channel sample. If it's
> correct what I'm saying the mmap_begin and mmap_commit
> basically they don't do anything on cache level so the page mapping
> and way is used is always the same. Can the interface be modified to
> allow cache the area during read and restore in the commit
> phase?
The current API of the mmap for the sound ring-buffer is designed to
allow concurrent accesses at any time in the minimalistic kernel-user
context switching. So the whole buffer is allocated as coherent and
mmapped in a shot. It's pretty efficient for architectures like x86,
but has disadvantages on ARM, indeed.
The mmap_begin and mmap_commit are the concepts in the alsa-lib side
for supporting the plugins better, and they doesn't represent kernel
ABI. So, this extension would be needed at first, and the memory
allocation mechanism has to be changed as well. Last but not least,
the concurrency has to be reconsidered if this approach is taken.
That said, it's possible in theory, but practically no trivial task.
thanks,
Takashi
next prev parent reply other threads:[~2020-11-23 13:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-21 9:40 Poor performace on mmap reading arm64 on audio device Michael Nazzareno Trimarchi
2020-11-23 13:23 ` Takashi Iwai [this message]
2020-11-23 13:44 ` Michael Nazzareno Trimarchi
2020-11-23 13:54 ` Takashi Iwai
2020-11-23 14:19 ` Michael Nazzareno Trimarchi
2020-11-23 14:28 ` Takashi Iwai
2020-11-23 15:15 ` Michael Nazzareno Trimarchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hzh388awp.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@linaro.org \
--cc=michael@amarulasolutions.com \
--cc=nicoleotsuka@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox