* [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
@ 2026-01-29 16:51 Thomas Yen
2026-01-30 7:58 ` Peter Wang (王信友)
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Yen @ 2026-01-29 16:51 UTC (permalink / raw)
To: martin.petersen, James.Bottomley
Cc: Thomas Yen, Stable Tree, Alim Akhtar, Avri Altman,
Bart Van Assche, Peter Wang, Bean Huo, Adrian Hunter,
Bao D. Nguyen, Subhash Jadavani, Dolev Raviv, Sujit Reddy Thumma,
open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER,
open list
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.
Fixes: 57d104c153d3 ("scsi: ufs: ufshcd: Fix link state during system suspend")
Signed-off-by: Thomas Yen <thomasyen@google.com>
Cc: Stable Tree <stable@vger.kernel.org>
---
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(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 0369043ca010..8c88dd5c2cca 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -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
--
2.53.0.rc1.225.gd81095ad13-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
2026-01-29 16:51 [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
@ 2026-01-30 7:58 ` Peter Wang (王信友)
2026-01-30 23:00 ` Bart Van Assche
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Wang (王信友) @ 2026-01-30 7:58 UTC (permalink / raw)
To: thomasyen@google.com, James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com
Cc: beanhuo@micron.com, subhashj@codeaurora.org, avri.altman@wdc.com,
quic_nguyenb@quicinc.com, sthumma@codeaurora.org,
bvanassche@acm.org, linux-kernel@vger.kernel.org,
adrian.hunter@intel.com, alim.akhtar@samsung.com,
draviv@codeaurora.org, stable@vger.kernel.org,
linux-scsi@vger.kernel.org
On Fri, 2026-01-30 at 00:51 +0800, Thomas Yen wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 0369043ca010..8c88dd5c2cca 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -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;
> }
>
>
>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
If you have the next version, please feel free to add my review tag.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
2026-01-29 16:51 [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
2026-01-30 7:58 ` Peter Wang (王信友)
@ 2026-01-30 23:00 ` Bart Van Assche
2026-02-04 3:19 ` Martin K. Petersen
2026-02-08 2:01 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2026-01-30 23:00 UTC (permalink / raw)
To: Thomas Yen, martin.petersen, James.Bottomley
Cc: Stable Tree, Alim Akhtar, Avri Altman, Peter Wang, Bean Huo,
Adrian Hunter, Bao D. Nguyen, Subhash Jadavani, Dolev Raviv,
Sujit Reddy Thumma,
open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER,
open list
On 1/29/26 8:51 AM, Thomas Yen wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 0369043ca010..8c88dd5c2cca 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -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;
> }
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
2026-01-29 16:51 [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
2026-01-30 7:58 ` Peter Wang (王信友)
2026-01-30 23:00 ` Bart Van Assche
@ 2026-02-04 3:19 ` Martin K. Petersen
2026-02-08 2:01 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2026-02-04 3:19 UTC (permalink / raw)
To: Thomas Yen
Cc: martin.petersen, James.Bottomley, Stable Tree, Alim Akhtar,
Avri Altman, Bart Van Assche, Peter Wang, Bean Huo, Adrian Hunter,
Bao D. Nguyen, Subhash Jadavani, Dolev Raviv, Sujit Reddy Thumma,
open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER,
open list
Thomas,
> 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!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero
2026-01-29 16:51 [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
` (2 preceding siblings ...)
2026-02-04 3:19 ` Martin K. Petersen
@ 2026-02-08 2:01 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2026-02-08 2:01 UTC (permalink / raw)
To: James.Bottomley, Thomas Yen
Cc: Martin K . Petersen, Stable Tree, Alim Akhtar, Avri Altman,
Bart Van Assche, Peter Wang, Bean Huo, Adrian Hunter,
Bao D. Nguyen, Subhash Jadavani, Dolev Raviv, Sujit Reddy Thumma,
open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER,
open list
On Fri, 30 Jan 2026 00:51:51 +0800, Thomas Yen wrote:
> 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.
>
> [...]
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
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-08 2:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 16:51 [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero Thomas Yen
2026-01-30 7:58 ` Peter Wang (王信友)
2026-01-30 23:00 ` Bart Van Assche
2026-02-04 3:19 ` Martin K. Petersen
2026-02-08 2:01 ` 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