[PATCH v1] ufs: core: Fix error handler host_sem issue
Peter Wang (王信友)
peter.wang at mediatek.com
Tue Oct 7 00:01:12 PDT 2025
On Fri, 2025-10-03 at 09:15 -0700, Bart Van Assche wrote:
> The purpose of hba->host_sem is to serialize power management
> operations, error handling and sysfs callbacks. Hence, I think that
> hba->host_sem should be held around the ufshcd_link_recovery() call
> and hence that the code block that is moved by this patch should not
> be moved.
>
> Thanks,
>
> Bart.
Hi Bart,
No, if we take host_sem before checking pm_op_in_progress,
it may cause a deadlock. Consider this case:
ufshcd_wl_suspend
down(&hba->host_sem);
__ufshcd_wl_suspend => may trigger ufshcd_err_handler
ufshcd_execute_start_stop => stuck here waiting for
ufshcd_err_handler to finish
ufshcd_err_handler
down(&hba->host_sem); => stuck here
Thanks
Peter
More information about the Linux-mediatek
mailing list