All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: Mark Brown <broonie@kernel.org>
Cc: Joel Fernandes <joelf@ti.com>,
	alsa-devel@alsa-project.org, lars@metafoo.de
Subject: Re: Query on Audio DMA using DMAEngine
Date: Tue, 02 Jul 2013 15:40:12 +0200	[thread overview]
Message-ID: <51D2D83C.4050507@topic.nl> (raw)
In-Reply-To: <20130702121345.GL27646@sirena.org.uk>

On 07/02/2013 02:13 PM, Mark Brown wrote:
> On Tue, Jul 02, 2013 at 07:50:16AM +0200, Mike Looijmans wrote:
>> On 07/02/2013 05:33 AM, Joel Fernandes wrote:
>
>> But even with much lower loads, I got underruns when recording to SD
>> card that I couldn't really explain. I noticed that the SD transfers
>> took up a lot of DMA params (about 40), so maybe that was just
>> causing too much work for the IRQ or DMA handler routines.
>
> SD cards are generally just slow, it's possible it's just not able to
> keep up with the data you're throwing at it.  Things like batching the
> writes up into large chunks can help here but you may just be hitting a
> genuine limit if you need to record for too long and don't have enough
> fast storage (like RAM) to buffer.

What i meant by "couldn't really explain" is that I monitored CPU, 
memory and IO, and could clearly conclude that the card (or network, or 
even /dev/null on occasion) wasn't the bottleneck in itself. It's not so 
much the medium, but more the load it causes on the system that 
triggered the overruns.

>> This meant I had to use a DMA PARAM slot for every "period". The
>> OMAP L138 has 128 of those slots, so it's no problem to use a bunch
>> of them. Because the chain is cyclic, there is no need to update any
>> DMA parameter while running. All that ALSA needs to do is empty the
>> buffer before the cycle completes and the current position gets
>> overwritten.
>
> This sort of cyclic thing tends to be best, ideally you don't need
> interrupts at all (other than a timer).

Indeed. In this case, the DMA completion IRQ is still useful because the 
DMA controller issues it after the "period" data has been transferred 
completely. Just monitoring the DMA registers will tell which data is 
currently being transferred, but you can't be sure that it has actually 
been committed. So if the DMA pointer is now at 0x0100, you cannot be 
sure whether the data at 0x0100 is already valid, or even the data at 
0x0098, because that might still be in the controller's queue. The 
pointer increments when the request is sent to the queue, but there's no 
guarantee as to when the queue will actually be executed, because other 
transactions may have higher priority.

Mike.

  reply	other threads:[~2013-07-02 13:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <083BC63EECB6FD41B8E81CF7FD87CC0F2E4F1488@DLEE08.ent.ti.com>
2013-06-30 12:06 ` Query on Audio DMA using DMAEngine Lars-Peter Clausen
2013-07-01  6:10   ` Mike Looijmans
2013-07-02  1:28     ` Joel Fernandes
2013-07-02  6:02       ` Mike Looijmans
2013-07-02 12:16         ` Mark Brown
2013-07-02 13:30           ` Mike Looijmans
2013-07-02 14:58             ` Mark Brown
2013-07-04 11:00       ` Clemens Ladisch
2013-07-02  3:33     ` Joel Fernandes
2013-07-02  5:50       ` Mike Looijmans
2013-07-02 12:13         ` Mark Brown
2013-07-02 13:40           ` Mike Looijmans [this message]
2013-07-03  9:09           ` Lars-Peter Clausen
2013-07-03  9:43             ` Mark Brown
2013-07-03 13:17               ` Mike Looijmans
     [not found]                 ` <51D4245F.8070307-Oq418RWZeHk@public.gmane.org>
2013-07-03 19:56                   ` Joel Fernandes
     [not found]               ` <20130703094307.GE27646-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-07-03 17:55                 ` [alsa-devel] " Joel Fernandes
     [not found]                   ` <51D46598.6070005-l0cyMroinI0@public.gmane.org>
2013-07-03 18:12                     ` Mark Brown
2013-07-04  5:56                       ` Mike Looijmans
2013-07-04 10:49                         ` Mark Brown
2013-07-03 18:18                   ` [alsa-devel] " Joel Fernandes
2013-07-04  6:06                   ` Mike Looijmans
2013-07-04 10:53                     ` Mark Brown
     [not found]                     ` <51D510EA.1030809-Oq418RWZeHk@public.gmane.org>
2013-07-04 10:59                       ` [alsa-devel] " Sekhar Nori
2013-08-14  4:30         ` Joel Fernandes
2013-08-14  4:53           ` Joel Fernandes
2013-08-14 14:10             ` Mike Looijmans
2013-08-14 12:06           ` Mark Brown
2013-07-02  1:04   ` Joel Fernandes
2013-07-03  9:07     ` Lars-Peter Clausen

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=51D2D83C.4050507@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=joelf@ti.com \
    --cc=lars@metafoo.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.