Message ID | 20190228220511.1072-1-ira.weiny@intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | IB/MAD: Use trace struct in create_mad_addr_info() helper | expand |
On Thu, 28 Feb 2019 14:05:11 -0800 ira.weiny@intel.com wrote: > From: Ira Weiny <ira.weiny@intel.com> > > Using a structure pointer is more efficient in the helper. > Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> ;-) -- Steve > Signed-off-by: Ira Weiny <ira.weiny@intel.com> > --- > drivers/infiniband/core/mad.c | 26 ++++++++++++++------------ > include/trace/events/ib_mad.h | 10 ++++++---- > 2 files changed, 20 insertions(+), 16 deletions(-) > > diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c > index 87eff3f3f887..0a6136dded47 100644 > --- a/drivers/infiniband/core/mad.c > +++ b/drivers/infiniband/core/mad.c > @@ -51,11 +51,14 @@ > #include "opa_smi.h" > #include "agent.h" > > +#define CREATE_TRACE_POINTS > +#include <trace/events/ib_mad.h> > + > static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, > - struct ib_mad_qp_info *qp_info, > - u32 *dlid, u8 *sl, u16 *pkey, u32 *rqpn, > - u32 *rqkey) > + struct ib_mad_qp_info *qp_info, > + struct trace_event_raw_ib_mad_send_template *entry) > { > + u16 pkey; > struct ib_device *dev = qp_info->port_priv->device; > u8 pnum = qp_info->port_priv->port_num; > struct ib_ud_wr *wr = &mad_send_wr->send_wr; > @@ -65,26 +68,25 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, > rdma_query_ah(wr->ah, &attr); > > /* These are common */ > - *sl = attr.sl; > - ib_query_pkey(dev, pnum, wr->pkey_index, pkey); > - *rqpn = wr->remote_qpn; > - *rqkey = wr->remote_qkey; > + entry->sl = attr.sl; > + ib_query_pkey(dev, pnum, wr->pkey_index, &pkey); > + entry->pkey = pkey; > + entry->rqpn = wr->remote_qpn; > + entry->rqkey = wr->remote_qkey; > > switch (attr.type) { > case RDMA_AH_ATTR_TYPE_IB: > - *dlid = attr.ib.dlid; > + entry->dlid = attr.ib.dlid; > break; > case RDMA_AH_ATTR_TYPE_OPA: > - *dlid = attr.opa.dlid; > + entry->dlid = attr.opa.dlid; > break; > case RDMA_AH_ATTR_TYPE_ROCE: > case RDMA_AH_ATTR_TYPE_UNDEFINED: > - *dlid = 0; > + entry->dlid = 0; > break; > } > } > -#define CREATE_TRACE_POINTS > -#include <trace/events/ib_mad.h> > > static int mad_sendq_size = IB_MAD_QP_SEND_SIZE; > static int mad_recvq_size = IB_MAD_QP_RECV_SIZE; > diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h > index 7f2486535d04..cccb2cf4a8f7 100644 > --- a/include/trace/events/ib_mad.h > +++ b/include/trace/events/ib_mad.h > @@ -13,6 +13,11 @@ > #include <linux/tracepoint.h> > #include <rdma/ib_mad.h> > > +struct trace_event_raw_ib_mad_send_template; > +static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, > + struct ib_mad_qp_info *qp_info, > + struct trace_event_raw_ib_mad_send_template *entry); > + > DECLARE_EVENT_CLASS(ib_mad_send_template, > TP_PROTO(struct ib_mad_send_wr_private *wr, > struct ib_mad_qp_info *qp_info), > @@ -74,10 +79,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, > ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_id; > __entry->attr_mod = > ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_mod; > - create_mad_addr_info(wr, qp_info, > - &__entry->dlid, &__entry->sl, > - &__entry->pkey, &__entry->rqpn, > - &__entry->rqkey); > + create_mad_addr_info(wr, qp_info, __entry); > ), > > TP_printk("%d:%d QP%d agent %p: " \
Yes... Thanks! > -----Original Message----- > From: Steven Rostedt [mailto:rostedt@goodmis.org] > Sent: Friday, March 01, 2019 10:37 AM > To: Weiny, Ira <ira.weiny@intel.com> > Cc: Jason Gunthorpe <jgg@ziepe.ca>; linux-rdma@vger.kernel.org; Ingo > Molnar <mingo@redhat.com> > Subject: Re: [PATCH] IB/MAD: Use trace struct in create_mad_addr_info() > helper > > On Thu, 28 Feb 2019 14:05:11 -0800 > ira.weiny@intel.com wrote: > > > From: Ira Weiny <ira.weiny@intel.com> > > > > Using a structure pointer is more efficient in the helper. > > > > Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> > > ;-) > > -- Steve > > > Signed-off-by: Ira Weiny <ira.weiny@intel.com> > > --- > > drivers/infiniband/core/mad.c | 26 ++++++++++++++------------ > > include/trace/events/ib_mad.h | 10 ++++++---- > > 2 files changed, 20 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/infiniband/core/mad.c > > b/drivers/infiniband/core/mad.c index 87eff3f3f887..0a6136dded47 > > 100644 > > --- a/drivers/infiniband/core/mad.c > > +++ b/drivers/infiniband/core/mad.c > > @@ -51,11 +51,14 @@ > > #include "opa_smi.h" > > #include "agent.h" > > > > +#define CREATE_TRACE_POINTS > > +#include <trace/events/ib_mad.h> > > + > > static void create_mad_addr_info(struct ib_mad_send_wr_private > *mad_send_wr, > > - struct ib_mad_qp_info *qp_info, > > - u32 *dlid, u8 *sl, u16 *pkey, u32 *rqpn, > > - u32 *rqkey) > > + struct ib_mad_qp_info *qp_info, > > + struct trace_event_raw_ib_mad_send_template > *entry) > > { > > + u16 pkey; > > struct ib_device *dev = qp_info->port_priv->device; > > u8 pnum = qp_info->port_priv->port_num; > > struct ib_ud_wr *wr = &mad_send_wr->send_wr; @@ -65,26 > +68,25 @@ > > static void create_mad_addr_info(struct ib_mad_send_wr_private > *mad_send_wr, > > rdma_query_ah(wr->ah, &attr); > > > > /* These are common */ > > - *sl = attr.sl; > > - ib_query_pkey(dev, pnum, wr->pkey_index, pkey); > > - *rqpn = wr->remote_qpn; > > - *rqkey = wr->remote_qkey; > > + entry->sl = attr.sl; > > + ib_query_pkey(dev, pnum, wr->pkey_index, &pkey); > > + entry->pkey = pkey; > > + entry->rqpn = wr->remote_qpn; > > + entry->rqkey = wr->remote_qkey; > > > > switch (attr.type) { > > case RDMA_AH_ATTR_TYPE_IB: > > - *dlid = attr.ib.dlid; > > + entry->dlid = attr.ib.dlid; > > break; > > case RDMA_AH_ATTR_TYPE_OPA: > > - *dlid = attr.opa.dlid; > > + entry->dlid = attr.opa.dlid; > > break; > > case RDMA_AH_ATTR_TYPE_ROCE: > > case RDMA_AH_ATTR_TYPE_UNDEFINED: > > - *dlid = 0; > > + entry->dlid = 0; > > break; > > } > > } > > -#define CREATE_TRACE_POINTS > > -#include <trace/events/ib_mad.h> > > > > static int mad_sendq_size = IB_MAD_QP_SEND_SIZE; static int > > mad_recvq_size = IB_MAD_QP_RECV_SIZE; diff --git > > a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index > > 7f2486535d04..cccb2cf4a8f7 100644 > > --- a/include/trace/events/ib_mad.h > > +++ b/include/trace/events/ib_mad.h > > @@ -13,6 +13,11 @@ > > #include <linux/tracepoint.h> > > #include <rdma/ib_mad.h> > > > > +struct trace_event_raw_ib_mad_send_template; > > +static void create_mad_addr_info(struct ib_mad_send_wr_private > *mad_send_wr, > > + struct ib_mad_qp_info *qp_info, > > + struct trace_event_raw_ib_mad_send_template > *entry); > > + > > DECLARE_EVENT_CLASS(ib_mad_send_template, > > TP_PROTO(struct ib_mad_send_wr_private *wr, > > struct ib_mad_qp_info *qp_info), > > @@ -74,10 +79,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, > > ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_id; > > __entry->attr_mod = > > ((struct ib_mad_hdr *)wr->send_buf.mad)- > >attr_mod; > > - create_mad_addr_info(wr, qp_info, > > - &__entry->dlid, &__entry->sl, > > - &__entry->pkey, &__entry->rqpn, > > - &__entry->rqkey); > > + create_mad_addr_info(wr, qp_info, __entry); > > ), > > > > TP_printk("%d:%d QP%d agent %p: " \
On Thu, Feb 28, 2019 at 02:05:11PM -0800, 'Ira Weiny' wrote: > From: Ira Weiny <ira.weiny@intel.com> > > Using a structure pointer is more efficient in the helper. This failed a random config build in 0-day. I've not looked at it in detail yet but we should skip this follow on until I can figure out what random config resulted in struct trace_event_raw_ib_mad_send_template from being defined during the compile of create_mad_addr_info(). :-( Ira > > Signed-off-by: Ira Weiny <ira.weiny@intel.com> > --- > drivers/infiniband/core/mad.c | 26 ++++++++++++++------------ > include/trace/events/ib_mad.h | 10 ++++++---- > 2 files changed, 20 insertions(+), 16 deletions(-) > > diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c > index 87eff3f3f887..0a6136dded47 100644 > --- a/drivers/infiniband/core/mad.c > +++ b/drivers/infiniband/core/mad.c > @@ -51,11 +51,14 @@ > #include "opa_smi.h" > #include "agent.h" > > +#define CREATE_TRACE_POINTS > +#include <trace/events/ib_mad.h> > + > static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, > - struct ib_mad_qp_info *qp_info, > - u32 *dlid, u8 *sl, u16 *pkey, u32 *rqpn, > - u32 *rqkey) > + struct ib_mad_qp_info *qp_info, > + struct trace_event_raw_ib_mad_send_template *entry) > { > + u16 pkey; > struct ib_device *dev = qp_info->port_priv->device; > u8 pnum = qp_info->port_priv->port_num; > struct ib_ud_wr *wr = &mad_send_wr->send_wr; > @@ -65,26 +68,25 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, > rdma_query_ah(wr->ah, &attr); > > /* These are common */ > - *sl = attr.sl; > - ib_query_pkey(dev, pnum, wr->pkey_index, pkey); > - *rqpn = wr->remote_qpn; > - *rqkey = wr->remote_qkey; > + entry->sl = attr.sl; > + ib_query_pkey(dev, pnum, wr->pkey_index, &pkey); > + entry->pkey = pkey; > + entry->rqpn = wr->remote_qpn; > + entry->rqkey = wr->remote_qkey; > > switch (attr.type) { > case RDMA_AH_ATTR_TYPE_IB: > - *dlid = attr.ib.dlid; > + entry->dlid = attr.ib.dlid; > break; > case RDMA_AH_ATTR_TYPE_OPA: > - *dlid = attr.opa.dlid; > + entry->dlid = attr.opa.dlid; > break; > case RDMA_AH_ATTR_TYPE_ROCE: > case RDMA_AH_ATTR_TYPE_UNDEFINED: > - *dlid = 0; > + entry->dlid = 0; > break; > } > } > -#define CREATE_TRACE_POINTS > -#include <trace/events/ib_mad.h> > > static int mad_sendq_size = IB_MAD_QP_SEND_SIZE; > static int mad_recvq_size = IB_MAD_QP_RECV_SIZE; > diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h > index 7f2486535d04..cccb2cf4a8f7 100644 > --- a/include/trace/events/ib_mad.h > +++ b/include/trace/events/ib_mad.h > @@ -13,6 +13,11 @@ > #include <linux/tracepoint.h> > #include <rdma/ib_mad.h> > > +struct trace_event_raw_ib_mad_send_template; > +static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, > + struct ib_mad_qp_info *qp_info, > + struct trace_event_raw_ib_mad_send_template *entry); > + > DECLARE_EVENT_CLASS(ib_mad_send_template, > TP_PROTO(struct ib_mad_send_wr_private *wr, > struct ib_mad_qp_info *qp_info), > @@ -74,10 +79,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, > ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_id; > __entry->attr_mod = > ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_mod; > - create_mad_addr_info(wr, qp_info, > - &__entry->dlid, &__entry->sl, > - &__entry->pkey, &__entry->rqpn, > - &__entry->rqkey); > + create_mad_addr_info(wr, qp_info, __entry); > ), > > TP_printk("%d:%d QP%d agent %p: " \ > -- > 2.20.1 >
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 87eff3f3f887..0a6136dded47 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -51,11 +51,14 @@ #include "opa_smi.h" #include "agent.h" +#define CREATE_TRACE_POINTS +#include <trace/events/ib_mad.h> + static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, - struct ib_mad_qp_info *qp_info, - u32 *dlid, u8 *sl, u16 *pkey, u32 *rqpn, - u32 *rqkey) + struct ib_mad_qp_info *qp_info, + struct trace_event_raw_ib_mad_send_template *entry) { + u16 pkey; struct ib_device *dev = qp_info->port_priv->device; u8 pnum = qp_info->port_priv->port_num; struct ib_ud_wr *wr = &mad_send_wr->send_wr; @@ -65,26 +68,25 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, rdma_query_ah(wr->ah, &attr); /* These are common */ - *sl = attr.sl; - ib_query_pkey(dev, pnum, wr->pkey_index, pkey); - *rqpn = wr->remote_qpn; - *rqkey = wr->remote_qkey; + entry->sl = attr.sl; + ib_query_pkey(dev, pnum, wr->pkey_index, &pkey); + entry->pkey = pkey; + entry->rqpn = wr->remote_qpn; + entry->rqkey = wr->remote_qkey; switch (attr.type) { case RDMA_AH_ATTR_TYPE_IB: - *dlid = attr.ib.dlid; + entry->dlid = attr.ib.dlid; break; case RDMA_AH_ATTR_TYPE_OPA: - *dlid = attr.opa.dlid; + entry->dlid = attr.opa.dlid; break; case RDMA_AH_ATTR_TYPE_ROCE: case RDMA_AH_ATTR_TYPE_UNDEFINED: - *dlid = 0; + entry->dlid = 0; break; } } -#define CREATE_TRACE_POINTS -#include <trace/events/ib_mad.h> static int mad_sendq_size = IB_MAD_QP_SEND_SIZE; static int mad_recvq_size = IB_MAD_QP_RECV_SIZE; diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index 7f2486535d04..cccb2cf4a8f7 100644 --- a/include/trace/events/ib_mad.h +++ b/include/trace/events/ib_mad.h @@ -13,6 +13,11 @@ #include <linux/tracepoint.h> #include <rdma/ib_mad.h> +struct trace_event_raw_ib_mad_send_template; +static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr, + struct ib_mad_qp_info *qp_info, + struct trace_event_raw_ib_mad_send_template *entry); + DECLARE_EVENT_CLASS(ib_mad_send_template, TP_PROTO(struct ib_mad_send_wr_private *wr, struct ib_mad_qp_info *qp_info), @@ -74,10 +79,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_id; __entry->attr_mod = ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_mod; - create_mad_addr_info(wr, qp_info, - &__entry->dlid, &__entry->sl, - &__entry->pkey, &__entry->rqpn, - &__entry->rqkey); + create_mad_addr_info(wr, qp_info, __entry); ), TP_printk("%d:%d QP%d agent %p: " \