linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] scsi: ufs: exclude UECxx from SFR dump list
       [not found] <CGME20220308081304epcas2p4e7279fb51babf93fdf0bf0a3aacf9f68@epcas2p4.samsung.com>
@ 2022-03-08  8:11 ` Kiwoong Kim
  2022-03-08  8:46   ` Adrian Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Kiwoong Kim @ 2022-03-08  8:11 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, cang, adrian.hunter, sc.suh, hy50.seo,
	sh425.lee, bhoon95.kim, vkumar.1997
  Cc: Kiwoong Kim

v1 -> v2: does skipping only for zero offset

These are ROC type things that means their values
are cleared when the SFRs are read.
They are usually read in ISR when an UIC error occur.
Thus, their values would be zero at many cases. And
there might be a little bit risky when they are read to
be cleared before the ISR reads them, e.g. the case that
a command is timed-out, ufshcd_dump_regs is called in
ufshcd_abort and an UIC error occurs at the nearly
same time. In this case, ISR will be called but UFS error handler
will not be scheduled.
This patch is to make UFS driver not read those SFRs in the
dump function, i.e. ufshcd_dump_regs.

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

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 460d2b4..7f2a1ed 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -115,8 +115,13 @@ int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
 	if (!regs)
 		return -ENOMEM;
 
-	for (pos = 0; pos < len; pos += 4)
+	for (pos = 0; pos < len; pos += 4) {
+		if (offset == 0 &&
+		    pos >= REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER &&
+		    pos <= REG_UIC_ERROR_CODE_DME)
+			continue;
 		regs[pos / 4] = ufshcd_readl(hba, offset + pos);
+	}
 
 	ufshcd_hex_dump(prefix, regs, len);
 	kfree(regs);
-- 
2.7.4


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

* Re: [PATCH v2] scsi: ufs: exclude UECxx from SFR dump list
  2022-03-08  8:11 ` [PATCH v2] scsi: ufs: exclude UECxx from SFR dump list Kiwoong Kim
@ 2022-03-08  8:46   ` Adrian Hunter
  2022-03-10  6:17     ` Kiwoong Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2022-03-08  8:46 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
	jejb, martin.petersen, beanhuo, cang, sc.suh, hy50.seo,
	sh425.lee, bhoon95.kim, vkumar.1997

On 8.3.2022 10.11, Kiwoong Kim wrote:
> v1 -> v2: does skipping only for zero offset
> 
> These are ROC type things that means their values
> are cleared when the SFRs are read.
> They are usually read in ISR when an UIC error occur.
> Thus, their values would be zero at many cases. And
> there might be a little bit risky when they are read to
> be cleared before the ISR reads them, e.g. the case that
> a command is timed-out, ufshcd_dump_regs is called in
> ufshcd_abort and an UIC error occurs at the nearly
> same time. In this case, ISR will be called but UFS error handler
> will not be scheduled.
> This patch is to make UFS driver not read those SFRs in the
> dump function, i.e. ufshcd_dump_regs.

This is essentially a fix, so perhaps a fixes tag?

Wouldn't hurt to wrap the commit description more nicely.

> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 460d2b4..7f2a1ed 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -115,8 +115,13 @@ int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
>  	if (!regs)
>  		return -ENOMEM;
>  
> -	for (pos = 0; pos < len; pos += 4)
> +	for (pos = 0; pos < len; pos += 4) {
> +		if (offset == 0 &&

So it will still read them if the offset is not zero.  That seems unexpectedly inconsistent.

> +		    pos >= REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER &&
> +		    pos <= REG_UIC_ERROR_CODE_DME)
> +			continue;
>  		regs[pos / 4] = ufshcd_readl(hba, offset + pos);
> +	}
>  
>  	ufshcd_hex_dump(prefix, regs, len);
>  	kfree(regs);


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

* RE: [PATCH v2] scsi: ufs: exclude UECxx from SFR dump list
  2022-03-08  8:46   ` Adrian Hunter
@ 2022-03-10  6:17     ` Kiwoong Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Kiwoong Kim @ 2022-03-10  6:17 UTC (permalink / raw)
  To: 'Adrian Hunter',
	linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, cang, sc.suh, hy50.seo, sh425.lee,
	bhoon95.kim, vkumar.1997

> > These are ROC type things that means their values are cleared when the
> > SFRs are read.
> > They are usually read in ISR when an UIC error occur.
> > Thus, their values would be zero at many cases. And there might be a
> > little bit risky when they are read to be cleared before the ISR reads
> > them, e.g. the case that a command is timed-out, ufshcd_dump_regs is
> > called in ufshcd_abort and an UIC error occurs at the nearly same
> > time. In this case, ISR will be called but UFS error handler will not
> > be scheduled.
> > This patch is to make UFS driver not read those SFRs in the dump
> > function, i.e. ufshcd_dump_regs.
> 
> This is essentially a fix, so perhaps a fixes tag?
> 
> Wouldn't hurt to wrap the commit description more nicely.


Thank you for your opinion.


Thanks.
Kiwoong Kim


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

end of thread, other threads:[~2022-03-10  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220308081304epcas2p4e7279fb51babf93fdf0bf0a3aacf9f68@epcas2p4.samsung.com>
2022-03-08  8:11 ` [PATCH v2] scsi: ufs: exclude UECxx from SFR dump list Kiwoong Kim
2022-03-08  8:46   ` Adrian Hunter
2022-03-10  6:17     ` 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).