From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1527CA9EB9 for ; Wed, 23 Oct 2019 21:49:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94C4921906 for ; Wed, 23 Oct 2019 21:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405702AbfJWVtO (ORCPT ); Wed, 23 Oct 2019 17:49:14 -0400 Received: from muru.com ([72.249.23.125]:39646 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390165AbfJWVtO (ORCPT ); Wed, 23 Oct 2019 17:49:14 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 09F8280CF; Wed, 23 Oct 2019 21:49:45 +0000 (UTC) Date: Wed, 23 Oct 2019 14:49:08 -0700 From: Tony Lindgren To: Grygorii Strashko Cc: Peter Ujfalusi , Dan Williams , Vinod Koul , Alexandre Bailon , Andy Shevchenko , Bin Liu , Daniel Mack , Felipe Balbi , Johan Hovold , Sekhar Nori , Sebastian Andrzej Siewior , Sergei Shtylyov , dmaengine@vger.kernel.org, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, giulio.benetti@benettiengineering.com, Sebastian Reichel , Skvortsov , Yegor Yefremov Subject: Re: [PATCH] dmaengine: cppi41: Fix cppi41_dma_prep_slave_sg() when idle Message-ID: <20191023214908.GU5610@atomide.com> References: <20191023153138.23442-1-tony@atomide.com> <245e1e8f-7933-bae1-b779-239f33d4d449@ti.com> <20191023171628.GO5610@atomide.com> <5deab8a9-5796-5367-213e-90c5961b8498@ti.com> <20191023191859.GQ5610@atomide.com> <7d578fe1-2d60-4a6e-48b0-73d66c39f783@ti.com> <20191023201829.GR5610@atomide.com> <20191023212734.GT5610@atomide.com> <78bf336e-8078-df79-2e3e-42c6cf8a3ae8@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78bf336e-8078-df79-2e3e-42c6cf8a3ae8@ti.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org * Grygorii Strashko [191023 21:43]: > > > On 24/10/2019 00:27, Tony Lindgren wrote: > > * Grygorii Strashko [191023 20:56]: > > > On 23/10/2019 23:18, Tony Lindgren wrote: > > > > And no, adding pm_runtime_get_sync() to issue_pending is not > > > > a solution. There may be clocks and regulators that need to > > > > be powered up, and we don't want to use pm_runtime_irq_safe() > > > > because of the permanent use count on the parent. > > > > > > 5 cents. > > > > > > I think the right thing might be to get rid of pm_runtime_xxx() > > > in cppi41_dma_issue_pending(). So overall approach will be: > > > > > > - new job -> cppi41_dma_prep_slave_sg() -> pm_runtime_get() > > > - issue_pending: fill backlog if suspended or run_queue if active (pm_runtime_active()) > > > - job done: dmaengine_desc_get_callback_invoke() -> > > > > > > dmaengine_desc_get_callback_invoke(); > > > pm_runtime_mark_last_busy(cdd->ddev.dev); > > > pm_runtime_put_autosuspend(cdd->ddev.dev); > > > in all places. > > > > > > It even might allow to get rid of cdd->lock. > > > > Well I don't think cppi41_dma_prep_slave_sg() is necessarily > > paired with anything currently. > > It should - dma cmpletion callbacks have to be called somewhere. Well what I meant is there's no guarantee that we have cppi41_dma_issue_pending() followed by cppi41_dma_prep_slave_sg() currently :) > This can potentially leading > > to pm_runtime_get() called multiple times? > > That's the idea - increase pm_counter as many times as jobs submitted. Right, but that needs to be done in a paired manner so the API is clear to everyone and does not lead into unpaired PM runtime calls. Regards, Tony