Re: [PATCH v3 8/8] scsi: ufs: Fix a deadlock between PM and the SCSI error handler

Bean Huo
2022-10-02T21:21:42Z

On Fri, 2022-09-30 at 10:15 -0700, Bart Van Assche wrote:
> > > +       ufshcd_link_recovery(hba);
> > > +       dev_info(hba->dev, "%s() finished; outstanding_tasks =
> > > %#lx.\n",
> > > +                __func__, hba->outstanding_tasks);
> > > +
> > > +       return hba->outstanding_tasks ? SCSI_EH_RESET_TIMER :
> > > SCSI_EH_DONE;
> >
> > Bart,
> >
> > you have reset the device and host,  in the case, there are pending
> > TMs, Should be cleared locally, just like ufshcd_err_handler()
> > does?
>
> Hi Bean,
>
> Do you agree with the following?
> * SCSI task management functions are only submitted by the SCSI error
>    handler.
> * The ufshcd_link_recovery() call added by this patch can only be
>    invoked during system suspend.
> * System suspend only happens after processes and kernel threads have
>    been frozen and after sync() finished. Hence, no I/O should be in
>    progress when ufshcd_wl_suspend() is called and the SCSI error
> handler
>    should not be running either.
> * Hence, no SCSI commands other than START STOP UNIT should be in
>    progress when the ufshcd_link_recovery() call added by this
>    patch is invoked. No TMFs should be in progress either.
>
> Thanks,
>
> Bart.

Hi Bart,

Yes, install the whole series of changes, ufshcd_link_recovery() will
be called during the system is in suspending in the case of SSU
timeouts. in this case, outstanding_tasks should be 0?

Kind regards,
Bean