All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Robert Baldyga <r.baldyga@samsung.com>, vinod.koul@intel.com
Cc: dan.j.williams@intel.com, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org, m.szyprowski@samsung.com,
	k.kozlowski@samsung.com
Subject: Re: [PATCH] dmaengine: pl330: get rid of pm_runtime_irq_safe()
Date: Fri, 10 Apr 2015 12:47:45 +0200	[thread overview]
Message-ID: <5527AA51.2090407@metafoo.de> (raw)
In-Reply-To: <55279EA2.4060108@samsung.com>

On 04/10/2015 11:57 AM, Robert Baldyga wrote:
> On 04/10/2015 10:04 AM, Lars-Peter Clausen wrote:
>> On 04/10/2015 08:57 AM, Robert Baldyga wrote:
>>> As using pm_runtime_irq_safe() causes power domain is always enabled,
>>> we want to get rid of it to reach better power efficiency. For this purpose
>>> we call pm_runtime_get()/pm_runtime_put() only in DMA channel allocate/free
>>> code. DMA channels are always requested and freed in non-atomic context,
>>> so we don't need pm_runtime_irq_safe().
>>
>> I wonder how useful this is considering that pretty much always a channel is
>> requested. I think we need an extension to the dmaengine API that allows a
>> channel consumer to notify the driver that the channel that it requested is
>> currently not in use. E.g. something like dmaengine_pm_{get,put}(struct
>> dma_chan *). These functions would have the restriction that they can only
>> be called from a non-atomic context, whereas issue_pending() and friends can
>> still be called from a atomic context. So dmaengine_pm_get() would kind of
>> be a notification that consumer intends to do something  in the near future
>> whereas dmaengine_pm_put() would be a notification that it is not going to
>> use the channel in the near future.
>>
>> E.g. for audio DMA the audio driver could call dmaengine_pm_get() when the
>> PCM device is opened and dmaengine_pm_put() when it is closed. Whereas
>> issue_pending is called when the audio is started.
>>
>
> I see. I'm considering how to do it. It would need to make changes in
> all clients, or at least doing dmaengine_pm_get() by default while
> requesting channel.
>

To maintain backwards compatibility when a channel is requested it should 
implicitly also get a reference. If the driver doesn't need the channel 
immediately it can call dmaengine_pm_put() after requesting the channel. 
This allows adding support for this to the dmaengine clients one by one 
rather than having to do it for all at once.

> However separating clock enable/disable (which can be done in atomic
> context) from runtime PM (which we prefer to use in non-atomic context)
> still seems to be good idea. While dmaengine_pm_{get,put} could be
> called when client is going to use DMA channel in near future, clock
> could be enabled on demand and disabled immediately after each
> operation. It can provide some gain, especially in cases when time
> interval between dmaengine_pm_get() and dmaengine_pm_put() is much
> longer than period when we actually are using DMA hardware.

Yes, dmaengine_pm_{get,put} would be a incremental improvement on top of 
this patch. I'm just trying to point out that doing pm_runtime_get_sync() in 
alloc_chan_resources() alone is not that effective from a runtime 
power-management point of view since you pretty much always have a channel 
requested. So you always end up with a reference and no power-saving will 
happen.

- Lars


      reply	other threads:[~2015-04-10 10:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10  6:57 [PATCH] dmaengine: pl330: get rid of pm_runtime_irq_safe() Robert Baldyga
2015-04-10  7:53 ` Krzysztof Kozlowski
2015-04-10  8:04 ` Lars-Peter Clausen
2015-04-10  9:57   ` Robert Baldyga
2015-04-10 10:47     ` Lars-Peter Clausen [this message]

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=5527AA51.2090407@metafoo.de \
    --to=lars@metafoo.de \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=r.baldyga@samsung.com \
    --cc=vinod.koul@intel.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 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.