From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381333; b=WW5j3aKNHg5drtYAentBEHurzS7nR33ec3IS4NR1XHJC0PaY0Jyi6dtOJzDSg5e5rp1S WDw+Q/VWsb9xDuPLHvGjddGv/hLmoGC9AzP09fALpUovMC8mUaF9+jBszng1Iow02Gn32 uswpF/Ro1ft7Elytx4y2q05uCq2/gZspCCVtOsRQCwzFmq9gp/PhdnDC6Pt+MRCASzTh2 OqBnGV1c3NK9+Q2Hs+sxPprbVMP0qR9I95u12wkGjzXhSwlSVR8uHndzTX1ycixLsmhxy ZCIk1NTOaTLmu7yH/TtdHowb2YwkzQN0C+snOEUNqft1Mdxra+VbbIjmnT4Qn6SMLZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381333; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=4aEsAZMjSA9dk37ikN0ggxRhE83WQtvLKV3BWtzFI30=; b=miVwaKXfLcEWP27YEUNKOX3cjSmSXoLb/LTl5Y4qYhQ4mVUznfG6oTjTafW2cMaA0rB6 pFu/TKiDcWzvKxnX5FH7i1UMdQUfzLMd97+t8fmLyTArmT8EAEG+yCE5mdkQgjtT27zzt kQN55ZsSFozEkS0prOBPqPSAeoyIY1zhRY+0hxDtBd6AG3LfH8Jcdg6E94tBh9dDxuItM NWkZgCo1akihaYG7BfYtiKCUe84ZKZuGso1G17BweeJPcihjZtCql4llmlNj9ViDv1qoq IPwQ+d24JUPVI86U0Y3k5WdDedqZq9I2Tj+20PzGZAPPm2omVjVHXT1fStguQc4Ilkw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kdToEn0X; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FD54606A32F; Fri, 4 Dec 2026 10:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kdToEn0X Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB9301F000C2; Fri, 4 Dec 2026 10:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381333; bh=4aEsAZMjSA9dk37ikN0ggxRhE83WQtvLKV3BWtzFI30=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kdToEn0XWmBDlZFZci4dokZEClXlzWrs8/zGN7U/SJXs3U98vSCzNfcl9HRErw5RU wWeCBgFFxuUqwqU8APGeGdYi3rRjI792nOqAy4hHnMWm1Zit7BM7nsUZWOFuqswOPY NSZaqfgM2bKIT31jdx9NNvhvEO3JnVHQDNUcjER0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stanley Jhu , Brian Norris , Peter Wang , "Martin K. Petersen (Oracle)" Subject: [PATCH 7.3 656/742] scsi: ufs: core: Keep clock-gating hold on failed W-LUN runtime resume Date: Fri, 4 Dec 2026 19:08:40 +0900 Message-ID: <20261204100652.505232661@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stanley Jhu commit 6da1bc55c060bec3163b0e6077f3ac9641f8100c upstream. 1. __ufshcd_wl_suspend() takes one ufshcd_hold() reference and sets hba->clk_gating.is_suspended while the UFS device W-LUN enters RPM_SUSPENDED. 2. Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend callback failures"), a failed runtime resume (for example START STOP UNIT completing with an error) leaves the W-LUN in RPM_SUSPENDED with power.runtime_error == 0, while __ufshcd_wl_resume() already clears hba->clk_gating.is_suspended and calls ufshcd_release(). 3. The next W-LUN runtime resume runs __ufshcd_wl_resume() again without an intervening suspend and calls ufshcd_release() a second time, dropping a reference it does not own and underflowing hba->clk_gating.active_reqs on UFSHCD_CAP_CLK_GATING hosts. Keep hba->clk_gating.is_suspended and the suspend hold across a failed W-LUN runtime resume, so the hold stays paired with the W-LUN RPM_SUSPENDED state and the next successful resume releases it. Fixes: eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend callback failures") Cc: stable@vger.kernel.org # v7.3+ Signed-off-by: Stanley Jhu Reviewed-by: Brian Norris Reviewed-by: Peter Wang Link: https://patch.msgid.link/20261029040002.2100002-1-stanleyjhu@google.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/ufs/core/ufshcd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10608,8 +10608,14 @@ vendor_suspend: out: if (ret) ufshcd_update_evt_hist(hba, UFS_EVT_WL_RES_ERR, (u32)ret); - hba->clk_gating.is_suspended = false; - ufshcd_release(hba); + /* + * A failed runtime resume leaves the W-LUN RPM_SUSPENDED, so keep + * is_suspended and the suspend hold for the next resume. + */ + if (!ret || pm_op != UFS_RUNTIME_PM) { + hba->clk_gating.is_suspended = false; + ufshcd_release(hba); + } hba->pm_op_in_progress = false; return ret; }