lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e594dc2ce6103884b7768c2fed55eabec0d5ed8.camel@gmail.com>
Date:   Mon, 05 Sep 2022 14:26:06 +0200
From:   Bean Huo <huobean@...il.com>
To:     Asutosh Das <quic_asutoshd@...cinc.com>, quic_nguyenb@...cinc.com,
        quic_xiaosenh@...cinc.com, stanley.chu@...iatek.com,
        adrian.hunter@...el.com, bvanassche@....org, avri.altman@....com,
        mani@...nel.org, quic_cang@...cinc.com, beanhuo@...ron.com,
        martin.petersen@...cle.com, linux-scsi@...r.kernel.org
Cc:     linux-arm-msm@...r.kernel.org,
        Alim Akhtar <alim.akhtar@...sung.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v3 1/4] ufs: core: prepare ufs for multi circular
 queue support

Asutosh,


On Fri, 2022-09-02 at 15:41 -0700, Asutosh Das wrote:
> Preparatory changes for upcoming multi circular queue.
> 
> Co-developed-by: Can Guo <quic_cang@...cinc.com>
> Signed-off-by: Can Guo <quic_cang@...cinc.com>
> Signed-off-by: Asutosh Das <quic_asutoshd@...cinc.com>
> ---
>  drivers/ufs/core/ufshcd.c | 99 +++++++++++++++++++++++++------------
> ----------
>  1 file changed, 53 insertions(+), 46 deletions(-)
> 
> 
>  
> @@ -2134,14 +2135,14 @@ static void ufshcd_update_monitor(struct
> ufs_hba *hba, const struct ufshcd_lrb *
>   * @task_tag: Task tag of the command
>   */

You didn't change parameter name in the function description.

>  static inline
> -void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
> +void ufshcd_send_command(struct ufs_hba *hba, struct ufshcd_lrb
> *lrbp)
>  {
> -       struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
> +       int task_tag = lrbp->task_tag;
>         unsigned long flags;
>  
>         lrbp->issue_time_stamp = ktime_get();
>         lrbp->compl_time_stamp = ktime_set(0, 0);
> -       ufshcd_add_command_trace(hba, task_tag, UFS_CMD_SEND);
> +       ufshcd_add_command_trace(hba, lrbp, UFS_CMD_SEND);
>         ufshcd_clk_scaling_start_busy(hba);
>         if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
>                 ufshcd_start_monitor(hba, lrbp);
> @@ -2553,9 +2554,10 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct
> ufshcd_lrb *lrbp, u8 upiu_flags)
>         /* command descriptor fields */
>         ucd_req_ptr->header.dword_0 = UPIU_HEADER_DWORD(
>                                 UPIU_TRANSACTION_COMMAND, upiu_flags,
> -                               lrbp->lun, lrbp->task_tag);
> +                               lrbp->lun, lrbp->task_tag & 0xff);
>         ucd_req_ptr->header.dword_1 = UPIU_HEADER_DWORD(
> -                               UPIU_COMMAND_SET_TYPE_SCSI, 0, 0, 0);
> +                               UPIU_COMMAND_SET_TYPE_SCSI, 0, 0,
> +                               (lrbp->task_tag & 0xf00) << 4);
>  

Are you sure here "(lrbp->task_tag & 0xf00) << 4" is correct? 


this will overwrite other fields, see UPIU_HEADER_DWORD:

#define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
                        cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
                         (byte1 << 8) | (byte0))



> 
>  
> -       ufshcd_send_command(hba, tag);
> +       ufshcd_send_command(hba, lrbp);
>         err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
>         ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR :
> UFS_QUERY_COMP,
>                                     (struct utp_upiu_req *)lrbp-
> >ucd_rsp_ptr);
> @@ -4513,6 +4515,7 @@ int ufshcd_make_hba_operational(struct ufs_hba
> *hba)
>                         REG_UTP_TRANSFER_REQ_LIST_BASE_L);
>         ufshcd_writel(hba, upper_32_bits(hba->utrdl_dma_addr),
>                         REG_UTP_TRANSFER_REQ_LIST_BASE_H);
> +
>         ufshcd_writel(hba, lower_32_bits(hba->utmrdl_dma_addr),
>                         REG_UTP_TASK_REQ_LIST_BASE_L);
>         ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr),
> @@ -5320,6 +5323,32 @@ static void ufshcd_release_scsi_cmd(struct
> ufs_hba *hba,
>         ufshcd_clk_scaling_update_busy(hba);
>  }
>  
> +void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag)

This function does only complete one task. What does cqe stand for?

> +{
> +       struct ufshcd_lrb *lrbp;
> +       struct scsi_cmnd *cmd;
> +
> +       lrbp = &hba->lrb[task_tag];
> +       lrbp->compl_time_stamp = ktime_get();
> +       cmd = lrbp->cmd;
> +       if (cmd) {
> +               if (unlikely(ufshcd_should_inform_monitor(hba,
> lrbp)))
> +                       ufshcd_update_monitor(hba, lrbp);
> +               ufshcd_add_command_trace(hba, lrbp, UFS_CMD_COMP);
> +               cmd->result = ufshcd_transfer_rsp_status(hba, lrbp);
> +               ufshcd_release_scsi_cmd(hba, lrbp);
> +               /* Do not touch lrbp after scsi done */
> +               scsi_done(cmd);
> +       } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
> +                  lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
> +               if (hba->dev_cmd.complete) {
> +                       ufshcd_add_command_trace(hba, lrbp,
> UFS_DEV_COMP);
> +                       complete(hba->dev_cmd.complete);
> +                       ufshcd_clk_scaling_update_busy(hba);
> +               }
> +       }
> +}
> +


Kind regards,
Bean

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ