scsi: ufs: core: Flush exception handling work when RPM level is zero
Subsystems (3)
PATCH v4 1/1 scsi: ufs: core: Flush exception handling work when RPM level is zero
Ensure that the exception event handling work is explicitly flushed during suspend when the runtime power management level is set to UFS_PM_LVL_0.
When the RPM level is zero, the device power mode and link state both remain active. Previously, the UFS core driver bypassed flushing exception event handling jobs in this configuration. 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, resulting in a system crash.
Explicitly flush this work and disable auto BKOPs before the suspend callback proceeds. This guarantees that pending exception tasks complete and prevents illegal hardware access during the power-down sequence.
---
v4:
- Add Fixes tag.
v3:
- Add logic to disable BKOPs.
v2:
- Add Cc: stable tag.
- Reformat commit message text for better line wrapping.
drivers/ufs/core/ufshcd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ufs/core/ufshcd.c +2 -0
@@ -9997,6 +9997,8 @@ 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 ) { +ufshcd_disable_auto_bkops (hba); +flush_work (&hba->eeh_work); goto vops_suspend; }
base-commit: a48ca06cf343423faa01c573aeafba9fa5f92577
Signature · 1 line
2.53.0.rc1.225.gd81095ad13-goog
Quoted 11 lines · Thomas Yen
drivers/ufs/core/ufshcd.c +0
-0@@ -9997,6 +9997,8 @@ 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) {drivers/ufs/core/ufshcd.c +2
-0+ufshcd_disable_auto_bkops (hba); +flush_work (&hba->eeh_work);
Quoted 5 lines
goto
vops_suspend;
}
If you have the next version, please feel free to add my review tag. Thanks.
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) · line 10003
Quoted 12 lines · Thomas Yen
drivers/ufs/core/ufshcd.c +2
-0@@ -9997,6 +9997,8 @@ 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 ) { +ufshcd_disable_auto_bkops (hba); +flush_work (&hba->eeh_work); goto vops_suspend; }
Thomas,
Quoted 3 lines
Ensure that the exception event handling work is explicitly flushed during suspend when the runtime power management level is set to
UFS_PM_LVL_0.
Replied to the wrong mail, I applied v4. Thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 4 lines · Thomas Yen
Ensure that the exception event handling work is explicitly flushed during suspend when the runtime power management level is set to
UFS_PM_LVL_0.
Quoted 8 lines
When the RPM level is zero, the device power mode and link state both remain active. Previously, the UFS core driver bypassed flushing exception event handling jobs in this configuration. 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, resulting in a system crash.
[...]
Applied to 6.20/scsi-queue, thanks!
[1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
https://git.kernel.org/mkp/scsi/c/f8ef441811ec
Signature · 1 line
Martin K. Petersen