mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Zhang Hui <masonzhang.xiaomi@gmail.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Can Guo <quic_cang@quicinc.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Asutosh Das <quic_asutoshd@quicinc.com>,
	Arthur Simchaev <Arthur.Simchaev@wdc.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	zhanghui <zhanghui31@xiaomi.com>, Bean Huo <beanhuo@micron.com>,
	peng.zhou@mediatek.com, yudongbin@xiaomi.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] scsi: ufs: core: Fix ufshcd_inc_sq_tail function bug
Date: Thu, 1 Jun 2023 07:08:47 -0700	[thread overview]
Message-ID: <61ff835b-bd00-8cf3-6e4a-30c82cf9e7b1@acm.org> (raw)
In-Reply-To: <20230601124613.1446-1-zhanghui31@xiaomi.com>

On 6/1/23 05:46, Zhang Hui wrote:
> From: zhanghui <zhanghui31@xiaomi.com>
> 
> When qdepth is not power of 2, not every bit of the mask is 1, so
> sq_tail_slot some bits will be cleared unexpected.
> 
> Signed-off-by: zhanghui <zhanghui31@xiaomi.com>
> ---
>   drivers/ufs/core/ufshcd-priv.h | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
> index d53b93c21a0c..319fba31c1f5 100644
> --- a/drivers/ufs/core/ufshcd-priv.h
> +++ b/drivers/ufs/core/ufshcd-priv.h
> @@ -366,10 +366,11 @@ static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, u8
>   static inline void ufshcd_inc_sq_tail(struct ufs_hw_queue *q)
>   	__must_hold(&q->sq_lock)
>   {
> -	u32 mask = q->max_entries - 1;
>   	u32 val;
>   
> -	q->sq_tail_slot = (q->sq_tail_slot + 1) & mask;
> +	q->sq_tail_slot++;
> +	if (q->sq_tail_slot == q->max_entries)
> +		q->sq_tail_slot = 0;
>   	val = q->sq_tail_slot * sizeof(struct utp_transfer_req_desc);
>   	writel(val, q->mcq_sq_tail);
>   }

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

  reply	other threads:[~2023-06-01 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 12:46 Zhang Hui
2023-06-01 14:08 ` Bart Van Assche [this message]
2023-06-01 15:17 ` Stanley Chu
2023-06-08  1:10 ` Martin K. Petersen
2023-06-15  2:16 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61ff835b-bd00-8cf3-6e4a-30c82cf9e7b1@acm.org \
    --to=bvanassche@acm.org \
    --cc=Arthur.Simchaev@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jejb@linux.ibm.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=masonzhang.xiaomi@gmail.com \
    --cc=peng.zhou@mediatek.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=yudongbin@xiaomi.com \
    --cc=zhanghui31@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®