linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Cyclic DMA - callback properties and tx_status residue
Date: Thu, 10 May 2012 08:44:03 +0100	[thread overview]
Message-ID: <20120510074403.GA3190@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1336621458.1540.280.camel@vkoul-udesk3>

On Thu, May 10, 2012 at 09:14:18AM +0530, Vinod Koul wrote:
> On Wed, 2012-05-09 at 13:19 +0100, Russell King - ARM Linux wrote:
> > On Wed, May 09, 2012 at 12:16:15PM +0100, Mark Brown wrote:
> > > Looking at the code the current usage doesn't seem obviously wrong so
> > > there's some work to do - we get a callback assigned on each descriptor
> > > we submit so it's a bit surprising that this might not get delivered,
> > > though as has been discussed further up the thread that's something that
> > > might actually happen and perhaps we need to clarify the interfaces
> > > here.
> > 
> > Go back and look at my opening email in this thread.  Think about
> > the comments in include/linux/interrupt.h about the tasklet guarantees.
> > Then look at (eg) the IMX DMA engine driver and ascertain how the
> > callback is called.  Then look at soc-dmaengine-pcm's callback
> > method.
> > 
> > Put all this together and what you get is that there's absolutely no
> > guarantee that the callback will be called for each period.
> > 
> > You really won't know if it slips just one or two periods, because your
> > audio output won't be affected by that.  It _may_ only become apparant
> > if DMA catches up with the part of the buffer you're writing to.
> > 
> > Amd I'm also willing to bet that the IMX DMA engine with ASoC has only
> > been tested with an unloaded system. 
> 
> DMAengine mandates the callback be called from tasklet. Yes under a very
> heavy loaded systems there can be a certain case where callback maybe
> delayed. Or the tasklet gets scheduled _once_ for couple of dma
> completions, thus missed
> 
> But tell me what prevents the dmac driver for fixing this. In ISR they
> can easily find which descriptor is completed and mark them so.
> In tasklet, it can ensure that all callback are generated including
> previous missed ones, if that is something the usage of dmaengine needs.
> 
> For audio needs I think it is fine if we miss, as long as subsequent
> comes untill we get underrun/overrun.
> 
> Quite a few ASoC drivers use dmaengine today (cyclic was added keeping
> audio in mind), so adding library helps to avoid each ASoC driver having
> its own implementation. It indirectly ensures that APIs are properly
> implemented as well and any bugs due to deviation form std behavior gets
> identified and fixed!

I'm not going to describe the problem for a third time.  I've said what it
is.  I've pointed at the drivers which are potentially a problem.  Please
look over them and you'll see the problem.

In fact, please look at both imx-dma.c _and_ imx-sdma.c - search for
"callback" and have a look at the code around there.

You will find that imx-dma.c processes one descriptor per tasklet run,
and calls the callback under a spinlock.

You'll find that imx-sdma.c always calls callbacks from IRQ context.

  reply	other threads:[~2012-05-10  7:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 14:45 Cyclic DMA - callback properties and tx_status residue Russell King - ARM Linux
2012-05-02 16:01 ` Vinod Koul
2012-05-02 16:27   ` Russell King - ARM Linux
2012-05-04 12:26     ` Russell King - ARM Linux
2012-05-04 12:45       ` Vinod Koul
2012-05-10 22:54         ` Russell King - ARM Linux
2012-05-11  3:00           ` Vinod Koul
2012-05-11 12:24             ` Linus Walleij
2012-05-11 13:03               ` Russell King - ARM Linux
2012-05-15  5:02                 ` Vinod Koul
2012-05-09  9:27     ` Linus Walleij
2012-05-09  9:33       ` Russell King - ARM Linux
2012-05-09 11:16         ` Mark Brown
2012-05-09 12:19           ` Russell King - ARM Linux
2012-05-09 12:49             ` Lars-Peter Clausen
2012-05-09 14:03             ` Mark Brown
2012-05-10  3:44             ` Vinod Koul
2012-05-10  7:44               ` Russell King - ARM Linux [this message]
2012-05-10 10:58                 ` Vinod Koul
2012-05-10 13:19                   ` Huang Shijie
2012-05-10 14:54                     ` Vinod Koul
2012-05-10  9:42               ` Mark Brown
2012-05-10 11:01                 ` Vinod Koul
2012-05-11 14:02                   ` Mark Brown
2012-05-11 14:07                   ` Russell King - ARM Linux
2012-05-11 14:18                     ` Mark Brown
2012-05-11 14:29                       ` Russell King - ARM Linux
2012-05-11 15:07                         ` Mark Brown
2012-05-15  5:07                     ` Vinod Koul
2012-05-15  7:37                       ` Russell King - ARM Linux
2012-05-15  8:58                         ` Vinod Koul
2012-05-09 12:35       ` Lars-Peter Clausen
2012-05-07 10:40 ` Mark Brown

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=20120510074403.GA3190@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).