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

Bart Van Assche
2022-09-30T17:15:34Z

On 9/30/22 08:03, Bean Huo wrote:
> On Thu, 2022-09-29 at 15:00 -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.