linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ufs: get target SQ entry within critical section
       [not found] <CGME20240104012454epcas2p36b58220b4c89ee72f1e095b34d329be2@epcas2p3.samsung.com>
@ 2024-01-04  1:24 ` Kiwoong Kim
  2024-01-07 16:02   ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Kiwoong Kim @ 2024-01-04  1:24 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, bvanassche,
	jejb, martin.petersen, beanhuo, adrian.hunter, h10.kim, hy50.seo,
	sh425.lee, kwangwon.min, junwoo80.lee, wkon.kim
  Cc: Kiwoong Kim

In IO centric scenarios, especially during a period that
many IO requests are submitted to a same HW queue at the same
time, it's found that one reqeust overwrote a SQ entry
that had been already occupied by another request submitted
in the past. And it eventually led to command timed-out
because one of two requests were overwritten, which could not
be completed.

[   74.995185][  T176] exynos-ufs 17100000.ufs: ufshcd_abort: Device abort task at tag 30

Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
 drivers/ufs/core/ufshcd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7bc3fc4..da1a9c0 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2199,9 +2199,10 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag,
 	if (is_mcq_enabled(hba)) {
 		int utrd_size = sizeof(struct utp_transfer_req_desc);
 		struct utp_transfer_req_desc *src = lrbp->utr_descriptor_ptr;
-		struct utp_transfer_req_desc *dest = hwq->sqe_base_addr + hwq->sq_tail_slot;
+		struct utp_transfer_req_desc *dest;
 
 		spin_lock(&hwq->sq_lock);
+		dest = hwq->sqe_base_addr + hwq->sq_tail_slot;
 		memcpy(dest, src, utrd_size);
 		ufshcd_inc_sq_tail(hwq);
 		spin_unlock(&hwq->sq_lock);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] ufs: get target SQ entry within critical section
  2024-01-04  1:24 ` [PATCH v1] ufs: get target SQ entry within critical section Kiwoong Kim
@ 2024-01-07 16:02   ` Bart Van Assche
  2024-01-08  0:51     ` Kiwoong Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2024-01-07 16:02 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
	jejb, martin.petersen, beanhuo, adrian.hunter, h10.kim, hy50.seo,
	sh425.lee, kwangwon.min, junwoo80.lee, wkon.kim

On 1/3/24 17:24, Kiwoong Kim wrote:
> In IO centric scenarios, especially during a period that
> many IO requests are submitted to a same HW queue at the same
> time, it's found that one reqeust overwrote a SQ entry
> that had been already occupied by another request submitted
> in the past. And it eventually led to command timed-out
> because one of two requests were overwritten, which could not
> be completed.
> 
> [   74.995185][  T176] exynos-ufs 17100000.ufs: ufshcd_abort: Device abort task at tag 30
> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---
>   drivers/ufs/core/ufshcd.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 7bc3fc4..da1a9c0 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2199,9 +2199,10 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag,
>   	if (is_mcq_enabled(hba)) {
>   		int utrd_size = sizeof(struct utp_transfer_req_desc);
>   		struct utp_transfer_req_desc *src = lrbp->utr_descriptor_ptr;
> -		struct utp_transfer_req_desc *dest = hwq->sqe_base_addr + hwq->sq_tail_slot;
> +		struct utp_transfer_req_desc *dest;
>   
>   		spin_lock(&hwq->sq_lock);
> +		dest = hwq->sqe_base_addr + hwq->sq_tail_slot;
>   		memcpy(dest, src, utrd_size);
>   		ufshcd_inc_sq_tail(hwq);
>   		spin_unlock(&hwq->sq_lock);

Is this perhaps a duplicate of patch "scsi: ufs: core: Let the sq_lock 
protect sq_tail_slot access"? See also
https://lore.kernel.org/linux-scsi/1702913550-20631-1-git-send-email-quic_cang@quicinc.com/#t

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v1] ufs: get target SQ entry within critical section
  2024-01-07 16:02   ` Bart Van Assche
@ 2024-01-08  0:51     ` Kiwoong Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Kiwoong Kim @ 2024-01-08  0:51 UTC (permalink / raw)
  To: 'Bart Van Assche',
	linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, adrian.hunter, h10.kim, hy50.seo,
	sh425.lee, kwangwon.min, junwoo80.lee, wkon.kim

> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index 7bc3fc4..da1a9c0 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -2199,9 +2199,10 @@ void ufshcd_send_command(struct ufs_hba *hba,
> unsigned int task_tag,
> >   	if (is_mcq_enabled(hba)) {
> >   		int utrd_size = sizeof(struct utp_transfer_req_desc);
> >   		struct utp_transfer_req_desc *src = lrbp->utr_descriptor_ptr;
> > -		struct utp_transfer_req_desc *dest = hwq->sqe_base_addr +
> hwq->sq_tail_slot;
> > +		struct utp_transfer_req_desc *dest;
> >
> >   		spin_lock(&hwq->sq_lock);
> > +		dest = hwq->sqe_base_addr + hwq->sq_tail_slot;
> >   		memcpy(dest, src, utrd_size);
> >   		ufshcd_inc_sq_tail(hwq);
> >   		spin_unlock(&hwq->sq_lock);
> 
> Is this perhaps a duplicate of patch "scsi: ufs: core: Let the sq_lock
> protect sq_tail_slot access"? See also https://lore.kernel.org/linux-
> scsi/1702913550-20631-1-git-send-email-quic_cang@quicinc.com/#t

I didn’t see it. Thank you for letting me know.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-08  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20240104012454epcas2p36b58220b4c89ee72f1e095b34d329be2@epcas2p3.samsung.com>
2024-01-04  1:24 ` [PATCH v1] ufs: get target SQ entry within critical section Kiwoong Kim
2024-01-07 16:02   ` Bart Van Assche
2024-01-08  0:51     ` Kiwoong Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).