Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2810149pxb; Sun, 15 Nov 2020 19:09:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQhdNgG4R3bWNfPtm5NEExc4JT7YVKUrj3nR8u8k+uTYc6RIF3BnxPY0w1sYi0i2hgGmA0 X-Received: by 2002:a05:6402:22d8:: with SMTP id dm24mr13983729edb.69.1605496164888; Sun, 15 Nov 2020 19:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605496164; cv=none; d=google.com; s=arc-20160816; b=nX2UwvVSoakU3VgnppxbWWDyh46HPZPb3C3Wnyyfme7FMSiHk8PU1ecVNEl5ySL9LZ M9msRNOHQCz5v91cZxzuqDexPc/mCcI1ME8q3PO1TtySWiBvrvKyR7QgLxh6CgACBTRA ZJRBwMqLBKwkJOu7mlMnWfLD4q9Ek87lxu5K8va+5QF3hGvVGE0suO648a6jrRIA6+xn a/gofuvonDm/Ah75Ap01x671ZiRA1TwAxGuLGPsE53uT97SVM1433ZtU5DIQ5fVx5XA+ Tf6JteyhOUP6VlcEArU2pVucI4GTa0+HqUQrHxEP98tsplGCcflnJtf3nAn2zeTeNB4s EmGw== 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=v6KLhXj+620b0Cqk/wXyGVyIAZ1iI29OVn20Cf4L4r0=; b=PBePNnvNYupe7yLwCzyOzi9pNRh7EHRYPFYxWhAw3z09u7aZ1fS4OtlVc+DsxcrY5R 6xgmq3C3rV4XTez6WjsLdBJBSwg2aR7dmPI0DKjYGrijm1i2652irUDdBd+gTCGOjlBY 3IAGRYOoyfLaug6JxU7g0CNA5slVahnxihcXyz6JNacrHiY3T91PHLsG+kLj7vgh3XPI Ud9eoc10a8zIronuzftzTMZSujGQbe3d0S8a2wzR7oPLhC4jc0+DWcBGMjxwgFkWtP+L 1jU9SjS12sLV9GZo4NDI2nG7dQQOdhtKMGAkREb+Nxvg8rvoAGQ0nPdO2gfOrpgOjb4J qggA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=I6T1s1DJ; 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 g11si12290015edn.315.2020.11.15.19.09.02; Sun, 15 Nov 2020 19:09:24 -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=I6T1s1DJ; 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 S1728364AbgKPBTx (ORCPT + 99 others); Sun, 15 Nov 2020 20:19:53 -0500 Received: from m42-4.mailgun.net ([69.72.42.4]:33710 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727893AbgKPBTx (ORCPT ); Sun, 15 Nov 2020 20:19:53 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605489592; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=v6KLhXj+620b0Cqk/wXyGVyIAZ1iI29OVn20Cf4L4r0=; b=I6T1s1DJpNFbHjxgo3Fjqz4JICGoLeKYr4QHV8cR4tc6mOhYBQCavnPG1+vcn/DCsSbIzDpk 6iV1KtsiA2Ic6HPeknagNmE06KvYEyI3hDuaYxHRxm0QIkwGnsDvxjH4J1rUdD9xSvtTgTh+ ZB/NDayEBd9AI9vKUKjfWR7Uobc= X-Mailgun-Sending-Ip: 69.72.42.4 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-n07.prod.us-east-1.postgun.com with SMTP id 5fb1d3b857dd92cbec9fe479 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 16 Nov 2020 01:19:52 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 668A7C43460; Mon, 16 Nov 2020 01:19:51 +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 13408C433C6; Mon, 16 Nov 2020 01:19:49 +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:19:49 +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: 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, 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 gets resumed as well. Thus, the pm_runtime_set_active() seems redundant. What do you think? Thanks, Can Guo. > > Thanks, > > Bart.