Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp892791pxb; Thu, 12 Nov 2020 21:09:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLPBf+N0xBd2HktCofOHW30BgXDu7VWa+Hy9k/xBK1hE3XBZ6Wvfx3j0uLnFhqaetjvZMC X-Received: by 2002:a17:906:d72:: with SMTP id s18mr376876ejh.110.1605244153836; Thu, 12 Nov 2020 21:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605244153; cv=none; d=google.com; s=arc-20160816; b=AZEwbyGZb/f6Eyyv/zEGHmUAim4PwtwVVRMioYT6AssYg/zue//swASDp1pDJzci0N xnvlvmJpGOPZBNFI8QvOEzvXbi+U+A6kCJfCW3YLTL+SIlas1t6nkA5M/nrawDgzv+Y+ 6IL0wSiC/nhtvxPSig5kk7T3Dw9u08vUBBOoQGVrqvew2Y3OTkIM6oSi+Fb97MfUyC+0 PmrPDTPZjdKRSFRxHnckzzu3B/MnLA7EBh3biHxA3RgXkuTIVf7S78BOUx95GKfhI5Nj aojNF0CV671JQ7ZEKPavAlgouKumCYpc5s0wCzGpBF6K7LCWoXUjlQRRNcCFKZgje7WT ow/g== 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=2vV1+LRLbU3pMGMU7pkb9KyQ6+s8e9iW3o/q4gDHIV8=; b=Ud4IFbz+Dg9vuK+u6lW4rq74yENLscWAoXnnmlW8mX8D+FwJxoCwsacmnykQpHOuqH n0GQvxvDhTsCyhGte/MsqTnG3ygHChf3rJTzp68rhdYlcvLmbjOIXHOQK89P+EYOjMN9 HrrLpoEl/BoPbCNGRyL7An+nZtbJkScqsFapZLy7KpGwy3SFABwRBr9WwtNi4j0K9EKW 6DyNX7FYAVVblazgHV0mLEcZgsUVL+aRRKgkz9Rv3BOdqvoPv2HPT1nGnDO+2U9gZ6Yv S7D/O1FFjpPP5PgDmErleMdd5X5EAwPFwPsSa1P7JY58SKmQpJbjDB2gwt/e2s7gTDVt lW6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=JesVP8BK; 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 v12si113687eje.754.2020.11.12.21.08.51; Thu, 12 Nov 2020 21:09:13 -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=JesVP8BK; 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 S1726143AbgKMFFL (ORCPT + 99 others); Fri, 13 Nov 2020 00:05:11 -0500 Received: from m42-4.mailgun.net ([69.72.42.4]:60742 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbgKMFFL (ORCPT ); Fri, 13 Nov 2020 00:05:11 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605243910; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=2vV1+LRLbU3pMGMU7pkb9KyQ6+s8e9iW3o/q4gDHIV8=; b=JesVP8BKYFhs2PGZEyPkFLruKGPUuMW7Km8J6/F/Bgnwr9JUycKJxOPn94cicUAJL9NIdSLO FzDdw+flBzHNxzGt5+nN8lR5fjkxZkUujdF6QFLesIgKP+o5pZGbQshQ29bxTBAIEzJUpylY sNso/o1P+rlEvKQWV5tVwhV7oH0= 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-west-2.postgun.com with SMTP id 5fae14038e090a88865b22a8 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 13 Nov 2020 05:05:07 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6ACD9C433C6; Fri, 13 Nov 2020 05:05:07 +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, URIBL_BLOCKED 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 EA7F0C433C8; Fri, 13 Nov 2020 05:05:05 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 13 Nov 2020 13:05:05 +0800 From: Can Guo To: Yang Yang Cc: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Bart Van Assche , Asutosh Das , Sujit Reddy Thumma , Dolev Raviv , Subhash Jadavani , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, onlyfever@icloud.com Subject: Re: [PATCH] scsi: ufs: Fix a bug in ufshcd_system_resume() In-Reply-To: <20201110085537.2889-1-yang.yang@vivo.com> References: <20201110085537.2889-1-yang.yang@vivo.com> Message-ID: <52a959ba7514f802488c93f907586a1d@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 On 2020-11-10 16:55, Yang Yang wrote: > During system resume, ufshcd_system_resume() won't resume UFS host if > runtime suspended. After that, scsi_bus_resume() try to set SCSI host's > RPM status to RPM_ACTIVE, this will fail because UFS host's RPM status > is still RPM_SUSPENDED. So fix it. > > scsi host0: scsi_runtime_suspend() > ufshcd_runtime_suspend() > scsi host0: scsi_bus_suspend() > ufshcd_system_suspend() > ---------------------------------- > ufshcd_pltfrm_resume() > scsi host0: scsi_bus_resume() > scsi host0: scsi_bus_resume_common() > scsi host0: pm_runtime_set_active(dev) > > scsi host0: runtime PM trying to activate child device host0 but > parent > (8800000.ufshc) is not active > > Fixes: 57d104c153d3 ("ufs: add UFS power management support") > Signed-off-by: Yang Yang > --- > drivers/scsi/ufs/ufshcd.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index b8f573a02713..9e666e1ad58c 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -8767,11 +8767,7 @@ int ufshcd_system_resume(struct ufs_hba *hba) > if (!hba) > return -EINVAL; > > - if (!hba->is_powered || pm_runtime_suspended(hba->dev)) > - /* > - * Let the runtime resume take care of resuming > - * if runtime suspended. > - */ > + if (!hba->is_powered) > goto out; > else > ret = ufshcd_resume(hba, UFS_SYSTEM_PM); > @@ -8779,8 +8775,15 @@ int ufshcd_system_resume(struct ufs_hba *hba) > trace_ufshcd_system_resume(dev_name(hba->dev), ret, > ktime_to_us(ktime_sub(ktime_get(), start)), > hba->curr_dev_pwr_mode, hba->uic_link_state); > - if (!ret) > + if (!ret) { > hba->is_sys_suspended = false; > + > + if (pm_runtime_suspended(hba->dev)) { > + pm_runtime_disable(hba->dev); > + pm_runtime_set_active(hba->dev); > + pm_runtime_enable(hba->dev); > + } > + } > return ret; > } > EXPORT_SYMBOL(ufshcd_system_resume); It is designed like this - if hba is runtime suspend, do not resume it during system resume, which is the so called deferred resume feature. This is to leave the runtime PM management to block layer PM, which is more power efficiency. > scsi host0: runtime PM trying to activate child device host0 but parent > (8800000.ufshc) is not active The log is not harmful or fatal, maybe just annoying. Do you see real problem with it? If yes, please share it here. Thanks, Can Guo.