mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
@ 2026-01-27  1:26 Thomas Yen
  2026-01-27  2:06 ` Peter Wang (王信友)
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Yen @ 2026-01-27  1:26 UTC (permalink / raw)
  Cc: Thomas Yen, Stable Tree, Alim Akhtar, Avri Altman,
	Bart Van Assche, James E.J. Bottomley, Martin K. Petersen,
	Peter Wang, Bean Huo, Adrian Hunter, Bao D. Nguyen,
	open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER,
	open list

Ensure that the exception event handling work (&hba->eeh_work) is
explicitly flushed during suspend when the runtime power management
level (rpm_lvl) is set to UFS_PM_LVL_0.

When the RPM level is zero, the device power mode remains active and the
link remains in an active state. In this specific configuration, the UFS
core driver previously bypassed the flushing of exception event handling
jobs. This created a race condition where the driver could attempt to
access the host controller to handle an exception after the system had
already entered a deep power-down state, leading to a system crash.

By explicitly flushing this work before the suspend callback proceeds,
pending exception handling tasks are guaranteed to complete, preventing
illegal hardware access during the power-down sequence.

Signed-off-by: Thomas Yen <thomasyen@google.com>
Cc: Stable Tree <stable@vger.kernel.org>
---
v2:
 - Add Cc: stable tag.
 - Reformat commit message text for better line wrapping.

 drivers/ufs/core/ufshcd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 0369043ca010..3a0e6c9ba86a 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9997,6 +9997,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 
 	if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE &&
 			req_link_state == UIC_LINK_ACTIVE_STATE) {
+		flush_work(&hba->eeh_work);
 		goto vops_suspend;
 	}
 

base-commit: a48ca06cf343423faa01c573aeafba9fa5f92577
-- 
2.52.0.457.g6b5491de43-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
  2026-01-27  1:26 [PATCH v2 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
@ 2026-01-27  2:06 ` Peter Wang (王信友)
  2026-01-29  6:51   ` Thomas Yen
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Wang (王信友) @ 2026-01-27  2:06 UTC (permalink / raw)
  To: thomasyen
  Cc: beanhuo, avri.altman, quic_nguyenb, linux-scsi, bvanassche,
	linux-kernel, adrian.hunter, alim.akhtar, stable,
	martin.petersen, James.Bottomley

On Tue, 2026-01-27 at 09:26 +0800, Thomas Yen wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 0369043ca010..3a0e6c9ba86a 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9997,6 +9997,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba
> *hba, enum ufs_pm_op pm_op)
>  
>  	if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE &&
>  			req_link_state == UIC_LINK_ACTIVE_STATE) {
> +		flush_work(&hba->eeh_work);
> 

Hi Thomas,

Should disable auto bkop before flush ee wroker?
Or the evecption could still hapeen after flush?

Thanks.
Peter



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
  2026-01-27  2:06 ` Peter Wang (王信友)
@ 2026-01-29  6:51   ` Thomas Yen
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Yen @ 2026-01-29  6:51 UTC (permalink / raw)
  To: Peter Wang (王信友)
  Cc: beanhuo, avri.altman, quic_nguyenb, linux-scsi, bvanassche,
	linux-kernel, adrian.hunter, alim.akhtar, stable,
	martin.petersen, James.Bottomley@HansenPartnership.com

Hi Peter,

Thanks for the review.
Agreed, we should disable auto bkops before flushing the eeh worker.
I will include this change in v3.

Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-29  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-27  1:26 [PATCH v2 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
2026-01-27  2:06 ` Peter Wang (王信友)
2026-01-29  6:51   ` Thomas Yen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®