From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932443AbbDJJ6B (ORCPT ); Fri, 10 Apr 2015 05:58:01 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:57285 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754161AbbDJJ57 (ORCPT ); Fri, 10 Apr 2015 05:57:59 -0400 X-AuditID: cbfec7f4-b7f106d0000013ec-d1-55279df68326 Message-id: <55279EA2.4060108@samsung.com> Date: Fri, 10 Apr 2015 11:57:54 +0200 From: Robert Baldyga User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-version: 1.0 To: Lars-Peter Clausen , 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() References: <1428649045-26444-1-git-send-email-r.baldyga@samsung.com> <552783F8.2080506@metafoo.de> In-reply-to: <552783F8.2080506@metafoo.de> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKLMWRmVeSWpSXmKPExsVy+t/xa7rf5qqHGiybo2ExfeoFRovVU/+y Wrx+YWixZPJ8VovLu+awWaw9cpfd4mXffhYHdo/Fe14yeSx5c4jVo2/LKkaPz5vkAliiuGxS UnMyy1KL9O0SuDKmnrvPXPBRoGLNrtNsDYwPeLsYOTkkBEwkfrefZYOwxSQu3FsPZHNxCAks ZZRYvGUNI4TzkVHiz/23jCBVvAJaElcX3mQHsVkEVCVWrtoL1s0moCOx5fsEoBoODlGBCInb lzkhygUlfky+xwISFhGwk/jdYAQyklmgi1Hi6d+PYK3CAu4Sby7fBbOFBFIlek7NYAaxOYFW Xfq0nhWkl1lAT+L+RS2QMLOAvMTmNW+ZJzAKzEKyYRZC1SwkVQsYmVcxiqaWJhcUJ6XnGuoV J+YWl+al6yXn525ihAT1lx2Mi49ZHWIU4GBU4uENMFYPFWJNLCuuzD3EKMHBrCTC+7cFKMSb klhZlVqUH19UmpNafIiRiYNTqoGxbqKFwMOSP3Kzs/PeHniyfZXB1SksiX83pvk9O3V9ftgv mY/K2fGqQjM/exZUN/CxKq2Z8NqNOWdK4+zdtkY7zu80z6v6WDD1hOFxx+/5u1bP/TDPy899 rXnPkZdPlK1uXGGstf9gsr9Xe1rk91b5l17PXTcoJjdXXU4PPVXcI+z0KWDyumUFSizFGYmG WsxFxYkAe6Va8UgCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. Thanks, Robert Baldyga