Re: [PATCH v4] scsi: ufs: core: handle PM commands timeout before SCSI EH

From: Peter Wang (王信友)

Date: Thu Jun 04 2026 - 01:40:19 EST


On Wed, 2026-06-03 at 11:08 +0000, Fang Hongjie(方洪杰) wrote:
>
>
> The !hba->mcq_enabled check is only for clearing outstanding_reqs,
> which is the legacy single-doorbell software bitmap.
> MCQ does not use outstanding_reqs for request tracking.
>

Hi Hongjie,

I know, but what I mean is, if this check (!hba->mcq_enabled)
always evaluates to true, then it is a redundant check, right?
I don't see any scenario where it would return false.

>
> >
> > > +                       unsigned long flags;
> > > +                       struct request *rq =
> > > scsi_cmd_to_rq(scmd);
> > > +
> > > +                       spin_lock_irqsave(&hba->outstanding_lock,
> > > flags);
> > > +                       __clear_bit(rq->tag, &hba-
> > > >outstanding_reqs);
> > > +                       spin_unlock_irqrestore(&hba-
> > > > outstanding_lock, flags);
> > > +               }
> > > +
> > > +               set_host_byte(scmd, DID_TIME_OUT);
> > >
> >
> > Why does MCQ mode set DID_REQUEUE, while legacy mode sets
> > DID_TIME_OUT?
> >
> Normal SCSI PM commands use DID_REQUEUE, matching the existing
> MCQ force-completion behavior. Reserved internal device-management
> commands continue to use DID_TIME_OUT, right ?
>

Sorry, I don't get it.
I mean, in MCQ mode, the ufshcd_mcq_force_compl_one function
handles the same uncompleted condition, but why is the processing
logic different?

if (!test_bit(SCMD_STATE_COMPLETE, &cmd->state)) {
set_host_byte(cmd, DID_REQUEUE);
ufshcd_release_scsi_cmd(hba, cmd);
scsi_done(cmd);
}

Thanks
Peter