Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp921354pxb; Fri, 22 Apr 2022 14:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw954IwYlUYanQ6fq+p0wngLpOK8kabmsv/lHEiTGUTpYs+nb4e955hWhtGL8gO5onvG5rt X-Received: by 2002:a17:902:b488:b0:156:509c:5c42 with SMTP id y8-20020a170902b48800b00156509c5c42mr6585976plr.2.1650662498181; Fri, 22 Apr 2022 14:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650662498; cv=none; d=google.com; s=arc-20160816; b=y+jlfo85lhrEGawbMosFcz5a1DWAxxTsG6z683oQ4ZDtyRRHvKYIHj1n7ymaXhisit Q6aZSl5f0+kAEaHayQp0Kv5Mmhdj0RiQn+Nfa6PcHOufdbx96KkF9MNDqEFnoW7UBwI8 Ow9gDEUI55KfX9ZrKuW7VqjDiY9S6sZT1GUtTNarYWUmanU8QmA6exrJuTQfGvI09JB0 IRKf7vfO55x3NZapXl6Zp3SiWTJemvdhSUBUQ+IqWPP1nKeXLTiP1YTS9BFa9OXykQSs IZ9vqB3q9nn0uLraJ4jjui/9rvNl/jVMmVK4z4XZSyJYiR05M+rSNbnPV2WZyCo/MG5y TxIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aPuDq0SOf6YeNshZRkp5se52vX2JxZYjApiQb2qL7rU=; b=UTPNcvKPV5AsOzANx5kBRDnzFx1aoNiOgpFdtLBeLJM9n4URRT7FSLn6S5Qrv8ol5/ fiS9zV5jfI8VtGR3+N65No6DWHdp/UkOjKwN6E8/5ATUde7rheyMxZOUbdm+aPbvSJW1 uEdFW7FGw693gU3bVuD5dl+f74U7yLuWS+KpDcN9jm6VEaf/qF1foOzSU3oPD3PVoKK2 kXpFv93Enhvr2GC/6gbtYHEB1Bgst4q0PbhdlhdXmxv7yXuizy/R2+NGIjSUF9Gga+eT XQTKnSViJvHgE/6C3A4hjLW5LpykrblAo2Jfjp0+zjtJRS8cbUeXmrTXBwsB4wBb6hEj F5Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tO+Ksg7T; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l7-20020a655607000000b003817d61f02csi9434685pgs.624.2022.04.22.14.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:21:38 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tO+Ksg7T; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C62E1A1DAC; Fri, 22 Apr 2022 12:29:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377556AbiDTKSh (ORCPT + 99 others); Wed, 20 Apr 2022 06:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377524AbiDTKSf (ORCPT ); Wed, 20 Apr 2022 06:18:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CF506415; Wed, 20 Apr 2022 03:15:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6AB14B81DD6; Wed, 20 Apr 2022 10:15:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D248C385A0; Wed, 20 Apr 2022 10:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650449747; bh=I2X20qgTvj1B6zHaXLwcUVeCqOXjvFSsK098pm/tD9E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tO+Ksg7TqAf+MuBMvxybw77DUg0RCFRYuRpcCRnA8161LhE3uHnSA0mCslgthPXGU JE9eSszL0zEzq0fTeS3/dCyyjufVhTp2r1OCRW+6rE5D4MER/Bcbi50LieecV0bD90 W79VR6huVSk7UkJHaD47y1jqv0JipNxbvApR+TLJnGAPzQaKgnFUgZtgbCv7oIinr1 low6elIUCKF6aqnI4J91666OrnaZmJZWF3er5XECcPGVEFEzX69vLZbws/wajmx5z7 1UGpcoCprI4wFP4GCM3nUOylMttVlD9TOHOwoOXFBmR9RSeva9Ekjp/zX/V0fWOx+i ldDpscv9mgBAg== Date: Wed, 20 Apr 2022 15:45:42 +0530 From: Vinod Koul To: sugar zhang Cc: Huibin Hong , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: pl330: Fix unbalanced runtime PM Message-ID: References: <1648296988-45745-1-git-send-email-sugar.zhang@rock-chips.com> <5f13aa47-92cd-6c71-66f5-c5513a36b277@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5f13aa47-92cd-6c71-66f5-c5513a36b277@rock-chips.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-04-22, 21:53, sugar zhang wrote: > Hi Vinod, > > 在 2022/4/11 21:48, Vinod Koul 写道: > > On 26-03-22, 20:16, Sugar Zhang wrote: > > > This driver use runtime PM autosuspend mechanism to manager clk. > > > > > > pm_runtime_use_autosuspend(&adev->dev); > > > pm_runtime_set_autosuspend_delay(&adev->dev, PL330_AUTOSUSPEND_DELAY); > > > > > > So, after ref count reached to zero, it will enter suspend > > > after the delay time elapsed. > > > > > > The unbalanced PM: > > > > > > * May cause dmac the next start failed. > > > * May cause dmac read unexpected state. > > > * May cause dmac stall if power down happen at the middle of the transfer. > > > e.g. may lose ack from AXI bus and stall. > > > > > > Considering the following situation: > > > > > > DMA TERMINATE TASKLET ROUTINE > > > | | > > > | issue_pending > > > | | > > > | pch->active = true > > > | pm_runtime_get > > > pm_runtime_put(if active) | > > > pch->active = false | > > > | work_list empty > > > | | > > > | pm_runtime_put(force) > > maybe unconditional is a better word than force here? > okay, will do in v2. > > > > > | | > > > > > > At this point, it's unbalanced(1 get / 2 put). > > > > > > After this patch: > > > > > > DMA TERMINATE TASKLET ROUTINE > > > | | > > > | issue_pending > > > | | > > > | pch->active = true > > > | pm_runtime_get > > > pm_runtime_put(if active) | > > > pch->active = false | > > > | work_list empty > > > | | > > > | pm_runtime_put(if active) > > > | | > > > > > > Now, it's balanced(1 get / 1 put). > > > > > > Fixes: > > > commit 5c9e6c2b2ba3 ("dmaengine: pl330: Fix runtime PM support for terminated transfers") > > > commit ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12") > > That is not the right way for Fixes tag > > like this? > > Fixes: 5c9e6c2b2ba3 ("dmaengine: pl330: Fix runtime PM support for terminated transfers") > Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12") yes, this is the correct way -- ~Vinod