Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
@ 2026-01-26  3:19 Thomas Yen
  2026-01-26 18:12 ` Bart Van Assche
  2026-02-04  3:05 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Yen @ 2026-01-26  3:19 UTC (permalink / raw)
  Cc: Thomas Yen, 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>
---
 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 related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-04  3:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26  3:19 [PATCH 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
2026-01-26 18:12 ` Bart Van Assche
2026-02-04  3:05 ` Martin K. Petersen

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