Re: [PATCH v1] ufs: core: Fix runtime suspend error deadlock

Peter Wang (王信友)
2025-09-25T10:03:36Z

On Wed, 2025-09-24 at 14:51 -0700, Bart Van Assche wrote:
>
> Hi Peter,
>
> The UFS error handler is not only triggered by bus errors. It can
> also
> be activated via debugfs. Do you agree that activation via debugfs
> can
> happen concurrently with runtime suspend?
>
> Thanks,
>
> Bart.

Hi Bart,

Do you mean that debugfs could schedule EH work just before
suspend? If so, there is indeed a chance that this patch
might not work as intended. Even if we surround it with
ufshcd_rpm_get_noresume() and ufshcd_rpm_put(), there is
still a possibility that runtime PM is ongoing and the suspend
callback hasn't been called yet, so the result would be the
same, just with a lower chance of occurrence.

Because this patch mainly targets errors that occur during
the suspend process. If the error happens before suspend,
it’s outside the scope of what this patch is intended to fix.
But I will add ufshcd_rpm_get_noresume() and ufshcd_rpm_put()
next version.

Thanks.
Peter