Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3714630ybl; Mon, 3 Feb 2020 05:16:54 -0800 (PST) X-Google-Smtp-Source: APXvYqxeYJU3/eJDQhFSX4IYGLzi/t6fFGwkOH5kFB9rii8ZXTh7X5yjkvKodldSebyVtLb5WV5a X-Received: by 2002:a05:6808:315:: with SMTP id i21mr13959145oie.139.1580735814271; Mon, 03 Feb 2020 05:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580735814; cv=none; d=google.com; s=arc-20160816; b=pxDoELW98ivSY21KhZL+nQEXCzmOEhg1QCHCLrCwNGIX02ePtFSPtUUR1vb4numVkj T2KRct/F9TE1NGPrJEWho1fDC+xQ7YjNH31nNkWF5IX/aDgCSsJCb68SGHCmTt8AuxXV X3905vGgcdfltJ6FvralZY88FwEVc+DUHFIw9ixFQr9nnJwxIHjFV1P0cpTISCKz9qhp VvocrBKBh6TmcLBsN+Z+DQpj80p3zVN01uJiGn0AlyyoPdEjgxoAwssEmklaj1G5qEQp KFG6Pa9z1nHBBbzHqKXaK0YyJ4qg9El1yP+zlw0lNClybKMSvxvsLPMJEQmij7oNmy+A xr8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ceXnFZ7jddmETXXwdfs4mGpj+O00W2KY/YQ322nXt4U=; b=npNqEG65k9oOaNZdplnrGjfNyql5tivpPXCTYMpOSLR6P4xfEpTCUdcJwhUaiFCNjD 4fI+o/72cj1TPd137o7+P4j20NMt4zNcnGOcl5Vqo6Qdh0ZrVXjVyn4EGPG4xIklE2LG LJ/WSl6434YiEOMFx5kiXKvYBuTxyOltAnJmXxh92LrG7iQxkdy5vg7cKnpHC29yLLZL M+LSVgHuhfCsOl6vsMPvp+oGAK0tvJucCGezQK0wyvLbXqe3uvncLUhJUmUxV/DYIRrI gLfVOHSbRbDJV1isTPupG3K7u3+j4YGTsYHaQe8u+nLoM8Rg1lcxrnoLypSoYQsGBg+E Jvyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=qXuwCM2r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q189si506749oic.235.2020.02.03.05.16.41; Mon, 03 Feb 2020 05:16:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=qXuwCM2r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727856AbgBCLhv (ORCPT + 99 others); Mon, 3 Feb 2020 06:37:51 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:19133 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgBCLhu (ORCPT ); Mon, 3 Feb 2020 06:37:50 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 03 Feb 2020 03:37:35 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 03 Feb 2020 03:37:50 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 03 Feb 2020 03:37:50 -0800 Received: from [10.26.11.224] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 3 Feb 2020 11:37:47 +0000 Subject: Re: [PATCH v6 11/16] dmaengine: tegra-apb: Keep clock enabled only during of DMA transfer To: Dmitry Osipenko , Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= CC: , , References: <20200130043804.32243-1-digetx@gmail.com> <20200130043804.32243-12-digetx@gmail.com> <2442aee7-2c2a-bacc-7be9-8eed17498928@nvidia.com> <0c766352-700a-68bf-cf7b-9b1686ba9ca9@gmail.com> <315241b5-f5a2-aaa0-7327-24055ff306c7@nvidia.com> <1b64a3c6-a8b9-34d7-96cc-95b93ca1a392@gmail.com> From: Jon Hunter Message-ID: <423eb28f-b5fc-c917-a7b2-72562183683f@nvidia.com> Date: Mon, 3 Feb 2020 11:37:44 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1580729856; bh=ceXnFZ7jddmETXXwdfs4mGpj+O00W2KY/YQ322nXt4U=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=qXuwCM2rJ8br+WfWyobe/MOBDj1SnQ+sqtC2P5uvgpRUccqPpupsIKKpULWJuCtQy 6+QbNlZX687vt/qhOmx92gy1Pw3v7rccOBTqUiXn8aSGPyXtGngyhgs/b4F70poRYT HflYyjxCPZzn3obut9ctKGikXHbRtlIn2F/Gl9YHEdaZnc/fVJUbCCEc4t5ywtcCHT tjAk/8johzjzyOG9rnIKLdMoqAyLTOAN1mgi0zhYljIfFsCZRsZVUwTW++WsiNqgAH JiRUMU80FPLJEYHqhP2uynEgr2Gi/RKZazoeeDHl/eWOEztujVleq0XhrIEdFle+7g v+rjTZC4ZZUpQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/02/2020 15:13, Dmitry Osipenko wrote: > 31.01.2020 17:22, Dmitry Osipenko =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> 31.01.2020 12:02, Jon Hunter =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >>> >>> On 30/01/2020 20:04, Dmitry Osipenko wrote: >>> >>> ... >>> >>>>>> The tegra_dma_stop() should put RPM anyways, which is missed in your= s >>>>>> sample. Please see handle_continuous_head_request(). >>>>> >>>>> Yes and that is deliberate. The cyclic transfers the transfers *shoul= d* >>>>> not stop until terminate_all is called. The tegra_dma_stop in >>>>> handle_continuous_head_request() is an error condition and so I am no= t >>>>> sure it is actually necessary to call pm_runtime_put() here. >>>> >>>> But then tegra_dma_stop() shouldn't unset the "busy" mark. >>> >>> True. >>> >>>>>> I'm also finding the explicit get/put a bit easier to follow in the >>>>>> code, don't you think so? >>>>> >>>>> I can see that, but I was thinking that in the case of cyclic transfe= rs, >>>>> it should only really be necessary to call the get/put at the beginni= ng >>>>> and end. So in my mind there should only be two exit points which are >>>>> the ISR handler for SG and terminate_all for SG and cyclic. >>>> >>>> Alright, I'll update this patch. >>> >>> Hmmm ... I am wondering if we should not mess with that and leave how >>> you have it. >> >> I took another look and seems my current v6 should be more correct becau= se: >> >> 1. If "busy" is unset in tegra_dma_stop(), then the RPM should be put >> there since tegra_dma_terminate_all() won't put RPM in this case: >> >> if (!tdc->busy) >> goto skip_dma_stop; >> >> 2. We can't move the "busy" unsetting into the terminate because then >> tegra_dma_stop() will be invoked twice. Although, one option could be to >> remove the tegra_dma_stop() from the error paths of >> handle_continuous_head_request(), but I'm not sure that this is correct >> to do. >=20 > Jon, I realized that my v6 variant is wrong too because > tegra_dma_terminate_all() -> tdc->isr_handler() will put RPM, and thus, > the RPM enable-count will be wrecked in this case. Did you see my other suggestion to move the pm_runtime_put() outside of tegra_dma_stop? There are only a few call sites for tegra_dma_stop and so if we call pm_runtime_put() after calling tegra_dma_stop this should simplify matters. Jon --=20 nvpublic