changeset 9881:741c9e4e094c

6849606 SRP DTrace Probe for xfer-done misses completion of READ transfers 6850368 SRP DTrace probe for xfer-start and xfer-done needs an srp_taskinfo_t
author Charles Ting <Charles.Ting@Sun.COM>
date Tue, 16 Jun 2009 14:51:40 -0400
parents 09668b3e273e
children a28e5f02b7fa
files usr/src/lib/libdtrace/common/srp.d usr/src/uts/common/dtrace/sdt_subr.c usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c usr/src/uts/common/sys/sdt.h
diffstat 5 files changed, 48 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libdtrace/common/srp.d	Tue Jun 16 11:36:35 2009 -0700
+++ b/usr/src/lib/libdtrace/common/srp.d	Tue Jun 16 14:51:40 2009 -0400
@@ -69,7 +69,7 @@
 	pi_i_sid = P->ch_session->ss_i_alias;
 	pi_target = P->ch_session->ss_t_name;
 	pi_t_sid = P->ch_session->ss_t_alias;
-	pi_chan_id = (uintptr_t) P->ch_chan_hdl;
+	pi_chan_id = (uintptr_t)P->ch_chan_hdl;
 };
 
 typedef struct srp_logininfo {
@@ -98,7 +98,7 @@
 	li_max_it_iu_len = ntohl(P->lrsp_max_it_iu_len);
 	li_max_ti_iu_len = ntohl(P->lrsp_max_ti_iu_len);
 	li_request_limit = ntohl(P->lrsp_req_limit_delta);
-	li_reason_code = ntohl(((srp_login_rej_t *) arg2)->lrej_reason);
+	li_reason_code = ntohl(((srp_login_rej_t *)arg2)->lrej_reason);
 };
 
 typedef struct srp_taskinfo {
@@ -118,7 +118,7 @@
 #pragma D binding "1.5" translator
 translator srp_taskinfo_t < srp_cmd_req_t *P > {
 	ti_task_tag = P->cr_tag;
-	ti_lun =  (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
+	ti_lun = (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
 	    ntohl(*((uint32_t *)&P->cr_lun[4]));
 	ti_function = P->cr_type == 1 ?  /* 1: MGMT CMD 2: SRP CMD */
 	    ((srp_tsk_mgmt_t *)P)->tm_function : 0;
@@ -132,8 +132,8 @@
 #pragma D binding "1.5" translator
 translator srp_taskinfo_t < srp_rsp_t *P > {
 	ti_task_tag = P->rsp_tag;
-	ti_lun = ntohll(*(uint64_t *)((scsi_task_t *) arg2)->task_lun_no);
-	ti_function = ((scsi_task_t *) arg2)->task_mgmt_function;
+	ti_lun = ntohll(*(uint64_t *)((scsi_task_t *)arg2)->task_lun_no);
+	ti_function = ((scsi_task_t *)arg2)->task_mgmt_function;
 	ti_req_limit_delta = ntohl(P->rsp_req_limit_delta);
 	ti_flag = P->rsp_flags;
 	ti_do_resid_cnt = ntohl(P->rsp_do_resid_cnt);
@@ -142,15 +142,27 @@
 };
 
 #pragma D binding "1.5" translator
+translator srp_taskinfo_t < srpt_iu_t *P > {
+	ti_task_tag = P->iu_tag;
+	ti_lun = ntohll(*(uint64_t *)P->iu_stmf_task->task_lun_no);
+	ti_function = 0;
+	ti_req_limit_delta = 0;
+	ti_flag = 0;
+	ti_do_resid_cnt = 0;
+	ti_di_resid_cnt = 0;
+	ti_status = 0;
+};
+
+#pragma D binding "1.5" translator
 translator xferinfo_t < ibt_wr_ds_t *P > {
 	xfer_laddr = P->ds_va + arg4;
 	xfer_lkey = P->ds_key;
-	xfer_raddr = (arg2 == 0) ? 0 :
-	    ((ibt_send_wr_t *) arg2)->wr.rc.rcwr.rdma.rdma_raddr;
-	xfer_rkey = (arg2 == 0) ? 0 :
-	    ((ibt_send_wr_t *) arg2)->wr.rc.rcwr.rdma.rdma_rkey;
-	xfer_len = arg3;
-	xfer_loffset = arg4;
-	xfer_roffset = arg5;
-	xfer_type = arg6;
+	xfer_raddr = (arg3 == 0) ? 0 :
+	    ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_raddr;
+	xfer_rkey = (arg3 == 0) ? 0 :
+	    ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_rkey;
+	xfer_len = arg4;
+	xfer_loffset = arg5;
+	xfer_roffset = arg6;
+	xfer_type = arg7;
 };
--- a/usr/src/uts/common/dtrace/sdt_subr.c	Tue Jun 16 11:36:35 2009 -0700
+++ b/usr/src/uts/common/dtrace/sdt_subr.c	Tue Jun 16 14:51:40 2009 -0400
@@ -993,20 +993,22 @@
 	{ "srp", "xfer-start", 1, 0, "srpt_channel_t *",
 	    "srp_portinfo_t *" },
 	{ "srp", "xfer-start", 2, 1, "ibt_wr_ds_t *", "xferinfo_t *" },
-	{ "srp", "xfer-start", 3, 2, "ibt_send_wr_t *"},
-	{ "srp", "xfer-start", 4, 3, "uint32_t" },
+	{ "srp", "xfer-start", 3, 2, "srpt_iu_t *", "srp_taskinfo_t *" },
+	{ "srp", "xfer-start", 4, 3, "ibt_send_wr_t *"},
 	{ "srp", "xfer-start", 5, 4, "uint32_t" },
 	{ "srp", "xfer-start", 6, 5, "uint32_t" },
 	{ "srp", "xfer-start", 7, 6, "uint32_t" },
+	{ "srp", "xfer-start", 8, 7, "uint32_t" },
 	{ "srp", "xfer-done", 0, 0, "srpt_channel_t *", "conninfo_t *" },
 	{ "srp", "xfer-done", 1, 0, "srpt_channel_t *",
 	    "srp_portinfo_t *" },
 	{ "srp", "xfer-done", 2, 1, "ibt_wr_ds_t *", "xferinfo_t *" },
-	{ "srp", "xfer-done", 3, 2, "ibt_send_wr_t *"},
-	{ "srp", "xfer-done", 4, 3, "uint32_t" },
+	{ "srp", "xfer-done", 3, 2, "srpt_iu_t *", "srp_taskinfo_t *" },
+	{ "srp", "xfer-done", 4, 3, "ibt_send_wr_t *"},
 	{ "srp", "xfer-done", 5, 4, "uint32_t" },
 	{ "srp", "xfer-done", 6, 5, "uint32_t" },
 	{ "srp", "xfer-done", 7, 6, "uint32_t" },
+	{ "srp", "xfer-done", 8, 7, "uint32_t" },
 
 	{ "fc", "link-up",   0, 0, "fct_i_local_port_t *", "conninfo_t *" },
 	{ "fc", "link-down", 0, 0, "fct_i_local_port_t *", "conninfo_t *" },
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c	Tue Jun 16 11:36:35 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c	Tue Jun 16 14:51:40 2009 -0400
@@ -610,6 +610,13 @@
 	 */
 	stmf_dbuf->db_xfer_status = STMF_SUCCESS;
 	mutex_exit(&iu->iu_lock);
+
+	DTRACE_SRP_8(xfer__done, srpt_channel_t, ch,
+	    ibt_wr_ds_t, &(dbuf->db_sge), srpt_iu_t, iu,
+	    ibt_send_wr_t, 0, uint32_t, stmf_dbuf->db_data_size,
+	    uint32_t, 0, uint32_t, 0,
+	    uint32_t, (stmf_dbuf->db_flags & DB_DIRECTION_TO_RPORT) ? 1 : 0);
+
 	if ((stmf_dbuf->db_flags & DB_SEND_STATUS_GOOD) != 0) {
 		status = srpt_stp_send_status(dbuf->db_iu->iu_stmf_task, 0);
 		if (status == STMF_SUCCESS) {
@@ -617,11 +624,6 @@
 		}
 		stmf_dbuf->db_xfer_status = STMF_FAILURE;
 	}
-
-	DTRACE_SRP_7(xfer__done, srpt_channel_t, ch,
-	    ibt_wr_ds_t, &(dbuf->db_sge), ibt_send_wr_t, 0,
-	    uint32_t, stmf_dbuf->db_data_size, uint32_t, 0, uint32_t, 0,
-	    uint32_t, (stmf_dbuf->db_flags & DB_DIRECTION_TO_RPORT) ? 1 : 0);
 	stmf_data_xfer_done(dbuf->db_iu->iu_stmf_task, stmf_dbuf, 0);
 }
 
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c	Tue Jun 16 11:36:35 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c	Tue Jun 16 14:51:40 2009 -0400
@@ -485,7 +485,6 @@
 	iu = task->task_port_private;
 	ASSERT(iu != NULL);
 	ASSERT(iu->iu_ch != NULL);
-
 	/*
 	 * We should use iu->iu_ch->ch_swqe_posted to throttle
 	 * send wqe posting. This is very unlikely because we limit
@@ -583,9 +582,10 @@
 		 * If this task is being aborted or has been aborted,
 		 * do not post additional I/O.
 		 */
-		DTRACE_SRP_7(xfer__start, srpt_channel_t, ch,
-		    ibt_wr_ds_t, &(db->db_sge), ibt_send_wr_t, &wr, uint32_t,
-		    rdma_len, uint32_t, xferred_len, uint32_t, desc_offset,
+		DTRACE_SRP_8(xfer__start, srpt_channel_t, ch,
+		    ibt_wr_ds_t, &(db->db_sge), srpt_iu_t, iu,
+		    ibt_send_wr_t, &wr, uint32_t, rdma_len,
+		    uint32_t, xferred_len, uint32_t, desc_offset,
 		    uint32_t, wr.wr_opcode == IBT_WRC_RDMAR ? 0 : 1);
 		mutex_enter(&iu->iu_lock);
 		if ((iu->iu_flags & (SRPT_IU_SRP_ABORTING |
--- a/usr/src/uts/common/sys/sdt.h	Tue Jun 16 11:36:35 2009 -0700
+++ b/usr/src/uts/common/sys/sdt.h	Tue Jun 16 14:51:40 2009 -0400
@@ -348,6 +348,12 @@
 	DTRACE_PROBE7(__srp_##name, type1, arg1, type2, arg2, 		\
 	    type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7);
 
+#define	DTRACE_SRP_8(name, type1, arg1, type2, arg2, type3, arg3,	\
+	    type4, arg4, type5, arg5, type6, arg6, type7, arg7, type8, arg8) \
+	DTRACE_PROBE8(__srp_##name, type1, arg1, type2, arg2, 		\
+	    type3, arg3, type4, arg4, type5, arg5, type6, arg6,		\
+	    type7, arg7, type8, arg8);
+
 #endif /* _KERNEL */
 
 extern const char *sdt_prefix;