Skip to contentSkip to conversation

scsi: ufs: add ufs a command complete time stamp

PATCH In review Zang Leigang 2 participants 3 messages Sep 20, 2017 – Sep 27, 2017 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: add ufs a command complete time stamp

drivers/scsi/ufs/ufshcd.c +5 -0
index 794a4600e952..2984f33095be 100644
@@ -385,6 +385,8 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long bitmap, bool pr_prdt)
 
 		dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
 				tag, ktime_to_us(lrbp->issue_time_stamp));
+		dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
+				tag, ktime_to_us(lrbp->complete_time_stamp));
 		dev_err(hba->dev,
 			"UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
 			tag, (u64)lrbp->utrd_dma_addr);
@@ -1746,6 +1748,7 @@ 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].complete_time_stamp.tv64 = 0UL;
 	ufshcd_clk_scaling_start_busy(hba);
 	__set_bit(task_tag, &hba->outstanding_reqs);
 	ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
@@ -4627,6 +4630,8 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 		}
 		if (ufshcd_is_clkscaling_supported(hba))
 			hba->clk_scaling.active_reqs--;
+
+		lrbp->complete_time_stamp = ktime_get();
 	}
 
 	/* clear corresponding bits of completed commands */
drivers/scsi/ufs/ufshcd.h +2 -0
index cdc8bd05f7df..67a8f8ef1b06 100644
@@ -166,6 +166,7 @@ struct ufs_pm_lvl_states {
  * @lun: LUN of the command
  * @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation)
  * @issue_time_stamp: time stamp for debug purposes
+ * @complete_time_stamp: time stamp for statistics
  * @req_abort_skip: skip request abort task flag
  */
 struct ufshcd_lrb {
@@ -189,6 +190,7 @@ struct ufshcd_lrb {
 	u8 lun; /* UPIU LUN id field is only 8-bit wide */
 	bool intr_cmd;
 	ktime_t issue_time_stamp;
+	ktime_t complete_time_stamp;
 
 	bool req_abort_skip;
 };
Signature · 1 line
2.14.1
#1 lore raw
Quoted 17 lines · Zang Leigang
drivers/scsi/ufs/ufshcd.c +2 -0
index 794a4600e952..2984f33095be 100644
@@ -385,6 +385,8 @@ void ufshcd_print_trs(struct ufs_hba *hba,
 unsigned long bitmap, bool pr_prdt)
 
 		dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
 				tag, ktime_to_us(lrbp->issue_time_stamp));
+		dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
+				tag, ktime_to_us(lrbp->complete_time_stamp));
 		dev_err(hba->dev,
 			"UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
drivers/scsi/ufs/ufshcd.c +0 -0
 			tag, (u64)lrbp->utrd_dma_addr);

drivers/scsi/ufs/ufshcd.c static inline · line 1751

Quoted 4 lines
drivers/scsi/ufs/ufshcd.c +1 -0
@@ -1746,6 +1748,7 @@ 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].complete_time_stamp.tv64 = 0UL;

can we use ktime_set(0, 0)?
complete_time_stamp = ktime_set(0, 0);

Quoted 27 lines
drivers/scsi/ufs/ufshcd.c +2 -0
 	ufshcd_clk_scaling_start_busy(hba);
 	__set_bit(task_tag, &hba->outstanding_reqs);
 	ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
@@ -4627,6 +4630,8 @@ static void __ufshcd_transfer_req_compl(struct
 ufs_hba *hba,
 		}
 		if (ufshcd_is_clkscaling_supported(hba))
 			hba->clk_scaling.active_reqs--;
+
+		lrbp->complete_time_stamp = ktime_get();
 	}
 
drivers/scsi/ufs/ufshcd.c +0 -0
 	/* clear corresponding bits of completed commands */
drivers/scsi/ufs/ufshcd.h +1 -0
index cdc8bd05f7df..67a8f8ef1b06 100644
@@ -166,6 +166,7 @@ struct ufs_pm_lvl_states {
  * @lun: LUN of the command
  * @intr_cmd: Interrupt command (doesn't participate in interrupt 
 aggregation)
  * @issue_time_stamp: time stamp for debug purposes
+ * @complete_time_stamp: time stamp for statistics
  * @req_abort_skip: skip request abort task flag
  */

struct ufshcd_lrb {

drivers/scsi/ufs/ufshcd.h struct ufshcd_lrb { · line 193

Quoted 4 lines
drivers/scsi/ufs/ufshcd.h +1 -0
@@ -189,6 +190,7 @@ struct ufshcd_lrb {
 	u8 lun; /* UPIU LUN id field is only 8-bit wide */
 	bool intr_cmd;
 	ktime_t issue_time_stamp;
+	ktime_t complete_time_stamp;

Just a suggestion for short name, s/complete/compl ? or s/complete/cmpl ?

Quoted 3 lines
drivers/scsi/ufs/ufshcd.h +0 -0
 	bool req_abort_skip;
 };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Hi, Subhash

I send a new patch, forget tag a "PATCH V2", pls check.

Quoted 10 lines · Subhash Jadavani
Quoted 9 lines · Zang Leigang
drivers/scsi/ufs/ufshcd.c +0 -0
index 794a4600e952..2984f33095be 100644
@@ -385,6 +385,8 @@ void ufshcd_print_trs(struct ufs_hba *hba,
 unsigned long bitmap, bool pr_prdt)
 
Quoted 15 lines

drivers/scsi/ufs/ufshcd.c static inline · line 1751

Quoted 12 lines
drivers/scsi/ufs/ufshcd.c +2 -0
 		dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
 				tag, ktime_to_us(lrbp->issue_time_stamp));
+		dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
+				tag, ktime_to_us(lrbp->complete_time_stamp));
 		dev_err(hba->dev,
 			"UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
			tag, (u64)lrbp->utrd_dma_addr);
drivers/scsi/ufs/ufshcd.c +1 -0
@@ -1746,6 +1748,7 @@ 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].complete_time_stamp.tv64 = 0UL;

can we use ktime_set(0, 0)?
complete_time_stamp = ktime_set(0, 0);

Sure.

Quoted 27 lines
Quoted 27 lines
drivers/scsi/ufs/ufshcd.c +2 -0
 	ufshcd_clk_scaling_start_busy(hba);
 	__set_bit(task_tag, &hba->outstanding_reqs);
 	ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL);
@@ -4627,6 +4630,8 @@ static void __ufshcd_transfer_req_compl(struct
 ufs_hba *hba,
 		}
 		if (ufshcd_is_clkscaling_supported(hba))
 			hba->clk_scaling.active_reqs--;
+
+		lrbp->complete_time_stamp = ktime_get();
 	}
 
	/* clear corresponding bits of completed commands */
drivers/scsi/ufs/ufshcd.h +1 -0
index cdc8bd05f7df..67a8f8ef1b06 100644
@@ -166,6 +166,7 @@ struct ufs_pm_lvl_states {
 * @lun: LUN of the command
 * @intr_cmd: Interrupt command (doesn't participate in interrupt
 aggregation)
 * @issue_time_stamp: time stamp for debug purposes
+ * @complete_time_stamp: time stamp for statistics
 * @req_abort_skip: skip request abort task flag
 */
Quoted 8 lines

drivers/scsi/ufs/ufshcd.h struct ufshcd_lrb { · line 193

Quoted 6 lines

struct ufshcd_lrb {

drivers/scsi/ufs/ufshcd.h +1 -0
@@ -189,6 +190,7 @@ struct ufshcd_lrb {
 	u8 lun; /* UPIU LUN id field is only 8-bit wide */
 	bool intr_cmd;
 	ktime_t issue_time_stamp;
+	ktime_t complete_time_stamp;

Just a suggestion for short name, s/complete/compl ? or s/complete/cmpl ?

Accept. compl look better.

Quoted 8 lines
Quoted 4 lines
drivers/scsi/ufs/ufshcd.h +0 -0
 	bool req_abort_skip;
 };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Signature · 6 lines
Thanks,
Zang Leigang

________________________________________________________________________________
本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!