IB CM tracepoints
Subsystems (3)
v3 cover IB CM tracepoints
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Change since v2:
* Rebase on v5.9-rc1
Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Display ib_cm_events, not ib_events
---
Chuck Lever (3):
RDMA/core: Move the rdma_show_ib_cm_event() macro RDMA/cm: Replace pr_debug() call sites with tracepoints RDMA/cm: Add tracepoints to track MAD send operations
drivers/infiniband/core/Makefile | 2 +- drivers/infiniband/core/cm.c | 102 ++++--- drivers/infiniband/core/cm_trace.c | 15 ++ drivers/infiniband/core/cm_trace.h | 414 +++++++++++++++++++++++++++++ 4 files changed, 476 insertions(+), 57 deletions(-) create mode 100644 drivers/infiniband/core/cm_trace.c create mode 100644 drivers/infiniband/core/cm_trace.h
--
Chuck Lever
PATCH v3 1/3 RDMA/core: Move the rdma_show_ib_cm_event() macro
Refactor: Make it globally available in the utilities header.
--- drivers/infiniband/core/cma_trace.h | 40 ---------------------------------- include/trace/events/rdma.h | 41 ++++++++++++++++++++++++++++++++++- include/trace/events/rpcrdma.h | 1 + 3 files changed, 41 insertions(+), 41 deletions(-)
drivers/infiniband/core/cma_trace.h +0 -40
@@ -17,46 +17,6 @@#include <linux/tracepoint.h> #include <trace/events/rdma.h> -/* -* enum ib_cm_event_type, from include/rdma/ib_cm.h -*/ -#define IB_CM_EVENT_LIST \ - ib_cm_event(REQ_ERROR) \ - ib_cm_event(REQ_RECEIVED) \ - ib_cm_event(REP_ERROR) \ - ib_cm_event(REP_RECEIVED) \ - ib_cm_event(RTU_RECEIVED) \ - ib_cm_event(USER_ESTABLISHED) \ - ib_cm_event(DREQ_ERROR) \ - ib_cm_event(DREQ_RECEIVED) \ - ib_cm_event(DREP_RECEIVED) \ - ib_cm_event(TIMEWAIT_EXIT) \ - ib_cm_event(MRA_RECEIVED) \ - ib_cm_event(REJ_RECEIVED) \ - ib_cm_event(LAP_ERROR) \ - ib_cm_event(LAP_RECEIVED) \ - ib_cm_event(APR_RECEIVED) \ - ib_cm_event(SIDR_REQ_ERROR) \ - ib_cm_event(SIDR_REQ_RECEIVED) \ - ib_cm_event_end(SIDR_REP_RECEIVED) - -#undef ib_cm_event -#undef ib_cm_event_end - -#define ib_cm_event (x) TRACE_DEFINE_ENUM(IB_CM_##x); -#define ib_cm_event_end (x) TRACE_DEFINE_ENUM(IB_CM_##x); - -IB_CM_EVENT_LIST - -#undef ib_cm_event -#undef ib_cm_event_end - -#define ib_cm_event (x) { IB_CM_##x, #x }, -#define ib_cm_event_end (x) { IB_CM_##x, #x } - -#define rdma_show_ib_cm_event (x) \ - __print_symbolic(x, IB_CM_EVENT_LIST) - DECLARE_EVENT_CLASS(cma_fsm_class, TP_PROTO(
include/trace/events/rdma.h +40 -1
53 lines not on this page · raw message
include/trace/events/rpcrdma.h +1 -0
@@ -13,6 +13,7 @@#include <linux/scatterlist.h> #include <linux/sunrpc/rpc_rdma_cid.h> #include <linux/tracepoint.h> +#include <rdma/ib_cm.h> #include <trace/events/rdma.h> /**
PATCH v3 2/3 RDMA/cm: Replace pr_debug() call sites with tracepoints
In reply to Chuck LeverIn the interest of converging on a common instrumentation infrastructure, modernize the pr_debug() call sites added by commit 119bf81793ea ("IB/cm: Add debug prints to ib_cm"). The new tracepoints appear in a new "ib_cma" subsystem.
The conversion is somewhat mechanical. Someone more familiar with the semantics of the recorded information might suggest additional data capture.
Some benefits include:
- Tracepoints enable "always on" reporting of these errors
- The error records are structured and compact
- Tracepoints provide hooks for eBPF scripts
Sample output:
nfsd-1954 [003] 62.017901: icm_dreq_skipped: local_id=1998890974 remote_id=1129750393 state=DREQ_RCVD lap_state=LAP_UNINIT
--- drivers/infiniband/core/Makefile | 2 drivers/infiniband/core/cm.c | 80 +++------ drivers/infiniband/core/cm_trace.c | 15 ++ drivers/infiniband/core/cm_trace.h | 309 ++++++++++++++++++++++++++++++++++++ 4 files changed, 351 insertions(+), 55 deletions(-) create mode 100644 drivers/infiniband/core/cm_trace.c create mode 100644 drivers/infiniband/core/cm_trace.h
drivers/infiniband/core/Makefile +1 -1
@@ -17,7 +17,7 @@ ib_core-y := packer.o ud_header.o verbs.o cq.o rw.o sysfs.o \ ib_core-$(CONFIG_SECURITY_INFINIBAND) += security.o ib_core-$(CONFIG_CGROUP_RDMA) += cgroup.o -ib_cm-y := cm.o +ib_cm-y := cm.o cm_trace.o iw_cm-y := iwcm.o iwpm_util.o iwpm_msg.o
drivers/infiniband/core/cm.c +26 -54
213 lines not on this page · raw message
drivers/infiniband/core/cm_trace.c new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Trace points for the IB Connection Manager. +* +* Author: Chuck Lever <[email protected]> +* +* Copyright (c) 2020, Oracle and/or its affiliates. +*/ + +#include <rdma/rdma_cm.h> +#include "cma_priv.h" + +#define CREATE_TRACE_POINTS + +#include "cm_trace.h"
drivers/infiniband/core/cm_trace.h new file +309 -0
309 lines not on this page · raw message
PATCH v3 3/3 RDMA/cm: Add tracepoints to track MAD send operations
In reply to Chuck LeverSurface the operation of MAD exchanges during connection establishment. Some samples:
[root@klimt ~]# trace-cmd report -F ib_cma
cpus=4
kworker/0:4-123 [000] 60.677388: icm_send_rep: local_id=1965336542 remote_id=1096195961 state=REQ_RCVD lap_state=LAP_UNINIT
kworker/u8:11-391 [002] 60.678808: icm_send_req: local_id=1982113758 remote_id=0 state=IDLE lap_state=LAP_UNINIT
kworker/0:4-123 [000] 60.679652: icm_send_rtu: local_id=1982113758 remote_id=1079418745 state=REP_RCVD lap_state=LAP_UNINIT
nfsd-1954 [001] 60.691350: icm_send_rep: local_id=1998890974 remote_id=1129750393 state=MRA_REQ_SENT lap_state=LAP_UNINIT
nfsd-1954 [003] 62.017931: icm_send_drep: local_id=1998890974 remote_id=1129750393 state=TIMEWAIT lap_state=LAP_UNINIT--- drivers/infiniband/core/cm.c | 22 +++++++- drivers/infiniband/core/cm_trace.h | 105 ++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +20 -2
@@ -1564,6 +1564,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id, cm_id_priv->local_qpn =cpu_to_be32 (IBA_GET (CM_REQ_LOCAL_QPN , req_msg)); cm_id_priv->rq_psn =cpu_to_be32 (IBA_GET (CM_REQ_STARTING_PSN , req_msg)); +trace_icm_send_req (&cm_id_priv->id);spin_lock_irqsave (&cm_id_priv->lock, flags); ret =ib_post_send_mad (cm_id_priv->msg,NULL );if (ret) {
@@ -1611,6 +1612,9 @@ static int cm_issue_rej(struct cm_port *port,IBA_SET_MEM (CM_REJ_ARI , rej_msg, ari, ari_length); } +trace_icm_issue_rej ( +IBA_GET (CM_REJ_LOCAL_COMM_ID , rcv_msg), +IBA_GET (CM_REJ_REMOTE_COMM_ID , rcv_msg)); ret =ib_post_send_mad (msg,NULL );if (ret)cm_free_msg (msg);
@@ -1962,6 +1966,7 @@ static void cm_dup_req_handler(struct cm_work *work, }spin_unlock_irq (&cm_id_priv->lock); +trace_icm_send_dup_req (&cm_id_priv->id); ret =ib_post_send_mad (msg,NULL );if (ret) goto free;
@@ -2288,6 +2293,7 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id, msg->timeout_ms = cm_id_priv->timeout_ms; msg->context[1 ] = (void *) (unsigned long )IB_CM_REP_SENT ; +trace_icm_send_rep (cm_id); ret =ib_post_send_mad (msg,NULL );if (ret) {spin_unlock_irqrestore (&cm_id_priv->lock, flags);
@@ -2359,6 +2365,7 @@ int ib_send_cm_rtu(struct ib_cm_id *cm_id,cm_format_rtu ((struct cm_rtu_msg *) msg->mad, cm_id_priv, private_data, private_data_len); +trace_icm_send_rtu (cm_id); ret =ib_post_send_mad (msg,NULL );if (ret) {spin_unlock_irqrestore (&cm_id_priv->lock, flags);
@@ -2440,6 +2447,7 @@ static void cm_dup_rep_handler(struct cm_work *work) goto unlock;spin_unlock_irq (&cm_id_priv->lock); +trace_icm_send_dup_rep (&cm_id_priv->id); ret =ib_post_send_mad (msg,NULL );if (ret) goto free;
@@ -2661,6 +2669,7 @@ static int cm_send_dreq_locked(struct cm_id_private *cm_id_priv, msg->timeout_ms = cm_id_priv->timeout_ms; msg->context[1 ] = (void *) (unsigned long )IB_CM_DREQ_SENT ; +trace_icm_send_dreq (&cm_id_priv->id); ret =ib_post_send_mad (msg,NULL );if (ret) {cm_enter_timewait (cm_id_priv);
@@ -2731,6 +2740,7 @@ static int cm_send_drep_locked(struct cm_id_private *cm_id_priv,cm_format_drep ((struct cm_drep_msg *) msg->mad, cm_id_priv, private_data, private_data_len); +trace_icm_send_drep (&cm_id_priv->id); ret =ib_post_send_mad (msg,NULL );if (ret) {cm_free_msg (msg);
@@ -2780,6 +2790,9 @@ static int cm_issue_drep(struct cm_port *port,IBA_SET (CM_DREP_LOCAL_COMM_ID , drep_msg,IBA_GET (CM_DREQ_REMOTE_COMM_ID , dreq_msg)); +trace_icm_issue_drep ( +IBA_GET (CM_DREQ_LOCAL_COMM_ID , dreq_msg), +IBA_GET (CM_DREQ_REMOTE_COMM_ID , dreq_msg)); ret =ib_post_send_mad (msg,NULL );if (ret)cm_free_msg (msg);
@@ -2937,6 +2950,7 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv,return -EINVAL ; } +trace_icm_send_rej (&cm_id_priv->id, reason); ret =ib_post_send_mad (msg,NULL );if (ret) {cm_free_msg (msg);
@@ -3115,6 +3129,7 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,cm_format_mra ((struct cm_mra_msg *) msg->mad, cm_id_priv, msg_response, service_timeout, private_data, private_data_len); +trace_icm_send_mra (cm_id); ret =ib_post_send_mad (msg,NULL );if (ret) goto error2;
@@ -3485,10 +3500,12 @@ int ib_send_cm_sidr_req(struct ib_cm_id *cm_id, msg->context[1 ] = (void *) (unsigned long )IB_CM_SIDR_REQ_SENT ;spin_lock_irqsave (&cm_id_priv->lock, flags); -if (cm_id->state ==IB_CM_IDLE ) +if (cm_id->state ==IB_CM_IDLE ) { +trace_icm_send_sidr_req (&cm_id_priv->id); ret =ib_post_send_mad (msg,NULL ); -else + }else { ret = -EINVAL ; + }if (ret) {spin_unlock_irqrestore (&cm_id_priv->lock, flags);
@@ -3650,6 +3667,7 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv,cm_format_sidr_rep ((struct cm_sidr_rep_msg *) msg->mad, cm_id_priv, param); +trace_icm_send_sidr_rep (&cm_id_priv->id); ret =ib_post_send_mad (msg,NULL );if (ret) {cm_free_msg (msg);
drivers/infiniband/core/cm_trace.h +105 -0
123 lines not on this page · raw message
Jason Gunthorpe
maintainerQuoted 6 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Quoted 8 lines
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_events
Doesn't compile:
In file included from drivers/infiniband/core/cm_trace.h:414,
from drivers/infiniband/core/cm_trace.c:15:./include/trace/define_trace.h:95:42: fatal error: ./cm_trace.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
Jason
Quoted 20 lines · Jason Gunthorpe
Quoted 6 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Quoted 8 lines
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_events
Quoted 8 lines
Doesn't compile:
In file included from
drivers/infiniband/core/cm_trace.h:414,
fromdrivers/infiniband/core/cm_trace.c:15:./include/trace/define_trace.h:95:42: fatal error: ./cm_trace.h: No such file or directory
95 | #includeTRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
I've been using these patches for several weeks, so WFM. I'll have a look.
--
Chuck Lever
Quoted 20 lines · Jason Gunthorpe
Quoted 6 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Quoted 8 lines
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_events
Quoted 8 lines
Doesn't compile:
In file included from
drivers/infiniband/core/cm_trace.h:414,
fromdrivers/infiniband/core/cm_trace.c:15:./include/trace/define_trace.h:95:42: fatal error: ./cm_trace.h: No such file or directory
95 | #includeTRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
I am not able to reproduce this failure.
gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1)
What if you edit drivers/infiniband/core/cm_trace.h and change the definition of TRACE_INCLUDE_PATH from "." to "../../drivers/infiniband/core" ?
--
Chuck Lever
Jason Gunthorpe
maintainerQuoted 29 lines · Chuck Lever
Quoted 20 lines · Jason Gunthorpe
Quoted 6 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Quoted 8 lines
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_eventsQuoted 8 lines
Doesn't compile:
In file included from
drivers/infiniband/core/cm_trace.h:414,
fromdrivers/infiniband/core/cm_trace.c:15:./include/trace/define_trace.h:95:42: fatal error: ./cm_trace.h: No such file or directory
95 | #includeTRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
Quoted 3 lines
I am not able to reproduce this failure.
gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1)
Yep, using gcc 10 too
Start from a clean tree?
Quoted 3 lines
What if you edit
drivers/infiniband/core/cm_trace.hand change the definition ofTRACE_INCLUDE_PATHfrom "." to "../../drivers/infiniband/core" ?
It works
It is because ./ is relative to include/trace/define_trace.h ?
Jason
Quoted 34 lines · Jason Gunthorpe
Quoted 29 lines · Chuck Lever
Quoted 28 lines · Jason Gunthorpe
Quoted 6 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Quoted 8 lines
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_eventsDoesn't compile:
In file included from
drivers/infiniband/core/cm_trace.h:414,
fromdrivers/infiniband/core/cm_trace.c:15:./include/trace/define_trace.h:95:42: fatal error: ./cm_trace.h: No such file or directory
95 | #includeTRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
Quoted 7 lines
Quoted 3 lines
I am not able to reproduce this failure.
gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1)
Yep, using gcc 10 too
Start from a clean tree?
Always.
Quoted 7 lines
Quoted 3 lines
What if you edit
drivers/infiniband/core/cm_trace.hand change the definition ofTRACE_INCLUDE_PATHfrom "." to "../../drivers/infiniband/core" ?It works
It is because ./ is relative to
include/trace/define_trace.h?
Yes.
It appears that the many instances of "#define TRACE_INCLUDE_PATH ." already in the kernel are each accompanied by Makefile magic to make that work correctly. I neglected (again) to add that.
But now that I've read the instructions in include/trace/define_trace.h, I prefer using a full relative path instead of "."-with-Makefile.
Do I need to send a v4?
--
Chuck Lever
Quoted 55 lines · Chuck Lever
Quoted 34 lines · Jason Gunthorpe
Quoted 29 lines · Chuck Lever
Quoted 28 lines · Jason Gunthorpe
Quoted 6 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Quoted 8 lines
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_eventsDoesn't compile:
In file included from
drivers/infiniband/core/cm_trace.h:414,
fromdrivers/infiniband/core/cm_trace.c:15:./include/trace/define_trace.h:95:42: fatal error: ./cm_trace.h: No such file or directory
95 | #includeTRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.Quoted 7 lines
Quoted 3 lines
I am not able to reproduce this failure.
gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1)
Yep, using gcc 10 too
Start from a clean tree?
Always.
Quoted 7 lines
Quoted 3 lines
What if you edit
drivers/infiniband/core/cm_trace.hand change the definition ofTRACE_INCLUDE_PATHfrom "." to "../../drivers/infiniband/core" ?It works
It is because ./ is relative to
include/trace/define_trace.h?Yes.
Quoted 8 lines
It appears that the many instances of "#define
TRACE_INCLUDE_PATH." already in the kernel are each accompanied byMakefilemagic to make that work correctly. I neglected (again) to add that.But now that I've read the instructions in
include/trace/define_trace.h, I prefer using a full relative path instead of "."-with-Makefile.Do I need to send a v4?
No, I fixed it
Jason
Quoted 16 lines · Chuck Lever
Oracle has an interest in a common observability infrastructure in the RDMA core and ULPs. Introduce static tracepoints that can also be used as hooks for eBPF scripts, replacing infrastructure that is based on printk. This takes the same approach as tracepoints added recently in the RDMA CM.
Change since v2:
* Rebase on v5.9-rc1Changes since RFC:
* Correct spelling of example tracepoint in patch description
* Newer tool chains don't care for tracepoints with the same name in different subsystems
* Displayib_cm_events, notib_events
Quoted 4 lines
Chuck Lever (3):
RDMA/core: Move therdma_show_ib_cm_event()macro RDMA/cm: Replacepr_debug()call sites with tracepoints RDMA/cm: Add tracepoints to track MAD send operations
Applied to for-next, thanks
Jason