From nobody Sun Sep 14 22:45:45 2025 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 205EDC6FA82 for ; Tue, 13 Sep 2022 14:32:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234090AbiIMOc3 (ORCPT ); Tue, 13 Sep 2022 10:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbiIMOao (ORCPT ); Tue, 13 Sep 2022 10:30:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE8363F3B; Tue, 13 Sep 2022 07:18:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4FC72B80FA7; Tue, 13 Sep 2022 14:18:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C2A7C433D6; Tue, 13 Sep 2022 14:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078680; bh=mbw7MSPR3g4EtRoj9xhwty39pKwBVqgVI8IGo4q1OC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K2CvoMSqp+EzLQJIM2QttUozv3gdmmH1DhaNXWWjA6KqfDew2tD4ZSbohq8CcHuGE cSsICoEqos4WToTSFtdaX3AdqxKI+kNr3CpkoRbsRRXS4PwW4RzuxGGVRSj8Ji/gAd SQqKV1ZAoX1qSIeWfseHkckl8tNnCit5SNfEP8Tg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanley Chu , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 014/121] scsi: ufs: core: Reduce the power mode change timeout Date: Tue, 13 Sep 2022 16:03:25 +0200 Message-Id: <20220913140357.947394936@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140357.323297659@linuxfoundation.org> References: <20220913140357.323297659@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 8f2c96420c6ec3dcb18c8be923e24c6feaa5ccf6 ] The current power mode change timeout (180 s) is so large that it can cause a watchdog timer to fire. Reduce the power mode change timeout to 10 seconds. Link: https://lore.kernel.org/r/20220811234401.1957911-1-bvanassche@acm.org Reviewed-by: Stanley Chu Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2f6468f22b489..dae1a85f1512c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8476,6 +8476,8 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hb= a, struct scsi_device *sdp; unsigned long flags; int ret, retries; + unsigned long deadline; + int32_t remaining; =20 spin_lock_irqsave(hba->host->host_lock, flags); sdp =3D hba->sdev_ufs_device; @@ -8508,9 +8510,14 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *h= ba, * callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ + deadline =3D jiffies + 10 * HZ; for (retries =3D 3; retries > 0; --retries) { + ret =3D -ETIMEDOUT; + remaining =3D deadline - jiffies; + if (remaining <=3D 0) + break; ret =3D scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL); + remaining / HZ, 0, 0, RQF_PM, NULL); if (!scsi_status_is_check_condition(ret) || !scsi_sense_valid(&sshdr) || sshdr.sense_key !=3D UNIT_ATTENTION) --=20 2.35.1