linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp
@ 2020-07-06  6:07 Stanley Chu
  2020-07-06  6:07 ` [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands Stanley Chu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Stanley Chu @ 2020-07-06  6:07 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb, bvanassche
  Cc: beanhuo, asutoshd, cang, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou, Stanley Chu

Hi,
This small series fixes and simplifies setup_xfer_req vop and request's completion timestamp.

Stanley Chu (2):
  scsi: ufs: Simplify completion timestamp for SCSI and query commands
  scsi: ufs: Fix and simplify setup_xfer_req variant operation

 drivers/scsi/ufs/ufshcd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.18.0

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

* [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands
  2020-07-06  6:07 [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Stanley Chu
@ 2020-07-06  6:07 ` Stanley Chu
  2020-07-14  9:18   ` Can Guo
  2020-07-06  6:07 ` [PATCH v1 2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation Stanley Chu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Stanley Chu @ 2020-07-06  6:07 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb, bvanassche
  Cc: beanhuo, asutoshd, cang, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou, Stanley Chu

Simplify recording command completion time in
__ufshcd_transfer_req_compl() by assigning lrbp->compl_time_stamp
in an unified location.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 18da2d64f9fa..71e8d7c782bd 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4881,6 +4881,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 
 	for_each_set_bit(index, &completed_reqs, hba->nutrs) {
 		lrbp = &hba->lrb[index];
+		lrbp->compl_time_stamp = ktime_get();
 		cmd = lrbp->cmd;
 		if (cmd) {
 			ufshcd_add_command_trace(hba, index, "complete");
@@ -4889,13 +4890,11 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 			cmd->result = result;
 			/* Mark completed command as NULL in LRB */
 			lrbp->cmd = NULL;
-			lrbp->compl_time_stamp = ktime_get();
 			/* Do not touch lrbp after scsi done */
 			cmd->scsi_done(cmd);
 			__ufshcd_release(hba);
 		} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
 			lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
-			lrbp->compl_time_stamp = ktime_get();
 			if (hba->dev_cmd.complete) {
 				ufshcd_add_command_trace(hba, index,
 						"dev_complete");
-- 
2.18.0

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

* [PATCH v1 2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation
  2020-07-06  6:07 [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Stanley Chu
  2020-07-06  6:07 ` [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands Stanley Chu
@ 2020-07-06  6:07 ` Stanley Chu
  2020-07-14  9:19   ` Can Guo
  2020-07-09 11:09 ` [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Avri Altman
  2020-07-14  4:58 ` Martin K. Petersen
  3 siblings, 1 reply; 7+ messages in thread
From: Stanley Chu @ 2020-07-06  6:07 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb, bvanassche
  Cc: beanhuo, asutoshd, cang, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou, Stanley Chu

Add missing "setup_xfer_req" call in ufshcd_issue_devman_upiu_cmd()
by ufs-bsg path, and collect all "setup_xfer_req" calls to an unified
place, i.e., ufshcd_send_command(), to simplify the driver.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 71e8d7c782bd..8603b07045a6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1925,8 +1925,11 @@ static void ufshcd_clk_scaling_update_busy(struct ufs_hba *hba)
 static inline
 void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
 {
-	hba->lrb[task_tag].issue_time_stamp = ktime_get();
-	hba->lrb[task_tag].compl_time_stamp = ktime_set(0, 0);
+	struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
+
+	lrbp->issue_time_stamp = ktime_get();
+	lrbp->compl_time_stamp = ktime_set(0, 0);
+	ufshcd_vops_setup_xfer_req(hba, task_tag, (lrbp->cmd ? true : false));
 	ufshcd_add_command_trace(hba, task_tag, "send");
 	ufshcd_clk_scaling_start_busy(hba);
 	__set_bit(task_tag, &hba->outstanding_reqs);
@@ -2544,7 +2547,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 
 	/* issue command to the controller */
 	spin_lock_irqsave(hba->host->host_lock, flags);
-	ufshcd_vops_setup_xfer_req(hba, tag, true);
 	ufshcd_send_command(hba, tag);
 out_unlock:
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
@@ -2731,7 +2733,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 	/* Make sure descriptors are ready before ringing the doorbell */
 	wmb();
 	spin_lock_irqsave(hba->host->host_lock, flags);
-	ufshcd_vops_setup_xfer_req(hba, tag, false);
 	ufshcd_send_command(hba, tag);
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
 
-- 
2.18.0

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

* RE: [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp
  2020-07-06  6:07 [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Stanley Chu
  2020-07-06  6:07 ` [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands Stanley Chu
  2020-07-06  6:07 ` [PATCH v1 2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation Stanley Chu
@ 2020-07-09 11:09 ` Avri Altman
  2020-07-14  4:58 ` Martin K. Petersen
  3 siblings, 0 replies; 7+ messages in thread
From: Avri Altman @ 2020-07-09 11:09 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, alim.akhtar, jejb, bvanassche
  Cc: beanhuo, asutoshd, cang, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou

Looks good to me.
Thanks,
Avri

 
> 
> Hi,
> This small series fixes and simplifies setup_xfer_req vop and request's
> completion timestamp.
> 
> Stanley Chu (2):
>   scsi: ufs: Simplify completion timestamp for SCSI and query commands
>   scsi: ufs: Fix and simplify setup_xfer_req variant operation
> 
>  drivers/scsi/ufs/ufshcd.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> --
> 2.18.0

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

* Re: [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp
  2020-07-06  6:07 [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Stanley Chu
                   ` (2 preceding siblings ...)
  2020-07-09 11:09 ` [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Avri Altman
@ 2020-07-14  4:58 ` Martin K. Petersen
  3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2020-07-14  4:58 UTC (permalink / raw)
  To: linux-scsi, bvanassche, avri.altman, jejb, Stanley Chu, alim.akhtar
  Cc: Martin K . Petersen, kuohong.wang, beanhuo, linux-kernel,
	cc.chou, cang, matthias.bgg, chaotian.jing, asutoshd, peter.wang,
	andy.teng, chun-hung.wu, linux-arm-kernel, linux-mediatek

On Mon, 6 Jul 2020 14:07:05 +0800, Stanley Chu wrote:

> This small series fixes and simplifies setup_xfer_req vop and request's completion timestamp.
> 
> Stanley Chu (2):
>   scsi: ufs: Simplify completion timestamp for SCSI and query commands
>   scsi: ufs: Fix and simplify setup_xfer_req variant operation
> 
>  drivers/scsi/ufs/ufshcd.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied to 5.9/scsi-queue, thanks!

[1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands
      https://git.kernel.org/mkp/scsi/c/a3170376f7db
[2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation
      https://git.kernel.org/mkp/scsi/c/6edfdcfe285e

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands
  2020-07-06  6:07 ` [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands Stanley Chu
@ 2020-07-14  9:18   ` Can Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Can Guo @ 2020-07-14  9:18 UTC (permalink / raw)
  To: Stanley Chu
  Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb,
	bvanassche, beanhuo, asutoshd, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou

On 2020-07-06 14:07, Stanley Chu wrote:
> Simplify recording command completion time in
> __ufshcd_transfer_req_compl() by assigning lrbp->compl_time_stamp
> in an unified location.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>

Reviewed-by: Can Guo <cang@codeaurora.org>

> ---
>  drivers/scsi/ufs/ufshcd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 18da2d64f9fa..71e8d7c782bd 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4881,6 +4881,7 @@ static void __ufshcd_transfer_req_compl(struct
> ufs_hba *hba,
> 
>  	for_each_set_bit(index, &completed_reqs, hba->nutrs) {
>  		lrbp = &hba->lrb[index];
> +		lrbp->compl_time_stamp = ktime_get();
>  		cmd = lrbp->cmd;
>  		if (cmd) {
>  			ufshcd_add_command_trace(hba, index, "complete");
> @@ -4889,13 +4890,11 @@ static void __ufshcd_transfer_req_compl(struct
> ufs_hba *hba,
>  			cmd->result = result;
>  			/* Mark completed command as NULL in LRB */
>  			lrbp->cmd = NULL;
> -			lrbp->compl_time_stamp = ktime_get();
>  			/* Do not touch lrbp after scsi done */
>  			cmd->scsi_done(cmd);
>  			__ufshcd_release(hba);
>  		} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
>  			lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
> -			lrbp->compl_time_stamp = ktime_get();
>  			if (hba->dev_cmd.complete) {
>  				ufshcd_add_command_trace(hba, index,
>  						"dev_complete");

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

* Re: [PATCH v1 2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation
  2020-07-06  6:07 ` [PATCH v1 2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation Stanley Chu
@ 2020-07-14  9:19   ` Can Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Can Guo @ 2020-07-14  9:19 UTC (permalink / raw)
  To: Stanley Chu
  Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb,
	bvanassche, beanhuo, asutoshd, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou

On 2020-07-06 14:07, Stanley Chu wrote:
> Add missing "setup_xfer_req" call in ufshcd_issue_devman_upiu_cmd()
> by ufs-bsg path, and collect all "setup_xfer_req" calls to an unified
> place, i.e., ufshcd_send_command(), to simplify the driver.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>

Reviewed-by: Can Guo <cang@codeaurora.org>

> ---
>  drivers/scsi/ufs/ufshcd.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 71e8d7c782bd..8603b07045a6 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1925,8 +1925,11 @@ static void
> ufshcd_clk_scaling_update_busy(struct ufs_hba *hba)
>  static inline
>  void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
>  {
> -	hba->lrb[task_tag].issue_time_stamp = ktime_get();
> -	hba->lrb[task_tag].compl_time_stamp = ktime_set(0, 0);
> +	struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
> +
> +	lrbp->issue_time_stamp = ktime_get();
> +	lrbp->compl_time_stamp = ktime_set(0, 0);
> +	ufshcd_vops_setup_xfer_req(hba, task_tag, (lrbp->cmd ? true : 
> false));
>  	ufshcd_add_command_trace(hba, task_tag, "send");
>  	ufshcd_clk_scaling_start_busy(hba);
>  	__set_bit(task_tag, &hba->outstanding_reqs);
> @@ -2544,7 +2547,6 @@ static int ufshcd_queuecommand(struct Scsi_Host
> *host, struct scsi_cmnd *cmd)
> 
>  	/* issue command to the controller */
>  	spin_lock_irqsave(hba->host->host_lock, flags);
> -	ufshcd_vops_setup_xfer_req(hba, tag, true);
>  	ufshcd_send_command(hba, tag);
>  out_unlock:
>  	spin_unlock_irqrestore(hba->host->host_lock, flags);
> @@ -2731,7 +2733,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba 
> *hba,
>  	/* Make sure descriptors are ready before ringing the doorbell */
>  	wmb();
>  	spin_lock_irqsave(hba->host->host_lock, flags);
> -	ufshcd_vops_setup_xfer_req(hba, tag, false);
>  	ufshcd_send_command(hba, tag);
>  	spin_unlock_irqrestore(hba->host->host_lock, flags);

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

end of thread, other threads:[~2020-07-14  9:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06  6:07 [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Stanley Chu
2020-07-06  6:07 ` [PATCH v1 1/2] scsi: ufs: Simplify completion timestamp for SCSI and query commands Stanley Chu
2020-07-14  9:18   ` Can Guo
2020-07-06  6:07 ` [PATCH v1 2/2] scsi: ufs: Fix and simplify setup_xfer_req variant operation Stanley Chu
2020-07-14  9:19   ` Can Guo
2020-07-09 11:09 ` [PATCH v1 0/2] scsi: ufs: Fix and simplify setup_xfer_req vop and request's completion timestamp Avri Altman
2020-07-14  4:58 ` Martin K. Petersen

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).