Re: [PATCH v5 7/7] ufs: core: Add error handling for MCQ mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bao,

Bao D. Nguyen <quic_nguyenb@xxxxxxxxxxx> 於 2023年5月12日 週五 下午2:34寫道:
>
> Add support for error handling for MCQ mode.
>
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@xxxxxxxxxxx>
> ---
>  drivers/ufs/core/ufshcd.c | 85 +++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 74 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index ec07e49..9345118 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3148,6 +3148,16 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
>                 err = -ETIMEDOUT;
>                 dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
>                         __func__, lrbp->task_tag);
> +
> +               /* MCQ mode */
> +               if (is_mcq_enabled(hba)) {
> +                       err = ufshcd_clear_cmd(hba, lrbp->task_tag);
> +                       if (!err)
> +                               hba->dev_cmd.complete = NULL;

How about always clearing hba->dev_cmd.complete? If ufshcd_clear_cmd()
fails (for example, times out), "complete" should be cleared, similar
to the "pending" case in the SDB path.

> +                       return err;
> +               }
> +
> +               /* SDB mode */
>                 if (ufshcd_clear_cmd(hba, lrbp->task_tag) == 0) {
>                         /* successfully cleared the command, retry if needed */
>                         err = -EAGAIN;
> @@ -5581,6 +5591,10 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)
>   */
>  static irqreturn_t ufshcd_transfer_req_compl(struct ufs_hba *hba)
>  {
> +       struct ufshcd_lrb *lrbp;
> +       u32 hwq_num, utag;
> +       int tag;
> +
>         /* Resetting interrupt aggregation counters first and reading the
>          * DOOR_BELL afterward allows us to handle all the completed requests.
>          * In order to prevent other interrupts starvation the DB is read once
> @@ -5599,7 +5613,22 @@ static irqreturn_t ufshcd_transfer_req_compl(struct ufs_hba *hba)
>          * Ignore the ufshcd_poll() return value and return IRQ_HANDLED since we
>          * do not want polling to trigger spurious interrupt complaints.
>          */
> -       ufshcd_poll(hba->host, UFSHCD_POLL_FROM_INTERRUPT_CONTEXT);
> +       if (!is_mcq_enabled(hba)) {
> +               ufshcd_poll(hba->host, UFSHCD_POLL_FROM_INTERRUPT_CONTEXT);
> +               goto out;
> +       }
> +
> +       /* MCQ mode */
> +       for (tag = 0; tag < hba->nutrs; tag++) {
> +               lrbp = &hba->lrb[tag];
> +               if (ufshcd_cmd_inflight(lrbp->cmd)) {
> +                       utag = blk_mq_unique_tag(scsi_cmd_to_rq(lrbp->cmd));
> +                       hwq_num = blk_mq_unique_tag_to_hwq(utag);
> +                       ufshcd_poll(hba->host, hwq_num);
> +               }
> +       }

In SDB mode, the DOOR_BELL is reset by ufshcd_hba_stop(). All bits
that were previously set in DOOR_BELL are also set in "completed_reqs"
in ufshcd_poll(). This allows ufshcd_poll() to handle all outstanding
requests properly.

However, in MCQ mode, the CQ tail registers cannot provide the same
information after they are reset. Hence, they cannot be properly
referenced by ufshcd_poll().

Thanks,
Stanley Chu




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux