From: "DooHyun Hwang" <dh0421.hwang@samsung.com>
To: "'Peter Wang (王信友)'" <peter.wang@mediatek.com>,
avri.altman@wdc.com, quic_mnaresh@quicinc.com,
linux-scsi@vger.kernel.org, bvanassche@acm.org,
linux-kernel@vger.kernel.org, alim.akhtar@samsung.com,
manivannan.sadhasivam@linaro.org, martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com
Cc: <sh043.lee@samsung.com>, <wkon.kim@samsung.com>,
<cw9316.lee@samsung.com>, <grant.jung@samsung.com>,
<sh8267.baek@samsung.com>, <jt77.jang@samsung.com>,
<jangsub.yi@samsung.com>, <junwoo80.lee@samsung.com>
Subject: RE: [PATCH 2/2] scsi: ufs: core: Add a trace function calling when uic command error occurs
Date: Wed, 23 Apr 2025 15:45:00 +0900 [thread overview]
Message-ID: <001001dbb41b$3c947300$b5bd5900$@samsung.com> (raw)
In-Reply-To: <039d433e9931e4999e4011cebc2844ffacd2ec0c.camel@mediatek.com>
> On Thu, 2025-04-17 at 11:34 +0900, DooHyun Hwang wrote:
> >
> > External email : Please do not click links or open attachments until
> > you have verified the sender or the content.
> >
> >
> > When a uic command error occurs, there is no trace function calling.
> > Therefore, trace function calls are added when a uic command error
> > happens.
> >
> > Signed-off-by: DooHyun Hwang <dh0421.hwang@samsung.com>
> > ---
> > drivers/ufs/core/ufshcd.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index ab98acd982b5..baac1ae94efc 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -2534,6 +2534,9 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba,
> > struct uic_command *uic_cmd)
> > hba->active_uic_cmd = NULL;
> > spin_unlock_irqrestore(hba->host->host_lock, flags);
> >
> > + if (ret)
> > + ufshcd_add_uic_command_trace(hba, uic_cmd,
> > UFS_CMD_ERR);
> > +
> > return ret;
> > }
> >
> > @@ -4306,6 +4309,8 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba
> > *hba, struct uic_command *cmd)
> > }
> > out:
> > if (ret) {
> > + ufshcd_add_uic_command_trace(hba, hba-
> > >active_uic_cmd,
> > + UFS_CMD_ERR);
> > ufshcd_print_host_state(hba);
> > ufshcd_print_pwr_info(hba);
> > ufshcd_print_evt_hist(hba);
> > --
> > 2.48.1
> >
>
>
> Hi DooHyun,
>
> Is it possible to receive UFS_CMD_COMP and UFS_CMD_ERR at the same time?
> Wouldn't it be a bit strange for a command to receive two completions?
> Additionally, should we also add tracing for general SCSI commands that
> receive errors?
>
> Thanks
> Peter
>
Thank you for your review.
Yes, that’s correct. There is a case where both UFS_CMD_COMP and UFS_CMD_ERR are logged simultaneously.
In the typical case of a UIC command timeout, only UFS_CMD_ERR would be recorded.
However, the scenario you described earlier, where both UFS_CMD_COMP and UFS_CMD_ERR are received in the same UIC command, is distinct from a timeout situation.
In this case, the command completes in time, and UFS_CMD_COMP is received when handling the UIC command completion interrupt in ufshcd_uic_cmd_compl().
However, the UPMCRS status indicates an error because PWR_LOCAL is not in its expected state (when checking upmcrs in the "check_upmcrs:" section of the ufshcd_uic_pwr_ctrl() function).
UFS_CMD_COMP is generated when the system recognizes through interrupt status that the command has completed its execution, while UFS_CMD_ERR is recorded when an error associated with the command is detected.
While it may be cumbersome, it is possible to trace the timeout case and this case separately.
Regarding tracing general SCSI command errors directly through UFS_CMD_ERR, it might be challenging because SCSI command errors are typically handled through various mechanisms such as timeout detection, scsi_status value checks, sense error checks, and OCS (Overall Command Status) value verification.
Additionally, tracing SCSI command errors does not align with the purpose of this commit.
BR,
Thank you.
DooHyun Hwang
prev parent reply other threads:[~2025-04-23 6:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250417023415epcas1p47da6d269afcb5d1807004c9b708675a5@epcas1p4.samsung.com>
2025-04-17 2:34 ` [PATCH 0/2] scsi: ufs: Add an enum for ufs_trace_str_t to check uic cmd error DooHyun Hwang
2025-04-17 2:34 ` [PATCH 1/2] scsi: ufs: Add an enum for ufs_trace to check ufs " DooHyun Hwang
2025-04-17 4:59 ` Avri Altman
2025-04-17 8:21 ` DooHyun Hwang
2025-08-29 15:15 ` Bart Van Assche
2025-09-01 1:31 ` DooHyun Hwang
2025-09-01 14:03 ` Bart Van Assche
2025-09-02 1:09 ` DooHyun Hwang
2025-09-02 16:34 ` Bart Van Assche
2025-09-03 6:39 ` DooHyun Hwang
2025-09-03 15:56 ` Bart Van Assche
2025-09-08 7:43 ` DooHyun Hwang
2025-09-08 15:27 ` Bart Van Assche
2025-04-17 2:34 ` [PATCH 2/2] scsi: ufs: core: Add a trace function calling when uic command error occurs DooHyun Hwang
2025-04-17 21:35 ` Bart Van Assche
2025-04-18 4:48 ` DooHyun Hwang
2025-04-22 12:48 ` Peter Wang (王信友)
2025-04-23 6:45 ` DooHyun Hwang [this message]
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='001001dbb41b$3c947300$b5bd5900$@samsung.com' \
--to=dh0421.hwang@samsung.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=cw9316.lee@samsung.com \
--cc=grant.jung@samsung.com \
--cc=jangsub.yi@samsung.com \
--cc=jt77.jang@samsung.com \
--cc=junwoo80.lee@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=quic_mnaresh@quicinc.com \
--cc=sh043.lee@samsung.com \
--cc=sh8267.baek@samsung.com \
--cc=wkon.kim@samsung.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