linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 5/6] dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver
Date: Thu, 28 Aug 2014 07:22:53 +0000	[thread overview]
Message-ID: <20140828071053.GK13288@intel.com> (raw)
In-Reply-To: <7ae1dbb4f4a79a529250600cc2eeb7c31a644938.1406766014.git.horms+renesas@verge.net.au>

On Wed, Aug 20, 2014 at 07:27:32PM +0200, Laurent Pinchart wrote:

> > > > >>> +static size_t rcar_dmac_chan_get_residue(struct rcar_dmac_chan
> > > > >>> *chan,
> > > > >>> +					 dma_cookie_t cookie)
> > > > >>> +{
> > > > >>> +	struct rcar_dmac_desc *desc = chan->desc.running;
> > > > >>> +	struct rcar_dmac_hw_desc *hwdesc;
> > > > >>> +	size_t residue = 0;
> > > > >>> +
> > > > >>> +	if (!desc)
> > > > >>> +		return 0;
> > > > >> 
> > > > >> Why?
> > > > >> We should be able to query even when channel is not running, right?
> > > > > 
> > > > > Good question, should we ? :-)
> > > > > 
> > > > > This would require going through all lists to find the descriptor
> > > > > corresponding to the cookie, and returning either 0 (if the descriptor
> > > > > has
> > > > > been processed completely) or the descriptor length (if it hasn't been
> > > > > processed yet). This is potentially costly.
> > > > 
> > > > Not really, the status of descriptor will tell you.
> > > > 
> > > > > The first case can be easily handled using the cookie only, when
> > > > > dma_cookie_status() state returns DMA_COMPLETE then we know that the
> > > > > residue is 0. This is actually the current behaviour, as
> > > > > dma_cookie_status() zeroes the residue field.a
> > > > 
> > > > yes this is the key
> > > > 
> > > > > Is the second case something we need to support ? chan->desc.running
> > > > > is only NULL when there's no descriptor to process. In that case the
> > > > > cookie can either correspond to a descriptor already complete (first
> > > > > case), a descriptor prepared but not submitted or an invalid
> > > > > descriptor (in which case we can't report the residue anyway). Is
> > > > > there really a use case for reporting the residue for a descriptor not
> > > > > submitted ? That seems like a bad use of the API to me, I think it
> > > > > would be better to forbid it.
> > > > 
> > > > So you need to check only running list. For the queued up descriptor it
> > > > is easy enough. For the one which is running you are already doing the
> > > > calculation. For completed but still not preocessed it is zero anyway
> > > 
> > > I'm still not convinced. Reporting the residue for a descriptor that
> > > hasn't been started yet will require looping through lists with locks
> > > held, and I'm not sure to see what benefit it would bring. Do we have DMA
> > > engine users that retrieve (and use) the residue value of descriptors that
> > > haven't been started yet ?
> > 
> > well for the descriptor not started you have only one list to look.
> 
> Two of them actually, the pending (submitted but not issued) and the active 
> list. But regardless of whether that would be one or two lists, it would still 
> involve looping over descriptors with a lock held. If there's no use case for 
> this on the caller side, I'd rather not implement dead code.
But you can reduce that to 1 by keeping tracked of submitted desciptor
number along with completed we do now

Well its not about dead code, but about API expects, since API allows
it we should put restrictionss. If people use ut rarely then we dont need to
worry about performance on this one

-- 
~Vinod
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 

  parent reply	other threads:[~2014-08-28  7:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31  0:34 [PATCH 5/6] dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver Simon Horman
2014-07-31 11:56 ` Vinod Koul
2014-08-04 16:30 ` Laurent Pinchart
2014-08-05 16:59 ` Vinod Koul
2014-08-05 23:35 ` Laurent Pinchart
2014-08-06  8:46 ` Geert Uytterhoeven
2014-08-06 12:47 ` Geert Uytterhoeven
2014-08-06 15:36 ` Laurent Pinchart
2014-08-19 16:06 ` Vinod Koul
2014-08-20 17:27 ` Laurent Pinchart
2014-08-28  7:22 ` Vinod Koul [this message]
2014-08-28 16:39 ` Laurent Pinchart

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=20140828071053.GK13288@intel.com \
    --to=vinod.koul@intel.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 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).