From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8516A28314A; Tue, 26 Aug 2025 13:45:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215927; cv=none; b=WJPh8AJI1ZtbNNGsQJKRrng8VHxk2hREVoCoKz7nw36ckEWKZlkhiLFXGce8PlIN6uD4rOoM4hvE5DB8OPqS46RHTMiSQbbLAFwQvgjxAyfgVtgR4QuUUZuVhBn91WW+gwHlU4+boYM8SMlCts+6hIz9hRuagM41M74Ulw5hcaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215927; c=relaxed/simple; bh=ugJMkPStTIE3hE9QdNf5QxQqNkg7mQIKN0GFuKZbjQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rnOPcGkOBFTXo4T9t/deBVl3YvHg/ky/GJkLzVP67/jlyTK2j9hWaEdPprkHtBMnoo87Finz2dB4y/dASWTgtb/XXBL8RfrZpzHaRNmz9/Gwc9tUa9H/AfwKmzPSfSBChxRFl/50t05DWXdE1zo38xx9MUha5/G5rqu1PyOx2k8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vOVvFMa6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vOVvFMa6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6343C4CEF1; Tue, 26 Aug 2025 13:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756215927; bh=ugJMkPStTIE3hE9QdNf5QxQqNkg7mQIKN0GFuKZbjQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vOVvFMa6oEUj0Oo3NM4fKeg2oTZat3UFmwoDXOC9kynfPAzV0WqyimzsIjUyLbytV TzSyxLl5IP6ZBxduS8z5iYyT1h98UcNEH51B+b4Ax6z2Wjh9wcNQfHpsX+1nJfPH9t 3qdabD8pWiOyOR6KrTEBUFgYq+iBoUwMSrpS1ZMk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Seunghui Lee , Bean Huo , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 218/644] scsi: ufs: core: Use link recovery when h8 exit fails during runtime resume Date: Tue, 26 Aug 2025 13:05:09 +0200 Message-ID: <20250826110951.831210761@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110946.507083938@linuxfoundation.org> References: <20250826110946.507083938@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Seunghui Lee [ Upstream commit 35dabf4503b94a697bababe94678a8bc989c3223 ] If the h8 exit fails during runtime resume process, the runtime thread enters runtime suspend immediately and the error handler operates at the same time. It becomes stuck and cannot be recovered through the error handler. To fix this, use link recovery instead of the error handler. Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and other error recovery paths") Signed-off-by: Seunghui Lee Link: https://lore.kernel.org/r/20250717081213.6811-1-sh043.lee@samsung.com Reviewed-by: Bean Huo Acked-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2b78cc96ccef..3d2b6ee50e2c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4013,7 +4013,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) hba->uic_async_done = NULL; if (reenable_intr) ufshcd_enable_intr(hba, UIC_COMMAND_COMPL); - if (ret) { + if (ret && !hba->pm_op_in_progress) { ufshcd_set_link_broken(hba); ufshcd_schedule_eh_work(hba); } @@ -4021,6 +4021,14 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) spin_unlock_irqrestore(hba->host->host_lock, flags); mutex_unlock(&hba->uic_cmd_mutex); + /* + * If the h8 exit fails during the runtime resume process, it becomes + * stuck and cannot be recovered through the error handler. To fix + * this, use link recovery instead of the error handler. + */ + if (ret && hba->pm_op_in_progress) + ret = ufshcd_link_recovery(hba); + return ret; } -- 2.39.5