RE: [PATCH v1] scsi: ufs: core: Remove the ufshcd_release in ufshcd_err_handling_prepare
From: hoyoung seo
Date: Wed Jan 31 2024 - 03:23:42 EST
> -----Original Message-----
> From: Bart Van Assche <bvanassche@xxxxxxx>
> Sent: Thursday, January 25, 2024 1:17 AM
> To: hoyoung seo <hy50.seo@xxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; alim.akhtar@xxxxxxxxxxx; avri.altman@xxxxxxx;
> jejb@xxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx; beanhuo@xxxxxxxxxx;
> kwangwon.min@xxxxxxxxxxx; kwmad.kim@xxxxxxxxxxx; sh425.lee@xxxxxxxxxxx;
> sc.suh@xxxxxxxxxxx; quic_nguyenb@xxxxxxxxxxx; cpgs@xxxxxxxxxxx;
> grant.jung@xxxxxxxxxxx; junwoo80.lee@xxxxxxxxxxx
> Subject: Re: [PATCH v1] scsi: ufs: core: Remove the ufshcd_release in
> ufshcd_err_handling_prepare
>
> On 1/22/24 18:38, hoyoung seo wrote:
> > When err_handler is completed, active_reqs becomes negative because
> > ufshcd_release() is called again in ufshcd_err_handling_unprepare().
> > I tested it while printing the log, and if I misanalyzed it, let me know.
>
> Please repeat your analysis. I think this patch is wrong.
>
> Thanks,
>
> Bart.
Hi,
I do not understand. why you said my patch is wrong.
If ufs entered suspend with hibern8 state then the hba->clk_gating.active_reqs is 1.
After that run wl_resume(), ufs drvier send hibern8 exit command.
At that time, if the command timeout or error occurs, the err_handler is activated.
Then the active_reqs pair may not fit.
So to sum up, ufs_release() is performed 3 time.
(wl_resume(), ufshcd_err_handling_prepare(), ufshcd_err_handling_unprepare())
And the ufshcd_hold() is performed 2 time(__ufshcd_wl_suspend(), ufshcd_err_handling_prepare())
So the paire of active_reqs is not correct.
So I deleted the ufshcd_release() in ufshcd_err_handling_prepare().
The ufshcd_release() was not called again even in the pm_op_in_progress state in 4.xx version of the kernel.
But now if is_sys_suspended is 1, then ufshcd_release() is called once more.
I don't understand why this is added and the pair doesn't fit.
Please check it again.
Thanks.
Seo.