Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2810848pxb; Sun, 15 Nov 2020 19:11:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzE6QzWIxt6bcd9w416nbx0TM9znspP5sXwZaMYuA7kwSRwjp59HaLqdHhKWHrFGwkVFd1R X-Received: by 2002:a50:9319:: with SMTP id m25mr13816106eda.297.1605496272829; Sun, 15 Nov 2020 19:11:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605496272; cv=none; d=google.com; s=arc-20160816; b=qQMlkEF2SI0BWewBd7x2sRy7eDazx8ZlCTjbyMpktPbyBAH5W8jUYlyRuPNbNr85ZS DToKP6muNRNvHLDDBYLPlaipjNyMSsdF1H17wK2FiiAoTseIZcW7EQAqmc/OBY9754qc 857qPNR6m4Do/n/6rvAJxWpe3F9vi3bLHP7RtB4H4Uu2AcHTCA/zRH6HglrdiuHY8ue3 WYLwGMbgRS+gvWSkswBD7gmby/qdUfY4j2NoT5FX47piQno4sDTVLPjt4lii2rvD5k5w FyHyY3y2WYqQYaWdmYUe7kGmh62YlSg8+uAFhJOt0K2EcDoG0IxOFmUQCzhUrNpRYFrw lZJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=oELFfS+JC43077ioQij5MVO6J/XlCo1j3sRES4I9xYI=; b=iMQqu6ktXUA0Ima46ACPD5bWDKWQrWz2lAnTOQK4fB8h8eiNZ1ni7suQWrnhJjtb0+ LwmKSwK1Sl0M2h2AsUINpBlCrdgupEckNfi2+2/jJ6rgtXP4iAWqzr5dW7/JmBb/V79j VWCRj5MBmMVRckrvkvUjVREBQ11NftAq8aBBIe2zJBIWKFmNq6kvtrlr0PIUd5BQms0P Jc0A64e3T/fq2PbCPCVTATE07LTtf9c4yjO/m7T3miZK/1o1KEhcLHBVTCfCHj1Hzqaw vRfaWcJjExfKeBRdCTviQSZOd7G/Eeli3p5sOwp4qMCPaxb9CP66aFxO5mm8Le1waYSE UwbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Uvu4O3dj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si10577239ejt.298.2020.11.15.19.10.50; Sun, 15 Nov 2020 19:11:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Uvu4O3dj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727978AbgKPBmR (ORCPT + 99 others); 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) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 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.