From patchwork Tue Apr 25 03:17:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keoseong Park X-Patchwork-Id: 13222775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4240C77B61 for ; Tue, 25 Apr 2023 03:17:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232290AbjDYDR4 (ORCPT ); Mon, 24 Apr 2023 23:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233308AbjDYDRb (ORCPT ); Mon, 24 Apr 2023 23:17:31 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3DD29741 for ; Mon, 24 Apr 2023 20:17:27 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230425031723epoutp03e6d88f781bc71b78ba7786ba20cfbcd8~ZDzIAXoK01650116501epoutp03G for ; Tue, 25 Apr 2023 03:17:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230425031723epoutp03e6d88f781bc71b78ba7786ba20cfbcd8~ZDzIAXoK01650116501epoutp03G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1682392643; bh=LL+GI3W9ZUGQXmaZW3ulzguaUQvF3QNMBbc3SULMfVI=; h=Subject:Reply-To:From:To:Date:References:From; b=Eg8wnN/J2i6wJfoAL0DudQu2GHSpeYwByFrETJoYq08B7ZqOav2IkJQVvZvbUx0tq dvJYiCJC5LGttaGIGZrp1XisDv9G/tbOljFn0X0lloy8gedT2xXPqKdZjk2Ubid0Qo eTzW1dN2pF91WRlACs/WrXfmR5dIRz9G9RMHle2g= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230425031722epcas2p386a22d99c48d6a0d16225bb67b92b73c~ZDzHm6g0g2434324343epcas2p3Z; Tue, 25 Apr 2023 03:17:22 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.92]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Q56cd73Gtz4x9Px; Tue, 25 Apr 2023 03:17:21 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-c9-644746417835 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id D1.3A.08199.14647446; Tue, 25 Apr 2023 12:17:21 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH] scsi: ufs: core: Fix IO hang that occurs when BKOPS fails in W-LUN suspend Reply-To: keosung.park@samsung.com Sender: Keoseong Park From: Keoseong Park To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "stanley.chu@mediatek.com" , "quic_asutoshd@quicinc.com" , "adrian.hunter@intel.com" , "quic_cang@quicinc.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL 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: <20230425031721epcms2p5d4de65616478c967d466626e20c42a3a@epcms2p5> Date: Tue, 25 Apr 2023 12:17:21 +0900 X-CMS-MailID: 20230425031721epcms2p5d4de65616478c967d466626e20c42a3a X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightm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WB19hSNp3fVVR q9vCvGNmeyJ6qheK1/xj+plgyTJVdtJ5qSIrf2me1Wrfc6eY6fOcUfWrLWBrqF89eZO7zEH2 nQtnn7/k94jdUjv7yeMIs18mT9mZf7YfO/dQP/Kj6e53H9dm3NgcVSDjuuhu0NJ2hw2L7hb7 T+4/NL998dpnypwM09u2cXG3ai39GbtgVZeI+KrHzow2Bx+Vy9+Wu5nUbx3QeWTpxbPrm7sy jM6oKbEUZyQaajEXFScCAMfFwUhSBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230425031721epcms2p5d4de65616478c967d466626e20c42a3a References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Even when urgent BKOPS fails, the consumer will get stuck in runtime suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend SSU/enter hibern8 fail recovery"), trigger the error handler and return -EBUSY to break the suspend. Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Signed-off-by: Keoseong Park Reviewed-by: Avri Altman --- drivers/ufs/core/ufshcd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9434328ba323..24966e9af720 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9457,8 +9457,16 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) * that performance might be impacted. */ ret = ufshcd_urgent_bkops(hba); - if (ret) + if (ret) { + /* + * If return err in suspend flow, IO will hang. + * Trigger error handler and break suspend for + * error recovery. + */ + ufshcd_force_error_recovery(hba); + ret = -EBUSY; goto enable_scaling; + } } else { /* make sure that auto bkops is disabled */ ufshcd_disable_auto_bkops(hba);