Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1020840pxf; Thu, 8 Apr 2021 20:14:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+5fP5+kkr9MOFpx2o+DrHs9ARQj8y4yZI1vf1rxoHvcrPEAtlVrPpE6OdL+zskCSEFXtC X-Received: by 2002:aa7:cd83:: with SMTP id x3mr15200497edv.373.1617938081101; Thu, 08 Apr 2021 20:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617938081; cv=none; d=google.com; s=arc-20160816; b=vuiVtCoiYiZnQ8cRQPTOAdJlk5Zw6UUmUvondoQ2aTBR7Y9S4UuFmd8zMQnQB+ky6f 6ABN9v8TdLCX6dZ2hIFukNiyDBdFb0VgsIKyxVayOQKPKk8gRkf1N7xx1TUsmUpzR8XY 6bpNeG10FPTX+/PsrjiIvU2lpoV5G/Cj24J/2nvpUGfUlwm3wnnYWWSdkD4ACxan/QaH Ll+PylJBLgGVKAHD8p8WdteIiGi2FavnMriTgup82ND7Pm5MuDofPZdocx/flZzxlKgd BW/WuZ2rQvUh3VdGw/y0Okg7GjHG2naMIQ/v4GZhCiyTS7NgINLvlofcgWeF8ZnWGj8R prLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding:date :message-id:in-reply-to:cc:to:from:sender:reply-to:subject :mime-version:dkim-signature:dkim-filter; bh=W56ar/RkCbAlY+agUi8Yd9X8F+LYYJguXbtIXgcqiOQ=; b=zU+Dmb5YIYrnI9DxgnvbNh57/h2ny3tAqgsFHuXvBtxU+sZkVWzpw61bFWNFLLCaOP GtBjSBUSYIAysC4B0AsT7ZxZ+S0x/6BNt4k3mSFEoYvTEbsBFcXmXHJaa/4mu5WTmsIl WU5jTi7GyQJ4CZFfWbbInZqNvs5vyu/90K2TLnleCKdN0BLMRtKDZUJx/7pv2rq9XBWi PPKOgbnoF7lj3tZNm/rHRPntmLMXJscPTPjEFJoyUgwKtSCTjnsdqOita1iJIbLFcYlm z0Aozs2vMFUxEIlcK1NfO55n79SfllLAEemMVLv/Zdads1St53QqOL68OGZ9AFC3F5mK LdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="lvHAhB/B"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si1216158edq.46.2021.04.08.20.14.18; Thu, 08 Apr 2021 20:14:41 -0700 (PDT) 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=@samsung.com header.s=mail20170921 header.b="lvHAhB/B"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233157AbhDIDNT (ORCPT + 99 others); Thu, 8 Apr 2021 23:13:19 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:56373 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233147AbhDIDNQ (ORCPT ); Thu, 8 Apr 2021 23:13:16 -0400 Received: from epcas3p3.samsung.com (unknown [182.195.41.21]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210409031302epoutp04e041373e7d4871aa77b1955e52a208f0~0EgXmxBUW0698806988epoutp04e for ; Fri, 9 Apr 2021 03:13:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210409031302epoutp04e041373e7d4871aa77b1955e52a208f0~0EgXmxBUW0698806988epoutp04e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1617937982; bh=W56ar/RkCbAlY+agUi8Yd9X8F+LYYJguXbtIXgcqiOQ=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=lvHAhB/BpIhDUT8TU0bQMtmC2glwg547zywjiFMmBxt7zSbZEWfMSgxzfuiQ0STOv uBCL/WfpDKgQrGkb0rVKtKiBkGkFdVtiPr2hA/sY9w1K+1WZpZDl1LJaPqzmgLr+Mj BU7OGSEtDwJD3c9V5o2xsyUWlkHSoOwVO2V1A3gk= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas3p4.samsung.com (KnoxPortal) with ESMTP id 20210409031301epcas3p472d94ea873f2bd32cf6e09b8e8913909~0EgWzy-Xa3080730807epcas3p48; Fri, 9 Apr 2021 03:13:01 +0000 (GMT) Received: from epcpadp4 (unknown [182.195.40.18]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4FGjqx4pV3z4x9Q1; Fri, 9 Apr 2021 03:13:01 +0000 (GMT) Mime-Version: 1.0 Subject: RE: [PATCH v17 1/2] scsi: ufs: Enable power management for wlun Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park To: "cang@codeaurora.org" , "martin.petersen@oracle.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" CC: Asutosh Das , "linux-arm-msm@vger.kernel.org" , ALIM AKHTAR , Avri Altman , "James E.J. Bottomley" , Pedro Sousa , Krzysztof Kozlowski , Stanley Chu , Andy Gross , Bjorn Andersson , Steven Rostedt , Ingo Molnar , Matthias Brugger , Lee Jones , Bean Huo , Kiwoong Kim , Wei Yongjun , Dan Carpenter , Yue Hu , Dinghao Liu , "Gustavo A. R. Silva" , Jaegeuk Kim , Satya Tangirala , open list X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <1b3d53dad245a7166f3f67a4c65f3a731e6600b3.1617893198.git.asutoshd@codeaurora.org> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <1891546521.01617937981650.JavaMail.epsvc@epcpadp4> Date: Fri, 09 Apr 2021 11:27:31 +0900 X-CMS-MailID: 20210409022731epcms2p117b1a94665375910a2f9b6265acdb0fb Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y X-Hop-Count: 3 X-CMS-RootMailID: 20210408145007epcas2p1accfbd653b2e1318b2722c1f5661c1e0 References: <1b3d53dad245a7166f3f67a4c65f3a731e6600b3.1617893198.git.asutoshd@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Asutosh Das, >During runtime-suspend of ufs host, the scsi devices are >already suspended and so are the queues associated with them. >But the ufs host sends SSU (START_STOP_UNIT) to wlun >during its runtime-suspend. >During the process blk_queue_enter checks if the queue is not in >suspended state. If so, it waits for the queue to resume, and never >comes out of it. >The commit >(d55d15a33: scsi: block: Do not accept any requests while suspended) >adds the check if the queue is in suspended state in blk_queue_enter(). > >Call trace: > __switch_to+0x174/0x2c4 > __schedule+0x478/0x764 > schedule+0x9c/0xe0 > blk_queue_enter+0x158/0x228 > blk_mq_alloc_request+0x40/0xa4 > blk_get_request+0x2c/0x70 > __scsi_execute+0x60/0x1c4 > ufshcd_set_dev_pwr_mode+0x124/0x1e4 > ufshcd_suspend+0x208/0x83c > ufshcd_runtime_suspend+0x40/0x154 > ufshcd_pltfrm_runtime_suspend+0x14/0x20 > pm_generic_runtime_suspend+0x28/0x3c > __rpm_callback+0x80/0x2a4 > rpm_suspend+0x308/0x614 > rpm_idle+0x158/0x228 > pm_runtime_work+0x84/0xac > process_one_work+0x1f0/0x470 > worker_thread+0x26c/0x4c8 > kthread+0x13c/0x320 > ret_from_fork+0x10/0x18 > >Fix this by registering ufs device wlun as a scsi driver and >registering it for block runtime-pm. Also make this as a >supplier for all other luns. That way, this device wlun >suspends after all the consumers and resumes after >hba resumes. > >Co-developed-by: Can Guo >Signed-off-by: Can Guo >Signed-off-by: Asutosh Das >--- > drivers/scsi/ufs/cdns-pltfrm.c | 2 + > drivers/scsi/ufs/tc-dwc-g210-pci.c | 2 + > drivers/scsi/ufs/ufs-debugfs.c | 6 +- > drivers/scsi/ufs/ufs-debugfs.h | 2 +- > drivers/scsi/ufs/ufs-exynos.c | 2 + > drivers/scsi/ufs/ufs-hisi.c | 2 + > drivers/scsi/ufs/ufs-mediatek.c | 12 +- > drivers/scsi/ufs/ufs-qcom.c | 2 + > drivers/scsi/ufs/ufs_bsg.c | 6 +- > drivers/scsi/ufs/ufshcd-pci.c | 36 +-- > drivers/scsi/ufs/ufshcd.c | 642 ++++++++++++++++++++++++++----------- > drivers/scsi/ufs/ufshcd.h | 6 + > include/trace/events/ufs.h | 20 ++ > 13 files changed, 509 insertions(+), 231 deletions(-) In this patch, you changed pm_runtime_{get, put}_sync to scsi_autopm_{get, put}_device. But, scsi_autopm_get_device() calls pm_runtime_put_sync() in case of error of pm_runtime_get_sync(). So, pm_runtime_put_sync() can be called twice if scsi_autopm_get_device has error. Thanks, Daejun