Add cross-channel support
Subsystems (2)
cover Add cross-channel support
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The following set of patches adds cross-channel (CC) support in the libibverbs.
The cross-channel feature allows to execute WQEs that involve cross-channel synchronization of IO operations’ on different QPs.
Complex applications usually require synchronizations for IO operations from multiple sources before continuing their execution.
In order to implement this, the host software usually needs to handle completions from each one of the receive queues (arriving in arbitrary order), process the data after last message arrival and only then post work request on the send queue to send the combined data to its destination.
Execution of such operation generates multiple interrupts at an unpredictable time with an overhead of interrupts handling and context switches.
This patchset adds synchronization primitives which gives ability to perform conditional operations and a following submission will introduce arithmetic calculation offload.
Synchronization abilities combined with arithmetic calculations will allow us to program complex scenarios with a single function call, hereby significantly reducing overhead associated with IO processing.
Patch #1 adds CQ ignore overrun flag.
Patch #2 implements QP flags to configure master/slave properties
of queue.
Patch #3 expands work request structure to have cross-channel
specific primitives.
Patch #4 exports cross-channel device capability flag. Patch #5 provides an example of cross-channel synchronizations.
These patches were added on top of "Completion timestamping" [1] and "Expose QP block self multicast loopback creation flag" [2] series.
[1] https://www.mail-archive.com/[email protected]/msg28895.html
[2] http://comments.gmane.org/gmane.linux.drivers.rdma/30158
Changes from v0:
* Enrich cover message and commit messages.
* Add ibv_cc_pingpong example.
* Add manual to all newly created flags.
Leon Romanovsky (5):
Add CQ ignore overrun flag
Add cross-channel QP flags
Add cross-channel work requests primitives
Export cross-channel capability flag
Add an example of cross-channel synchronization
Makefile.am | 6 +- examples/.gitignore | 1 + examples/cc_pingpong.c | 991 +++++++++++++++++++++++++++++++++++++++++++++ include/infiniband/verbs.h | 23 +- man/ibv_cc_pingpong.1 | 66 +++ man/ibv_create_cq_ex.3 | 18 +- man/ibv_create_qp_ex.3 | 18 +- man/ibv_post_send.3 | 25 +- src/cmd.c | 5 +- 9 files changed, 1141 insertions(+), 12 deletions(-) create mode 100644 examples/cc_pingpong.c create mode 100644 man/ibv_cc_pingpong.1
Signature · 5 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1452959624-29454-1-git-send-email-leon-2ukJVAZIZ/[email protected]
PATCH 1/5 Add CQ ignore overrun flag
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
A CQ overrun is checked while posting a completion, and if encountered, the QP is transferred to the appropriate error state.
CQ update (and error discovery) are not synchronized with WQE execution. In cross-channel mode, the send/receive queues will forward their completions to managing QP.
--- include/infiniband/verbs.h | 1 + man/ibv_create_cq_ex.3 | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)
include/infiniband/verbs.h +1 -0
@@ -1207,6 +1207,7 @@ enum ibv_create_cq_attr {enum ibv_create_cq_attr_flags {IBV_CREATE_CQ_ATTR_COMPLETION_TIMESTAMP =1 <<0 , +IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN =1 <<1 };struct ibv_create_cq_attr_ex {
man/ibv_create_cq_ex.3 +14 -4
@@ -1,6 +1,6 @@ .\" -*- nroff -*- .\" -.TH IBV_CREATE_CQ_EX 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual" +.TH IBV_CREATE_CQ_EX 3 2015-12-27 libibverbs "Libibverbs Programmer's Manual" .SH "NAME" ibv_create_cq_ex \- create a completion queue (CQ) .SH "SYNOPSIS"
@@ -42,13 +42,19 @@ enum ibv_wc_flags_ex { IBV_WC_EX_WITH_SLID = 1 << 7, /* Require slid in WC */ IBV_WC_EX_WITH_SL = 1 << 8, /* Require sl in WC */ IBV_WC_EX_WITH_DLID_PATH_BITS = 1 << 9, /* Require dlid path bits in WC */ - IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 10, /* Require completion timestamp in WC /* + IBV_WC_EX_WITH_COMPLETION_TIMESTAMP = 1 << 10, /* Require completion timestamp in WC */ }; +enum ibv_create_cq_attr_flags { + IBV_CREATE_CQ_ATTR_COMPLETION_TIMESTAMP = 1 << 0, + IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN = 1 << 1 /* Ignore completion queue overrun errors */ +}; enum ibv_create_cq_attr { - IBV_CREATE_CQ_ATTR_FLAGS = 1 << 0, + IBV_CREATE_CQ_ATTR_FLAGS = 1 << 0, + IBV_CREATE_CQ_ATTR_RESERVED = 1 << 1 }; + .SH "RETURN VALUE" .B ibv_create_cq_ex() returns a pointer to the CQ, or NULL if the request fails.
@@ -68,4 +74,8 @@ CQ should be destroyed with ibv_destroy_cq. .BR ibv_create_qp (3) .SH "AUTHORS" .TP -Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]> +Matan Barak +.RI < matanb-VPRAkNaXOzVWk0Htik3J/[email protected] > +.TP +Leon Romanovsky +.RI < leonro-VPRAkNaXOzVWk0Htik3J/[email protected] >
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/5 Add cross-channel QP flags
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The cross-channel feature allows to execute WQEs that involve synchronization of IO operations’ on different QPs.
This capability enables to program complex flows with a single function call, hereby significantly reducing overhead associated with IO processing.
The queue pairs can be configured to work as a “sync master queue” or “sync slave queues”.
QP property flags to indicate if queues are slave or master:
* IB_QP_CREATE_MANAGED_SEND indicates that posted send work requests will not be executed immediately and requires enabling.
* IB_QP_CREATE_MANAGED_RECV indicates that posted receive work requests will not be executed immediately and requires enabling.
* IB_QP_CREATE_CROSS_CHANNEL declares the QP to work in cross-channel mode. If IB_QP_CREATE_MANAGED_SEND and IB_QP_CREATE_MANAGED_RECV are not provided, this QP will be sync master queue, else it will be sync slave.
* IBV_QP_CREATE_IGNORE_SQ_OVERFLOW configures QP to discard overflow indications on send queue.
* IBV_QP_CREATE_IGNORE_RQ_OVERFLOW instructs QP to discard overflow indications on receive queue.
--- include/infiniband/verbs.h | 5 +++++ man/ibv_create_qp_ex.3 | 18 ++++++++++++++++-- src/cmd.c | 5 ++++- 3 files changed, 25 insertions(+), 3 deletions(-)
include/infiniband/verbs.h +5 -0
@@ -769,6 +769,11 @@ enum ibv_qp_init_attr_mask {enum ibv_qp_create_flags {IBV_QP_CREATE_BLOCK_SELF_MCAST_LB =1 <<1 , +IBV_QP_CREATE_CROSS_CHANNEL =1 <<2 , +IBV_QP_CREATE_MANAGED_SEND =1 <<3 , +IBV_QP_CREATE_MANAGED_RECV =1 <<4 , +IBV_QP_CREATE_IGNORE_SQ_OVERFLOW =1 <<5 , +IBV_QP_CREATE_IGNORE_RQ_OVERFLOW =1 <<6 };struct ibv_qp_init_attr_ex {
man/ibv_create_qp_ex.3 +16 -2
@@ -1,6 +1,6 @@ .\" -*- nroff -*- .\" -.TH IBV_CREATE_QP_EX 3 2013-06-26 libibverbs "Libibverbs Programmer's Manual" +.TH IBV_CREATE_QP_EX 3 2015-12-27 libibverbs "Libibverbs Programmer's Manual" .SH "NAME" ibv_create_qp_ex, ibv_destroy_qp \- create or destroy a queue pair (QP) .SH "SYNOPSIS"
@@ -47,6 +47,16 @@ uint32_t max_recv_sge; /* Requested max number of s/g elements uint32_t max_inline_data;/* Requested max number of data (bytes) that can be posted inline to the SQ, otherwise 0 */ .in -8 }; +.sp +.mf +enum ibv_qp_create_flags { + IBV_QP_CREATE_BLOCK_SELF_MCAST_LB = 1 << 1, + IBV_QP_CREATE_CROSS_CHANNEL = 1 << 2, /* Set QP to work in cross-channel mode */ + IBV_QP_CREATE_MANAGED_SEND = 1 << 3, /* Send work request posted to this QP won't be executed immediately and requires enabling /* + IBV_QP_CREATE_MANAGED_RECV = 1 << 4, /* Receive work request posted to this QP won't be executed immediately and requires enabling */ + IBV_QP_CREATE_IGNORE_SQ_OVERFLOW = 1 << 5, /* Configure QP to discard overflow indications on send queue */ + IBV_QP_CREATE_IGNORE_RQ_OVERFLOW = 1 << 6 /* Configure QP to discard overflow indications on receive queue */ +}; .fi .PP The function
@@ -80,4 +90,8 @@ fails if the QP is attached to a multicast group. .BR ibv_query_qp (3) .SH "AUTHORS" .TP -Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]> +Yishai Hadas +.RI < yishaih-VPRAkNaXOzVWk0Htik3J/[email protected] > +.TP +Leon Romanovsky +.RI < leonro-VPRAkNaXOzVWk0Htik3J/[email protected] >
src/cmd.c +4 -1
@@ -815,7 +815,10 @@ static void create_qp_handle_resp_common(struct ibv_context *context, }enum { -CREATE_QP_EX2_SUP_CREATE_FLAGS =IBV_QP_CREATE_BLOCK_SELF_MCAST_LB , +CREATE_QP_EX2_SUP_CREATE_FLAGS =IBV_QP_CREATE_BLOCK_SELF_MCAST_LB | +IBV_QP_CREATE_CROSS_CHANNEL | +IBV_QP_CREATE_MANAGED_SEND | +IBV_QP_CREATE_MANAGED_RECV }; int ibv_cmd_create_qp_ex2(struct ibv_context *context,
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/5 Add cross-channel work requests primitives
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The cross-channel feature relies on special primitives to send and receive work requests.
* CQE wait - This work request holds execution of subsequent requests on that queue until this number of completions of a CQ is met.
• WQE enable - This work request specifies value of work requests on the controlled send/receive queue. It enables the execution of all WQEs up to the work request which is marked by IBV_SEND_WAIT_EN_LAST.
--- include/infiniband/verbs.h | 16 ++++++++++++++-- man/ibv_post_send.3 | 25 +++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-)
include/infiniband/verbs.h +14 -2
@@ -884,7 +884,10 @@ enum ibv_wr_opcode {IBV_WR_SEND_WITH_IMM ,IBV_WR_RDMA_READ ,IBV_WR_ATOMIC_CMP_AND_SWP , -IBV_WR_ATOMIC_FETCH_AND_ADD +IBV_WR_ATOMIC_FETCH_AND_ADD , +IBV_WR_SEND_ENABLE , +IBV_WR_RECV_ENABLE , +IBV_WR_CQE_WAIT }; enum ibv_send_flags {
@@ -892,7 +895,8 @@ enum ibv_send_flags {IBV_SEND_SIGNALED =1 <<1 ,IBV_SEND_SOLICITED =1 <<2 ,IBV_SEND_INLINE =1 <<3 , -IBV_SEND_IP_CSUM =1 <<4 +IBV_SEND_IP_CSUM =1 <<4 , +IBV_SEND_WAIT_EN_LAST =1 <<5 }; struct ibv_sge {
@@ -925,6 +929,14 @@ struct ibv_send_wr {uint32_t remote_qpn;uint32_t remote_qkey; } ud; +struct { +struct ibv_cq *cq; +int32_t cq_count; + } cqe_wait; +struct { +struct ibv_qp *qp; +int32_t wqe_count; + } wqe_enable; } wr; union { struct {
man/ibv_post_send.3 +23 -2
@@ -1,6 +1,6 @@ .\" -*- nroff -*- .\" -.TH IBV_POST_SEND 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual" +.TH IBV_POST_SEND 3 2015-12-26 libibverbs "Libibverbs Programmer's Manual" .SH "NAME" ibv_post_send \- post a list of work requests (WRs) to a send queue .SH "SYNOPSIS"
@@ -58,6 +58,18 @@ uint32_t remote_qpn; /* QP number of the destination QP */ uint32_t remote_qkey; /* Q_Key number of the destination QP */ .in -8 } ud; +struct { +.in +8 +struct ibv_cq *cq; /* CQ for the wait on */ +int32_t cq_count; /* Count of completions of a CQ to met */ +.in -8 +} cqe_wait; +struct { +.in +8 +struct ibv_qp *qp; /* QP for the release */ +int32_t wqe_count; /* Number of work requests to release */ +.in -8 +} wqe_enable; .in -8 } wr; .in -8
@@ -85,6 +97,9 @@ IBV_WR_RDMA_WRITE_WITH_IMM | | X | X IBV_WR_RDMA_READ | | | X IBV_WR_ATOMIC_CMP_AND_SWP | | | X IBV_WR_ATOMIC_FETCH_AND_ADD | | | X +IBV_WR_SEND_ENABLE | | | X +IBV_WR_RECV_ENABLE | | | X +IBV_WR_CQE_WAIT | | | X .fi .PP The attribute send_flags describes the properties of the \s-1WR\s0. It is either 0 or the bitwise \s-1OR\s0 of one or more of the following flags:
@@ -102,6 +117,8 @@ in a send WQE. Valid only for Send and RDMA Write. The L_Key will not be check .B IBV_SEND_IP_CSUM \fR Offload the IPv4 and TCP/UDP checksum calculation. Valid only when \fBdevice_cap_flags\fR in device_attr indicates current QP is supported by checksum offload. +.TP +.B IBV_SEND_WAIT_EN_LAST \fR Mark this work request as a last one in the cross-channel offloaded sequence. .SH "RETURN VALUE" .B ibv_post_send() returns 0 on success, or the value of errno on failure (which indicates the failure reason).
@@ -124,4 +141,8 @@ after the call returns. .BR ibv_poll_cq (3) .SH "AUTHORS" .TP -Dotan Barak <[email protected]> +Dotan Barak +.RI < [email protected] > +.TP +Leon Romanovsky +.RI < leonro-VPRAkNaXOzVWk0Htik3J/[email protected] >
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/5 Export cross-channel capability flag
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Export device capability flag IB_DEVICE_CROSS_CHANNEL for the devices that can perform cross-channel operations.
--- include/infiniband/verbs.h | 1 + 1 file changed, 1 insertion(+)
include/infiniband/verbs.h +1 -0
@@ -121,6 +121,7 @@ enum ibv_device_cap_flags {IBV_DEVICE_XRC =1 <<20 ,IBV_DEVICE_RC_IP_CSUM =1 <<25 ,IBV_DEVICE_RAW_IP_CSUM =1 <<26 , +IBV_DEVICE_CROSS_CHANNEL =1 <<27 , IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29 };
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/5 Add an example of cross-channel synchronization
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add ibv_cc_pingpong application as an example for use of synchronization primitives to perform conditional flows.
--- Makefile.am | 6 +- examples/.gitignore | 1 + examples/cc_pingpong.c | 991 +++++++++++++++++++++++++++++++++++++++++++++++++ man/ibv_cc_pingpong.1 | 66 ++++ 4 files changed, 1063 insertions(+), 1 deletion(-) create mode 100644 examples/cc_pingpong.c create mode 100644 man/ibv_cc_pingpong.1
Makefile.am +5 -1
@@ -22,7 +22,8 @@ src_libibverbs_la_DEPENDENCIES = $(srcdir)/src/libibverbs.map bin_PROGRAMS = examples/ibv_devices examples/ibv_devinfo \ examples/ibv_asyncwatch examples/ibv_rc_pingpong examples/ibv_uc_pingpong \ - examples/ibv_ud_pingpong examples/ibv_srq_pingpong examples/ibv_xsrq_pingpong + examples/ibv_ud_pingpong examples/ibv_srq_pingpong examples/ibv_xsrq_pingpong \ + examples/ibv_cc_pingpong examples_ibv_devices_SOURCES = examples/device_list.c examples_ibv_devices_LDADD = $(top_builddir)/src/libibverbs.la $(LIBNL_LIBS) examples_ibv_devinfo_SOURCES = examples/devinfo.c
@@ -37,6 +38,8 @@ examples_ibv_srq_pingpong_SOURCES = examples/srq_pingpong.c examples/pingpong.c examples_ibv_srq_pingpong_LDADD = $(top_builddir)/src/libibverbs.la $(LIBNL_LIBS) examples_ibv_xsrq_pingpong_SOURCES = examples/xsrq_pingpong.c examples/pingpong.c examples_ibv_xsrq_pingpong_LDADD = $(top_builddir)/src/libibverbs.la $(LIBNL_LIBS) +examples_ibv_cc_pingpong_SOURCES = examples/cc_pingpong.c examples/pingpong.c +examples_ibv_cc_pingpong_LDADD = $(top_builddir)/src/libibverbs.la $(LIBNL_LIBS) examples_ibv_asyncwatch_SOURCES = examples/asyncwatch.c examples_ibv_asyncwatch_LDADD = $(top_builddir)/src/libibverbs.la $(LIBNL_LIBS)
@@ -50,6 +53,7 @@ libibverbsinclude_HEADERS = include/infiniband/arch.h include/infiniband/driver. man_MANS = man/ibv_asyncwatch.1 man/ibv_devices.1 man/ibv_devinfo.1 \ man/ibv_rc_pingpong.1 man/ibv_uc_pingpong.1 man/ibv_ud_pingpong.1 \ man/ibv_srq_pingpong.1 man/ibv_alloc_pd.3 man/ibv_attach_mcast.3 \ + man/ibv_cc_pingpong.1 \ man/ibv_create_ah.3 man/ibv_create_ah_from_wc.3 \ man/ibv_create_comp_channel.3 man/ibv_create_cq.3 \ man/ibv_create_qp.3 man/ibv_create_srq.3 man/ibv_event_type_str.3 \
examples/.gitignore +1 -0
@@ -7,4 +7,5 @@ ibv_srq_pingpong ibv_uc_pingpong ibv_ud_pingpong ibv_xsrq_pingpong +ibv_cc_pingpong .libs
examples/cc_pingpong.c new file +991 -0
991 lines not on this page · raw message
man/ibv_cc_pingpong.1 new file +66 -0
66 lines not on this page · raw message
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html