All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] dmaengine: rcar-dmac: Wait for IRQs completion when freeing channel
Date: Thu, 15 Oct 2015 17:04:14 +0000	[thread overview]
Message-ID: <1488768.OAFyyvRcnS@avalon> (raw)
In-Reply-To: <1442233573-26684-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

On Wednesday 14 October 2015 13:02:22 Lars-Peter Clausen wrote:
> On 10/14/2015 12:50 PM, Vinod Koul wrote:
> > On Thu, Oct 08, 2015 at 04:51:30PM +0200, Lars-Peter Clausen wrote:
> >>> The DMA engine API states that
> >>> 
> >>>    * device_terminate_all
> >>>    
> >>>      - Aborts all the pending and ongoing transfers on the channel
> >>>      - This command should operate synchronously on the channel,
> >>>      
> >>>        terminating right away all the channels
> >>> 
> >>> I wonder how to interpret "synchronously" here, should terminate_all()
> >>> wait for termination to be complete ? In that case it wouldn't be valid
> >>> to call it from non-sleepable context.
> >> 
> >> We need to extend the DMAengine API to allow synchronization. The issue
> >> is not only the IRQ itself but also the tasklet that can be scheduled
> >> from the IRQ. Since we in some cases (e.g. audio underrun) call
> >> terminate_all() from within the completion callback that runs in the in
> >> the tasklet we can't synchronize to the tasklet in
> >> dmaengine_terminate_all(). We need a separate API call to handle this.
> >> And then maybe have a helper like dmaengine_terminate_all_sync() that
> >> terminates and synchronizes. And in cases where terminate_all is called
> >> from a context where it can't synchronize the new API needs to be called
> >> separately before freeing the resources.
> > 
> > Right now the terminate_all() is intended for syncronous behaviour which
> > prevents it from being invoked in the callback.
> 
> That does not match reality though. Which means the documentation is wrong.
> Pretty much all drivers implement a non-synchronous terminate function and
> there are users that rely on this.

Most notably audio drivers seem to call terminate_all() from a non-sleepable 
context.

"We" (volunteers needed...) need to fix the API, the callers and the drivers. 
In the meantime I'll resubmit this patch without making terminate_all() 
synchronous to avoid introducing breakages.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2015-10-15 17:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 12:26 [PATCH] dmaengine: rcar-dmac: Wait for IRQs completion when freeing channel Laurent Pinchart
2015-09-15  0:11 ` Kuninori Morimoto
2015-10-05 14:11 ` Vinod Koul
2015-10-08 14:22 ` Laurent Pinchart
2015-10-08 14:51 ` Lars-Peter Clausen
2015-10-14 10:47 ` Vinod Koul
2015-10-14 11:02 ` Lars-Peter Clausen
2015-10-15  3:52 ` Vinod Koul
2015-10-15  7:35 ` Lars-Peter Clausen
2015-10-15 17:04 ` Laurent Pinchart [this message]
2015-10-15 17:09 ` Laurent Pinchart
2015-10-15 17:15 ` Lars-Peter Clausen
2015-10-16 13:47 ` 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=1488768.OAFyyvRcnS@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-sh@vger.kernel.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 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.