From nobody Fri Dec 19 07:46:21 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 B6B67C54EE9 for ; Tue, 13 Sep 2022 14:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232739AbiIMOMi (ORCPT ); Tue, 13 Sep 2022 10:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232702AbiIMOL6 (ORCPT ); Tue, 13 Sep 2022 10:11:58 -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 48B1817056; Tue, 13 Sep 2022 07:09:47 -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 30D1AB80EF7; Tue, 13 Sep 2022 14:09:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B2D0C433C1; Tue, 13 Sep 2022 14:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078183; bh=5QvKRRAHDIo7HHKgbgxqt8ycMrr/leXRZbEgZYnHQDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zpJyPXvne3MV2/KgxE1gbSdjue40lXNQ/wpEhP5ewiIbEqKfax+fJQOC/rTp9Y65n eGvNbvh7afWwBI7IP49CmMbxr2SQTyF/QOeLZHGix9RnRYX4arNpq7O5i7f3/USTxH HXHwaqWmPguWfk3g/F4Gyj0NH+J4NHeJtyYEczrg= 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.19 018/192] scsi: ufs: core: Reduce the power mode change timeout Date: Tue, 13 Sep 2022 16:02:04 +0200 Message-Id: <20220913140410.827052440@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140410.043243217@linuxfoundation.org> References: <20220913140410.043243217@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/ufs/core/ufshcd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index a51ca56a0ebe7..829da9cb14a86 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8723,6 +8723,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->ufs_device_wlun; @@ -8755,9 +8757,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