From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752050Ab1H3HMN (ORCPT ); Tue, 30 Aug 2011 03:12:13 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:65180 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224Ab1H3HML (ORCPT ); Tue, 30 Aug 2011 03:12:11 -0400 Date: Tue, 30 Aug 2011 09:12:07 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Vinod Koul cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Dan Williams , Paul Mundt Subject: Re: [PATCH] dma: shdma: transfer based runtime PM In-Reply-To: <1314622113.1606.134.camel@vkoul-udesk3> Message-ID: References: <1314282386.1606.42.camel@vkoul-udesk3> <1314283286.1606.52.camel@vkoul-udesk3> <1314292850.1606.88.camel@vkoul-udesk3> <1314619909.1606.130.camel@vkoul-udesk3> <1314622113.1606.134.camel@vkoul-udesk3> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Provags-ID: V02:K0:ziIlIFzrNdwfE/PvaTAz+FljZc+lwVn+lRjZOVoQLOq UoAvkf7YghD5qqm4ypPKEzxt/wjG7TaK+OY8+YQ4O8Utx0U+HK WGenveorpWPazLUVbIMfebueSGEy/YnVMQJuWH50zGEMUf+eaI xsRdC5C0XOq5sNuJ6tSvXfPg6dWoVehKZSw+w/Svo3ioRLASr4 OQ5CdCweFtjub8WaJQ3CqwgdDwyrWKnyeZEF8JV0DCUHG5/2kI 8ju1BYMK/0BwvtePBhhB9AbzKOlF6lfQmLC3B02Z3X36HCGQ/2 GmMwHtNGY5sW67ntKRAanAJKDcEFAQmG9mKlXVOyTCM9hprhtL 1OaPafJN+VA6aXMoYdVRI8uxMW2irsjoCCLnN7+sf22vyHkpcc 3H1qwtKIjtRQQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 Aug 2011, Vinod Koul wrote: > On Mon, 2011-08-29 at 14:21 +0200, Guennadi Liakhovetski wrote: > > On Mon, 29 Aug 2011, Vinod Koul wrote: > > > > > On Fri, 2011-08-26 at 01:11 +0200, Guennadi Liakhovetski wrote: > > > > On Thu, 25 Aug 2011, Koul, Vinod wrote: > > > > > Wont it be easy to to do: > > > > > - pm_runtime_get() in each submit > > > > > - pm_runtime_put() in each callback > > > > > Normal case above would work just fine > > > > > - In terminate case, count the number of issued transactions, and call > > > > > pm_runtime_put() for each canceled transaction > > > > > (i am assuming that for each timeout error, the client will call > > > > > terminate) > > > > > > > > As I said, this won't be very easy to do this in a robust way. You'd have > > > > to scan your list of DMA blocks and see, which of them belong to one > > > > descriptor, and once you reach the end of that descriptor, issue a put(). > > > > Perhaps, this can be done, but my choice went to the currently presented > > > > solution. > > > If you count the number of descriptor submitted in your submitted list > > > and call _put for each, I see no reason why it wont be simple and better > > > than current approach. > > > > Sorry, I thought, you wanted to avoid extra counting, because runtime-pm > > counts by itself. Now you propose to count... > see below it doesn't count but iterate thru list Yes, sorry, iterating is a better word, but I actually meant "counting" in a broad sense, of which "iterating" is a particular case:-) > > > Something like: > > > /* since callback is set for last descriptor of chain, we call runtime > > > * put for that desc alone > > > */ > > > list_for_each_entry_safe(desc, __desc, sh_chan->ld_queue, node) { > > > if (desc->async_tx.callback) > > > pm_runtime_put(device); > > > > Not all dma users have callbacks. > Do you have such usage today, at least I dont :) > Nevertheless, in tx_submit adding a simple flag in your drivers > descriptor structure can tell you whether to call _put() or not. Agreed? Yes, I agree, that one could make this work too. Still, I do not understand how and why this is better to the extent, that I have to reimplement my patch, retest and resubmit it. Maybe Dan or Paul have an opinion on this? Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/