diff mbox series

[RDMA,for-next,V3,3/6] IB/MAD: Add agent trace points

Message ID 1545875731-22189-4-git-send-email-ira.weiny@intel.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series Add MAD stack trace points | expand

Commit Message

Ira Weiny Dec. 27, 2018, 1:55 a.m. UTC
From: Ira Weiny <ira.weiny@intel.com>

Trace agent details when agents are [un]registered.  In addition,
report agent details on send/recv.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Changes from V2
	Change dev_name to string
	Reorder fields for more efficient ring buffer utilization

 drivers/infiniband/core/mad.c |  4 ++++
 include/trace/events/ib_mad.h | 44 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

Comments

Jason Gunthorpe Jan. 3, 2019, 11:02 p.m. UTC | #1
On Wed, Dec 26, 2018 at 08:55:28PM -0500, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> Trace agent details when agents are [un]registered.  In addition,
> report agent details on send/recv.
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> Changes from V2
> 	Change dev_name to string
> 	Reorder fields for more efficient ring buffer utilization
> 
>  drivers/infiniband/core/mad.c |  4 ++++
>  include/trace/events/ib_mad.h | 44 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 48 insertions(+)
> 
> diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
> index 8f6d5e49337a..3912cff864e4 100644
> +++ b/drivers/infiniband/core/mad.c
> @@ -490,6 +490,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
>  	}
>  	spin_unlock_irq(&port_priv->reg_lock);
>  
> +	trace_ib_mad_create_agent(mad_agent_priv);
>  	return &mad_agent_priv->agent;
>  error6:
>  	spin_unlock_irq(&port_priv->reg_lock);
> @@ -647,6 +648,7 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
>  	struct ib_mad_port_private *port_priv;
>  
>  	/* Note that we could still be handling received MADs */
> +	trace_ib_mad_unregister_agent(mad_agent_priv);
>  
>  	/*
>  	 * Canceling all sends results in dropping received response
> @@ -2395,6 +2397,7 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc)
>  
>  	mad_agent = find_mad_agent(port_priv, (const struct ib_mad_hdr *)recv->mad);
>  	if (mad_agent) {
> +		trace_ib_mad_recv_done_agent(mad_agent);
>  		ib_mad_complete_recv(mad_agent, &recv->header.recv_wc);
>  		/*
>  		 * recv is freed up in error cases in ib_mad_complete_recv
> @@ -2559,6 +2562,7 @@ static void ib_mad_send_done(struct ib_cq *cq, struct ib_wc *wc)
>  	send_queue = mad_list->mad_queue;
>  	qp_info = send_queue->qp_info;
>  
> +	trace_ib_mad_send_done_agent(mad_send_wr->mad_agent_priv);
>  	trace_ib_mad_send_done_handler(mad_send_wr, wc);
>  
>  retry:
> diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h
> index 0b294a68cebd..84fd696cf5c6 100644
> +++ b/include/trace/events/ib_mad.h
> @@ -222,6 +222,50 @@
>  	)
>  );
>  
> +DECLARE_EVENT_CLASS(ib_mad_agent_template,
> +	TP_PROTO(struct ib_mad_agent_private *agent),
> +	TP_ARGS(agent),
> +
> +	TP_STRUCT__entry(
> +		__string(dev_name,      agent->agent.device->name)

I'm trying to get rid of device->name, this should be
dev_name(&device->dev)

Though, should it use the stable device index instead?

Jason
Ira Weiny Jan. 4, 2019, 6:01 p.m. UTC | #2
> > +DECLARE_EVENT_CLASS(ib_mad_agent_template,
> > +	TP_PROTO(struct ib_mad_agent_private *agent),
> > +	TP_ARGS(agent),
> > +
> > +	TP_STRUCT__entry(
> > +		__string(dev_name,      agent->agent.device->name)
> 
> I'm trying to get rid of device->name, this should be
> dev_name(&device->dev)
> 
> Though, should it use the stable device index instead?

Both good points.  My excuse is me basing them off my old work and not having correlated the upstream discussions with these patches...  I'll respin with the device index as that is most unique.

I still think there needs to be 'super easy' device index to name decoding...  But I'm not really up on what has been done so forgive me if it is there.

Ira
Leon Romanovsky Jan. 8, 2019, 6:46 a.m. UTC | #3
On Fri, Jan 04, 2019 at 06:01:55PM +0000, Weiny, Ira wrote:
> > > +DECLARE_EVENT_CLASS(ib_mad_agent_template,
> > > +	TP_PROTO(struct ib_mad_agent_private *agent),
> > > +	TP_ARGS(agent),
> > > +
> > > +	TP_STRUCT__entry(
> > > +		__string(dev_name,      agent->agent.device->name)
> >
> > I'm trying to get rid of device->name, this should be
> > dev_name(&device->dev)
> >
> > Though, should it use the stable device index instead?
>
> Both good points.  My excuse is me basing them off my old work and not having correlated the upstream discussions with these patches...  I'll respin with the device index as that is most unique.
>
> I still think there needs to be 'super easy' device index to name decoding...  But I'm not really up on what has been done so forgive me if it is there.

rdmatool does that, most probably not in "super easy" way, but easy enough.
[leonro@server ~]$ rdma dev
1: mlx5_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455 sys_image_guid 5254:00c0:fe12:3455

^ device index.

Thanks

>
> Ira
>
diff mbox series

Patch

diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 8f6d5e49337a..3912cff864e4 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -490,6 +490,7 @@  struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
 	}
 	spin_unlock_irq(&port_priv->reg_lock);
 
+	trace_ib_mad_create_agent(mad_agent_priv);
 	return &mad_agent_priv->agent;
 error6:
 	spin_unlock_irq(&port_priv->reg_lock);
@@ -647,6 +648,7 @@  static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
 	struct ib_mad_port_private *port_priv;
 
 	/* Note that we could still be handling received MADs */
+	trace_ib_mad_unregister_agent(mad_agent_priv);
 
 	/*
 	 * Canceling all sends results in dropping received response
@@ -2395,6 +2397,7 @@  static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc)
 
 	mad_agent = find_mad_agent(port_priv, (const struct ib_mad_hdr *)recv->mad);
 	if (mad_agent) {
+		trace_ib_mad_recv_done_agent(mad_agent);
 		ib_mad_complete_recv(mad_agent, &recv->header.recv_wc);
 		/*
 		 * recv is freed up in error cases in ib_mad_complete_recv
@@ -2559,6 +2562,7 @@  static void ib_mad_send_done(struct ib_cq *cq, struct ib_wc *wc)
 	send_queue = mad_list->mad_queue;
 	qp_info = send_queue->qp_info;
 
+	trace_ib_mad_send_done_agent(mad_send_wr->mad_agent_priv);
 	trace_ib_mad_send_done_handler(mad_send_wr, wc);
 
 retry:
diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h
index 0b294a68cebd..84fd696cf5c6 100644
--- a/include/trace/events/ib_mad.h
+++ b/include/trace/events/ib_mad.h
@@ -222,6 +222,50 @@ 
 	)
 );
 
+DECLARE_EVENT_CLASS(ib_mad_agent_template,
+	TP_PROTO(struct ib_mad_agent_private *agent),
+	TP_ARGS(agent),
+
+	TP_STRUCT__entry(
+		__string(dev_name,      agent->agent.device->name)
+		__field(u32,            hi_tid)
+		__field(u8,             port_num)
+		__field(u8,             mgmt_class)
+		__field(u8,             mgmt_class_version)
+	),
+
+	TP_fast_assign(
+		__assign_str(dev_name, agent->agent.device->name)
+		__entry->port_num = agent->agent.port_num;
+		__entry->hi_tid = agent->agent.hi_tid;
+
+		if (agent->reg_req) {
+			__entry->mgmt_class = agent->reg_req->mgmt_class;
+			__entry->mgmt_class_version = agent->reg_req->mgmt_class_version;
+		} else {
+			__entry->mgmt_class = 0;
+			__entry->mgmt_class_version = 0;
+		}
+	),
+
+	TP_printk("%s:%d mad agent : hi_tid 0x%08x class 0x%02x class_ver 0x%02x",
+		__get_str(dev_name), __entry->port_num,
+		__entry->hi_tid, __entry->mgmt_class, __entry->mgmt_class_version
+	)
+);
+DEFINE_EVENT(ib_mad_agent_template, ib_mad_recv_done_agent,
+	TP_PROTO(struct ib_mad_agent_private *agent),
+	TP_ARGS(agent));
+DEFINE_EVENT(ib_mad_agent_template, ib_mad_send_done_agent,
+	TP_PROTO(struct ib_mad_agent_private *agent),
+	TP_ARGS(agent));
+DEFINE_EVENT(ib_mad_agent_template, ib_mad_create_agent,
+	TP_PROTO(struct ib_mad_agent_private *agent),
+	TP_ARGS(agent));
+DEFINE_EVENT(ib_mad_agent_template, ib_mad_unregister_agent,
+	TP_PROTO(struct ib_mad_agent_private *agent),
+	TP_ARGS(agent));
+
 
 #endif /* _TRACE_IB_MAD_H */