Proposed trace points for RDMA/core
Subsystems (2)
v7 cover Proposed trace points for RDMA/core
These two patches apply independently of each other to v5.4-rc8.
Changes since v6:
- Move include/trace/events/rmda_cma.h to drivers/infiniband/core/cma_trace.h
- Add sample trace log output to the patch descriptions
- Back to the inlined version of ib_poll_cq()
Changes since v5:
- Add low-overhead trace points in the Connection Manager
- Address #include heartburn found by lkp
Changes since v4:
- Removed __ib_poll_cq, uninlined ib_poll_cq
Changes since v3:
- Reverted unnecessary behavior change in __ib_process_cq
- Clarified what "id" is in trace point output
- Added comment before new fields in struct ib_cq
- New trace point that fires when there is a CQ allocation failure
Changes since v2:
- Removed extraneous changes to include/trace/events/rdma.h
Changes since RFC:
- Display CQ's global resource ID instead of it's pointer address
---
Chuck Lever (2):
RDMA/core: Trace points for diagnosing completion queue issues RDMA/cma: Add trace points in RDMA Connection Manager
drivers/infiniband/core/Makefile | 4 - drivers/infiniband/core/cma.c | 59 ++++++-- drivers/infiniband/core/cma_trace.c | 16 ++ drivers/infiniband/core/cma_trace.h | 219 +++++++++++++++++++++++++++++++ drivers/infiniband/core/cq.c | 27 +++- drivers/infiniband/core/trace.c | 14 ++ include/rdma/ib_verbs.h | 5 + include/trace/events/rdma_core.h | 250 +++++++++++++++++++++++++++++++++++ 8 files changed, 573 insertions(+), 21 deletions(-) create mode 100644 drivers/infiniband/core/cma_trace.c create mode 100644 drivers/infiniband/core/cma_trace.h create mode 100644 drivers/infiniband/core/trace.c create mode 100644 include/trace/events/rdma_core.h
--
Chuck Lever
PATCH v7 1/2 RDMA/core: Trace points for diagnosing completion queue issues
Sample trace events:
kworker/u29:0-300 [007] 120.042217: cq_alloc: cq.id=4 nr_cqe=161 comp_vector=2 poll_ctx=WORKQUEUE
<idle>-0 [002] 120.056292: cq_schedule: cq.id=4
kworker/2:1H-482 [002] 120.056402: cq_process: cq.id=4 wake-up took 109 [us] from interrupt
kworker/2:1H-482 [002] 120.056407: cq_poll: cq.id=4 requested 16, returned 1
<idle>-0 [002] 120.067503: cq_schedule: cq.id=4
kworker/2:1H-482 [002] 120.067537: cq_process: cq.id=4 wake-up took 34 [us] from interrupt
kworker/2:1H-482 [002] 120.067541: cq_poll: cq.id=4 requested 16, returned 1
<idle>-0 [002] 120.067657: cq_schedule: cq.id=4
kworker/2:1H-482 [002] 120.067672: cq_process: cq.id=4 wake-up took 15 [us] from interrupt
kworker/2:1H-482 [002] 120.067674: cq_poll: cq.id=4 requested 16, returned 1...
systemd-1 [002] 122.392653: cq_schedule: cq.id=4
kworker/2:1H-482 [002] 122.392688: cq_process: cq.id=4 wake-up took 35 [us] from interrupt
kworker/2:1H-482 [002] 122.392693: cq_poll: cq.id=4 requested 16, returned 16
kworker/2:1H-482 [002] 122.392836: cq_poll: cq.id=4 requested 16, returned 16
kworker/2:1H-482 [002] 122.392970: cq_poll: cq.id=4 requested 16, returned 16
kworker/2:1H-482 [002] 122.393083: cq_poll: cq.id=4 requested 16, returned 16
kworker/2:1H-482 [002] 122.393195: cq_poll: cq.id=4 requested 16, returned 3Several features to note in this output:
- The WCE count and context type are reported at allocation time
- The CPU and kworker for each CQ is evident
- The CQ's restracker ID is tagged on each trace event
- CQ poll scheduling latency is measured
- Details about how often single completions occur versus multiple completions are evident
- The cost of the ULP's completion handler is recorded
--- drivers/infiniband/core/Makefile | 2 drivers/infiniband/core/cq.c | 27 ++++ drivers/infiniband/core/trace.c | 14 ++ include/rdma/ib_verbs.h | 5 + include/trace/events/rdma_core.h | 250 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 294 insertions(+), 4 deletions(-) create mode 100644 drivers/infiniband/core/trace.c create mode 100644 include/trace/events/rdma_core.h
drivers/infiniband/core/Makefile +1 -1
@@ -11,7 +11,7 @@ ib_core-y := packer.o ud_header.o verbs.o cq.o rw.o sysfs.o \ device.o fmr_pool.o cache.o netlink.o \ roce_gid_mgmt.o mr_pool.o addr.o sa_query.o \ multicast.o mad.o smi.o agent.o mad_rmpp.o \ - nldev.o restrack.o counters.o + nldev.o restrack.o counters.o trace.o ib_core-$(CONFIG_SECURITY_INFINIBAND) += security.o ib_core-$(CONFIG_CGROUP_RDMA) += cgroup.o
drivers/infiniband/core/cq.c +24 -3
@@ -7,6 +7,8 @@#include <linux/slab.h> #include <rdma/ib_verbs.h> +#include <trace/events/rdma_core.h> +/* # of WCs to poll for with a single call to ib_poll_cq */ #define IB_POLL_BATCH 16#define IB_POLL_BATCH_DIRECT 8
@@ -41,6 +43,7 @@ static void ib_cq_rdma_dim_work(struct work_struct *w) dim->state =DIM_START_MEASURE ; +trace_cq_modify (cq, comps, usec); cq->device->ops.modify_cq (cq, comps, usec); }
@@ -65,18 +68,29 @@ static void rdma_dim_init(struct ib_cq *cq)INIT_WORK (&dim->work, ib_cq_rdma_dim_work); } +static int __poll_cq (struct ib_cq *cq,int num_entries,struct ib_wc *wc) +{ +int rc; + + rc =ib_poll_cq (cq, num_entries, wc); +trace_cq_poll (cq, num_entries, rc); +return rc; +} +static int __ib_process_cq (struct ib_cq *cq,int budget,struct ib_wc *wcs,int batch) {int i, n, completed =0 ; +trace_cq_process (cq); +/* * budget might be (-1) if the caller does not * want to bound this call, thus we need unsigned * minimum here. */ -while ((n =ib_poll_cq (cq,min_t (u32, batch, - budget - completed), wcs)) >0 ) { +while ((n =__poll_cq (cq,min_t (u32, batch, + budget - completed), wcs)) >0 ) {for (i =0 ; i < n; i++) {struct ib_wc *wc = &wcs[i];
@@ -131,8 +145,10 @@ static int ib_poll_handler(struct irq_poll *iop, int budget) completed =__ib_process_cq (cq, budget, cq->wc,IB_POLL_BATCH );if (completed < budget) {irq_poll_complete (&cq->iop); -if (ib_req_notify_cq (cq,IB_POLL_FLAGS ) >0 ) +if (ib_req_notify_cq (cq,IB_POLL_FLAGS ) >0 ) { +trace_cq_reschedule (cq);irq_poll_sched (&cq->iop); + } }if (dim)
@@ -143,6 +159,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget)static void ib_cq_completion_softirq (struct ib_cq *cq,void *private) { +trace_cq_schedule (cq);irq_poll_sched (&cq->iop); }
@@ -162,6 +179,7 @@ static void ib_cq_poll_work(struct work_struct *work)static void ib_cq_completion_workqueue (struct ib_cq *cq,void *private) { +trace_cq_schedule (cq);queue_work (cq->comp_wq, &cq->work); }
@@ -239,6 +257,7 @@ struct ib_cq *__ib_alloc_cq_user(struct ib_device *dev, void *private, goto out_destroy_cq; } +trace_cq_alloc (cq, nr_cqe, comp_vector, poll_ctx);return cq; out_destroy_cq:
@@ -248,6 +267,7 @@ struct ib_cq *__ib_alloc_cq_user(struct ib_device *dev, void *private,kfree (cq->wc); out_free_cq:kfree (cq); +trace_cq_alloc_error (nr_cqe, comp_vector, poll_ctx, ret);return ERR_PTR (ret); }EXPORT_SYMBOL (__ib_alloc_cq_user);
@@ -304,6 +324,7 @@ void ib_free_cq_user(struct ib_cq *cq, struct ib_udata *udata)WARN_ON_ONCE (1 ); } +trace_cq_free (cq);rdma_restrack_del (&cq->res); cq->device->ops.destroy_cq (cq, udata);if (cq->dim)
drivers/infiniband/core/trace.c new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Trace points for core RDMA functions. +* +* Author: Chuck Lever <[email protected]> +* +* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +*/ + +#define CREATE_TRACE_POINTS + +#include <rdma/ib_verbs.h> + +#include <trace/events/rdma_core.h>
include/rdma/ib_verbs.h +5 -0
@@ -1555,6 +1555,11 @@ struct ib_cq { };struct workqueue_struct *comp_wq;struct dim *dim; + +/* updated only by trace points */ +ktime_t timestamp; +bool interrupt; +/* * Implementation details of the RDMA core, don't use in drivers: */
include/trace/events/rdma_core.h new file +250 -0
250 lines not on this page · raw message
PATCH v7 2/2 RDMA/cma: Add trace points in RDMA Connection Manager
In reply to Chuck LeverRecord state transitions as each connection is established. The IP address of both peers and the Type of Service is reported. These trace points are not in performance hot paths.
Also, record each cm_event_handler call to ULPs. This eliminates the need for each ULP to add its own similar trace point in its CM event handler function.
These new trace points appear in a new trace subsystem called "rdma_cma".
Sample events:
kworker/u24:2-2127 [011] 696.746254: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 ADDR_RESOLVED (0/0)
kworker/u24:2-2127 [011] 696.746880: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 ROUTE_RESOLVED (2/0)
kworker/u28:2-2214 [001] 696.776316: cm_send_req: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 qp_num=526
kworker/1:3-972 [001] 696.777603: cm_send_mra: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0
kworker/1:3-972 [001] 696.778062: cm_send_rtu: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0
kworker/1:3-972 [001] 696.778198: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 ESTABLISHED (9/0)
kworker/1:3-972 [001] 700.621750: cm_disconnect: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0
kworker/1:3-972 [001] 700.621881: cm_sent_dreq: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0
kworker/3:2-512 [003] 700.622354: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 DISCONNECTED (10/0)Some features to note:
- restracker ID of the rdma_cm_id is tagged on each trace event
- The source and destination IP addresses and TOS are reported
- CM event upcalls are shown with decoded event and status
- CM state transitions are reported
This patch is based on previous work by:
Saeed Mahameed <[email protected]>
Mukesh Kacker <[email protected]>
Ajaykumar Hotchandani <[email protected]> Aron Silverton <[email protected]>
Avinash Repaka <[email protected]> Somasundaram Krishnasamy <[email protected]>
--- drivers/infiniband/core/Makefile | 2 drivers/infiniband/core/cma.c | 59 +++++++-- drivers/infiniband/core/cma_trace.c | 16 +++ drivers/infiniband/core/cma_trace.h | 219 +++++++++++++++++++++++++++++++++++ 4 files changed, 279 insertions(+), 17 deletions(-) create mode 100644 drivers/infiniband/core/cma_trace.c create mode 100644 drivers/infiniband/core/cma_trace.h
drivers/infiniband/core/Makefile +1 -1
@@ -20,7 +20,7 @@ ib_cm-y := cm.o iw_cm-y := iwcm.o iwpm_util.o iwpm_msg.o -rdma_cm-y := cma.o +rdma_cm-y := cma.o cma_trace.o rdma_cm-$(CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS) += cma_configfs.o
drivers/infiniband/core/cma.c +43 -16
210 lines not on this page · raw message
drivers/infiniband/core/cma_trace.c new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Trace points for the RDMA Connection Manager. +* +* Author: Chuck Lever <[email protected]> +* +* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +*/ + +#define CREATE_TRACE_POINTS + +#include <rdma/rdma_cm.h> +#include <rdma/ib_cm.h> +#include "cma_priv.h" + +#include "cma_trace.h"
drivers/infiniband/core/cma_trace.h new file +219 -0
219 lines not on this page · raw message
Re: [PATCH v7 2/2] RDMA/cma: Add trace points in RDMA Connection Manager
Quoted 39 lines · Chuck Lever
Record state transitions as each connection is established. The IP address of both peers and the Type of Service is reported. These trace points are not in performance hot paths.
Also, record each
cm_event_handlercall to ULPs. This eliminates the need for each ULP to add its own similar trace point in its CM event handler function.These new trace points appear in a new trace subsystem called "
rdma_cma".Sample events:
kworker/u24:2-2127 [011] 696.746254: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 ADDR_RESOLVED (0/0) kworker/u24:2-2127 [011] 696.746880: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 ROUTE_RESOLVED (2/0) kworker/u28:2-2214 [001] 696.776316: cm_send_req: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 qp_num=526 kworker/1:3-972 [001] 696.777603: cm_send_mra: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 kworker/1:3-972 [001] 696.778062: cm_send_rtu: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 kworker/1:3-972 [001] 696.778198: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 ESTABLISHED (9/0) kworker/1:3-972 [001] 700.621750: cm_disconnect: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 kworker/1:3-972 [001] 700.621881: cm_sent_dreq: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 kworker/3:2-512 [003] 700.622354: cm_event_handler: cm_id.id=1 src: 192.168.2.51:57696 dst: 192.168.2.55:20049 tos=0 DISCONNECTED (10/0)Some features to note:
- restracker ID of therdma_cm_idis tagged on each trace event
- The source and destination IP addresses and TOS are reported
- CM event upcalls are shown with decoded event and status
- CM state transitions are reportedThis patch is based on previous work by:
Saeed Mahameed <[email protected]>
Mukesh Kacker <[email protected]>
Ajaykumar Hotchandani <[email protected]> Aron Silverton <[email protected]>
Avinash Repaka <[email protected]> Somasundaram Krishnasamy <[email protected]>Signed-off-by Chuck Lever <[email protected]>
Quoted 8 lines
--- drivers/infiniband/core/Makefile | 2 drivers/infiniband/core/cma.c | 59 +++++++-- drivers/infiniband/core/cma_trace.c | 16 +++ drivers/infiniband/core/cma_trace.h | 219 +++++++++++++++++++++++++++++++++++ 4 files changed, 279 insertions(+), 17 deletions(-) create mode 100644 drivers/infiniband/core/cma_trace.c create mode 100644 drivers/infiniband/core/cma_trace.h
Chuck, thanks for the updated commit message, the patches look very good. Unfortunately, I wasn't able to compile latest series as well.
_ kernel git:(24005116b337) mkt build
Start kernel compilation in silent mode
In file included from drivers/infiniband/core/cma_trace.h:219,
from drivers/infiniband/core/cma_trace.c:16:./include/trace/define_trace.h:95:42: fatal error: ./cma_trace.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
make[3]: *** [scripts/Makefile.build:265: drivers/infiniband/core/cma_trace.o] Error 1 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:509: drivers/infiniband/core] Error 2 make[1]: *** [scripts/Makefile.build:509: drivers/infiniband] Error 2
make: *** [Makefile:1649: drivers] Error 2
_ kernel git:(173822da8f6f) git l -n 3173822da8f6f (HEAD) RDMA/cma: Add trace points in RDMA Connection Manager24005116b337 RDMA/core: Trace points for diagnosing completion queue issuesa25984f3baaa (rdma/wip/jgg-for-next) RDMA/qedr: Fix null-pointer dereference when calling rdma_user_mmap_get_offset
Thanks