RE: [PATCH v3 0/2] scsi: ufs: core: Avoid redundant link recovery during system resume

From: hoyoung seo

Date: Wed Nov 04 2026 - 23:16:23 EST


Hi Bart,

Thank you for the review and for the report. I checked the points in the
report against the code and agree with them. I will send a v4 that
follows the suggested direction as far as I could verify it:

- Patch 1/2 is unchanged apart from a Fixes: tag.
- Patch 2/2 replaces the is_sys_suspended check. The early link
recovery in ufshcd_err_handler() is only taken while a runtime PM
operation is in progress. For system PM the error handler waits for
host_sem, and during shutdown it stops, so it no longer runs
concurrently with __ufshcd_wl_resume(), ufs_mtk_resume(), system
suspend or shutdown. This needs a new field,
hba->runtime_pm_in_progress, because pm_op_in_progress does not tell
which PM operation is running.

I kept the early link recovery for runtime resume as well, not only for
runtime suspend. The comment added by commit e23ef4f22db3 and commit
35dabf4503b9 describe a deadlock when the error handler runs during
runtime resume, and I could not confirm that the regular path, which
waits in ufshcd_err_handling_prepare(), is safe there. As a result the
race with __ufshcd_wl_resume() during runtime resume is not removed.
Do you think the early path can be dropped for runtime resume as well,
e.g. after commit 01d5e237b339?

For the remaining early path in runtime PM I did not add a check of
ufshcd_err_handling_should_stop() before the link recovery. I can send
it as a separate patch if you think it is needed.

I also did not add a mutex around ufshcd_link_recovery(). It calls
ufshcd_probe_hba(), and if a device command times out there,
ufshcd_eh_timed_out() calls ufshcd_link_recovery() again from the
timeout context while the first call waits for that command. A mutex
would turn this into a deadlock, so I would like to avoid it unless you
see a way around that.

Thanks,
Hoyoung

> -----Original Message-----
> From: Bart Van Assche <bvanassche@xxxxxxx>
> Sent: Wednesday, November 4, 2026 3:25 AM
> To: HOYOUNG SEO <hy50.seo@xxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; mkp@xxxxxxxxxx; martin.petersen@xxxxxxxxxx;
> stanleyjhu@xxxxxxxxxx; alim.akhtar@xxxxxxxxxxx; kwangwon.min@xxxxxxxxxxx;
> kwmad.kim@xxxxxxxxxxx; cpgs@xxxxxxxxxxx; h10.kim@xxxxxxxxxxx
> Subject: Re: [PATCH v3 0/2] scsi: ufs: core: Avoid redundant link recovery
> during system resume
>
> On 11/3/26 1:33 AM, HOYOUNG SEO wrote:
> > Any review or comment would be appreciated, especially on 2/2 and the
> > system PM vs. runtime PM difference.
>
> Please take a look at the attached review report from an LLM. According to
> that review this series isn't ready yet for integration in the upstream
> kernel.
>
> Thanks,
>
> Bart.