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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 EB78CC2D0E4 for ; Mon, 16 Nov 2020 01:42:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85BD222265 for ; Mon, 16 Nov 2020 01:42:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="Uvu4O3dj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728082AbgKPBmR (ORCPT ); Sun, 15 Nov 2020 20:42:17 -0500 Received: from z5.mailgun.us ([104.130.96.5]:51239 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbgKPBmR (ORCPT ); Sun, 15 Nov 2020 20:42:17 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605490936; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=oELFfS+JC43077ioQij5MVO6J/XlCo1j3sRES4I9xYI=; b=Uvu4O3djDydHBExQmjZGgUkX6cHArt0stEOTCBGV3J7wVW9+dp+pzxbsgeHjWLhqYa6qn24a Jal0wrQ3yfgo3n2SDlBEYYo78WrXcusQ7qNwS1F5UfC61WZ3jA5JKQW2Ws48YKLTnov/yOL+ sG8ifrWUX/FcjDKd+FGuZ5P0/hQ= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 5fb1d8f68e090a8886a85b56 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 16 Nov 2020 01:42:14 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 64E6EC43463; Mon, 16 Nov 2020 01:42:14 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 96DA3C433ED; Mon, 16 Nov 2020 01:42:13 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 16 Nov 2020 09:42:13 +0800 From: Can Guo To: Bart Van Assche Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, ziqichen@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Stanley Chu , "James E.J. Bottomley" , "Martin K. Petersen" , Matthias Brugger , open list , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" Subject: Re: [PATCH RFC v1 1/1] scsi: pm: Leave runtime resume along if block layer PM is enabled In-Reply-To: <97dea590-5f2e-b4e3-ac64-7c346761c523@acm.org> References: <1605249009-13752-1-git-send-email-cang@codeaurora.org> <1605249009-13752-2-git-send-email-cang@codeaurora.org> <97dea590-5f2e-b4e3-ac64-7c346761c523@acm.org> Message-ID: <20f447a438aa98afb18be4642c8888b3@codeaurora.org> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bart, Resent, typo fixed. On 2020-11-15 04:57, Bart Van Assche wrote: > On 11/12/20 10:30 PM, Can Guo wrote: >> If block layer runtime PM is enabled for one SCSI device, then there >> is >> no need to forcibly change the SCSI device and its request queue's >> runtime >> PM status to active in scsi_dev_type_resume(), since block layer PM >> shall >> resume the SCSI device on the demand of bios. > > Please change "along" into "alone" in the subject of this patch (if > that > is what you meant). > Aha, sorry, a typo here. >> + if (scsi_is_sdev_device(dev)) { >> + struct scsi_device *sdev; >> >> + sdev = to_scsi_device(dev); > > A minor comment: I think that "struct scsi_device *sdev = > to_scsi_device(dev);" fits on a single line. > Sure. >> + * If block layer runtime PM is enabled for the SCSI device, >> + * let block layer PM handle its runtime PM routines. > > Please change "its runtime PM routines" into "runtime resume" or > similar. I think that will make the comment more clear. > Yes, thanks. >> + if (sdev->request_queue->dev) >> + return err; >> + } > > The 'dev' member only exists in struct request_queue if CONFIG_PM=y so > the above won't compile if CONFIG_PM=n. How about adding a function in > include/linux/blk-pm.h to check whether or not runtime PM has been > enabled? > You are right. > Otherwise this patch looks good to me. > Actually, I am thinking about removing all the pm_runtime_set_active() codes in both scsi_bus_resume_common() and scsi_dev_type_resume() - we don't need to forcibly set the runtime PM status to RPM_ACTIVE for either SCSI host/target or SCSI devices. Whenever we access one SCSI device, either block layer or somewhere in the path (e.g. throgh sg IOCTL, sg_open() calls scsi_autopm_get_device()) should runtime resume the device first, and the runtime PM framework makes sure device's parent (and its parent's parent and so on)gets resumed as well. Thus, the pm_runtime_set_active() seems redundant. What do you think? Thanks, Can Guo. > Thanks, > > Bart.