RE: [PATCH v3] scsi: ufs: core: handle PM SSU timeout before SCSI EH
From: Fang Hongjie(方洪杰)
Date: Tue Jun 02 2026 - 01:28:33 EST
> From: Bart Van Assche [mailto:bvanassche@xxxxxxx]
> Sent: Tuesday, June 2, 2026 1:42 AM
> To: Fang Hongjie(方洪杰) <hongjiefang@xxxxxxxxxxxx>;
> alim.akhtar@xxxxxxxxxxx; avri.altman@xxxxxxx;
> James.Bottomley@xxxxxxxxxxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx;
> peter.wang@xxxxxxxxxxxx; beanhuo@xxxxxxxxxx
> Cc: linux-scsi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v3] scsi: ufs: core: handle PM SSU timeout before SCSI
> EH
>
> On 5/31/26 9:56 PM, Hongjie Fang wrote:
> > @@ -9466,7 +9499,7 @@ static enum scsi_timeout_action
> ufshcd_eh_timed_out(struct scsi_cmnd *scmd)
> > {
> > struct ufs_hba *hba = shost_priv(scmd->device->host);
> >
> > - if (!hba->system_suspending) {
> > + if (!hba->pm_op_in_progress || !ufshcd_is_scsi_cmd(scmd)) {
> > /* Activate the error handler in the SCSI core. */
> > return SCSI_EH_NOT_HANDLED;
> > }
>
> I think we want to avoid SCSI error handler activation for all commands
> that time out while a power management operation is in progress,
> including device management commands.
>
> Please consider completing commands from inside the timeout handler
> instead of adding force_compl support for the legacy single doorbell
> mode. The very lightly tested patch below should realize this.
>
Thanks, this makes sense.
I will rework the patch in that direction for v4. It will use
hba->pm_op_in_progress for all PM timeout commands and no longer
relay on the extra legacy single-doorbell force-completion path.
For regular SCSI commands it releases the SCSI command resources before
scsi_done(). For internal device-management commands it only
completes the request, since those commands do not use the
ufshcd_release_scsi_cmd() lifetime rules.
Best.