staging/rdma/hfi1: Adaptive PIO performance improvement
Subsystems (3)
cover staging/rdma/hfi1: Adaptive PIO performance improvement
This is a performance improvement patch series. It adds an adaptive PIO component where under certain conditions small messages will be sent via PIO instead of SDMA. This series also includes a change to the progress mechanism and its interaction with rdmavt enabling a driver hint as to if the progress should be kicked or the send just queued.
Series applies on the posted "Code cleanups, bug fixes, and perf improvements" patch. It can also be seen in context at
https://github.com/ddalessa/kernel/tree/for-4.6.
---
Dennis Dalessandro (1):
staging/rdma/hfi1: Remove header memcpy from sdma send path.
Jubin John (3):
staging/rdma/hfi1: Add s_sendcontext priv field staging/rdma/hfi1: Add qp to send context mapping for PIO staging/rdma/hfi1: Add send context sw index
Mike Marciniszyn (11):
staging/rdma/hfi1: add s_avail to qp_stats IB/rdmvt: close send engine struct holes staging/rdma/hfi1: move txreq header code staging/rdma/hfi1: remove s_rdma_mr staging/rdma/hfi1: avoid passing pmtu staging/rdma/hfi1: fix panic in send engine staging/rdma/hfi1: use u8 for vl/sl staging/rdma/hfi1: Adaptive PIO for short messages IB/qib,staging/rdma/hfi1,IB/rdmavt: progress selection changes staging/rdma/hfi: fix CQ completion order issue staging/rdma/hfi1: Determine actual operational VLs
Vennila Megavannan (1):
staging/rdma/hfi1: add cq head and tail information to qpstats
drivers/infiniband/hw/qib/qib_qp.c | 7 - drivers/infiniband/sw/rdmavt/qp.c | 10 + drivers/staging/rdma/hfi1/Makefile | 3 drivers/staging/rdma/hfi1/chip.c | 47 +++- drivers/staging/rdma/hfi1/chip.h | 1 drivers/staging/rdma/hfi1/diag.c | 22 +- drivers/staging/rdma/hfi1/hfi.h | 16 + drivers/staging/rdma/hfi1/init.c | 2 drivers/staging/rdma/hfi1/iowait.h | 121 +++++++++ drivers/staging/rdma/hfi1/pio.c | 244 +++++++++++++++++++ drivers/staging/rdma/hfi1/pio.h | 106 ++++++++ drivers/staging/rdma/hfi1/qp.c | 89 ++++++- drivers/staging/rdma/hfi1/qp.h | 1 drivers/staging/rdma/hfi1/rc.c | 77 ++++-- drivers/staging/rdma/hfi1/ruc.c | 26 +- drivers/staging/rdma/hfi1/sdma.c | 102 +++----- drivers/staging/rdma/hfi1/sdma.h | 84 ------- drivers/staging/rdma/hfi1/sdma_txreq.h | 135 +++++++++++ drivers/staging/rdma/hfi1/uc.c | 42 +++ drivers/staging/rdma/hfi1/ud.c | 65 +++-- drivers/staging/rdma/hfi1/user_sdma.c | 7 - drivers/staging/rdma/hfi1/verbs.c | 396 ++++++++++++------------------- drivers/staging/rdma/hfi1/verbs.h | 45 ++-- drivers/staging/rdma/hfi1/verbs_txreq.c | 149 ++++++++++++ drivers/staging/rdma/hfi1/verbs_txreq.h | 116 +++++++++ include/rdma/rdmavt_qp.h | 26 +- 26 files changed, 1410 insertions(+), 529 deletions(-) create mode 100644 drivers/staging/rdma/hfi1/sdma_txreq.h create mode 100644 drivers/staging/rdma/hfi1/verbs_txreq.c create mode 100644 drivers/staging/rdma/hfi1/verbs_txreq.h
Signature · 5 lines
-Denny -- 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 1/16 staging/rdma/hfi1: add s_avail to qp_stats
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
This diagnostic capability was missed in the dual lock series.
--- drivers/staging/rdma/hfi1/qp.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/qp.c +2 -1
@@ -612,7 +612,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) sde =qp_to_sdma_engine (qp, priv->s_sc); wqe =rvt_get_swqe_ptr (qp, qp->s_last); seq_printf(s, - "N %d %s QP%u R %u %s %u %u %u f=%x %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u) QP%u LID %x SL %u MTU %u %u %u %u SDE %p,%u\n", + "N %d %s QP%u R %u %s %u %u %u f=%x %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%u LID %x SL %u MTU %u %u %u %u SDE %p,%u\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
@@ -632,6 +632,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) qp->s_sending_psn, qp->s_sending_hpsn, qp->s_last, qp->s_acked, qp->s_cur, qp->s_tail, qp->s_head, qp->s_size, + qp->s_avail, qp->remote_qpn, qp->remote_ah_attr.dlid, qp->remote_ah_attr.sl,
--
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/16 IB/rdmvt: close send engine struct holes
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
pahole noted the wasted 4 bytes after s_lock and r_lock.
Move s_flags and r_psn to fill the holes.
--- include/rdma/rdmavt_qp.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/rdma/rdmavt_qp.h +2 -2
@@ -283,12 +283,12 @@ struct rvt_qp {struct rvt_sge_state s_rdma_read_sge;spinlock_t r_lock____cacheline_aligned_in_smp ;/* used for APM */ +u32 r_psn;/* expected rcv packet sequence number */ unsigned long r_aflags;u64 r_wr_id;/* ID for current receive WQE */ u32 r_ack_psn;/* PSN for next ACK or atomic ACK */ u32 r_len;/* total length of r_sge */ u32 r_rcv_len;/* receive data len processed */ -u32 r_psn;/* expected rcv packet sequence number */ u32 r_msn;/* message sequence number */ u8 r_state;/* opcode of last packet received */
@@ -308,8 +308,8 @@ struct rvt_qp {u32 s_ssn;/* SSN of tail entry */ spinlock_t s_lock____cacheline_aligned_in_smp ; -struct rvt_sge_state *s_cur_sge;u32 s_flags; +struct rvt_sge_state *s_cur_sge;struct rvt_swqe *s_wqe;struct rvt_sge_state s_sge;/* current send request data */ struct rvt_mregion *s_rdma_mr;
--
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/16 staging/rdma/hfi1: move txreq header code
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The patch separates the txreq defines into new files, one for verbs and one for sdma.
The verbs_txreq implementation handles the setup and teardown of the txreq cache, so the register routine is changed to call the new init/exit routines.
This patch allows for followup patches enhance the send engine.
--- drivers/staging/rdma/hfi1/Makefile | 3 - drivers/staging/rdma/hfi1/qp.c | 2 drivers/staging/rdma/hfi1/ruc.c | 2 drivers/staging/rdma/hfi1/sdma.h | 80 ----------------- drivers/staging/rdma/hfi1/sdma_txreq.h | 130 +++++++++++++++++++++++++++ drivers/staging/rdma/hfi1/verbs.c | 111 +---------------------- drivers/staging/rdma/hfi1/verbs_txreq.c | 149 +++++++++++++++++++++++++++++++ drivers/staging/rdma/hfi1/verbs_txreq.h | 95 ++++++++++++++++++++ 8 files changed, 384 insertions(+), 188 deletions(-) create mode 100644 drivers/staging/rdma/hfi1/sdma_txreq.h create mode 100644 drivers/staging/rdma/hfi1/verbs_txreq.c create mode 100644 drivers/staging/rdma/hfi1/verbs_txreq.h
drivers/staging/rdma/hfi1/Makefile +2 -1
@@ -11,7 +11,8 @@ hfi1-y := affinity.o chip.o device.o diag.o driver.o efivar.o \ eprom.o file_ops.o firmware.o \ init.o intr.o mad.o pcie.o pio.o pio_copy.o platform.o \ qp.o qsfp.o rc.o ruc.o sdma.o sysfs.o trace.o twsi.o \ - uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs.o + uc.o ud.o user_exp_rcv.o user_pages.o user_sdma.o verbs.o \ + verbs_txreq.o hfi1-$(CONFIG_DEBUG_FS) += debugfs.o CFLAGS_trace.o = -I$(src)
drivers/staging/rdma/hfi1/qp.c +1 -1
@@ -60,7 +60,7 @@#include "hfi.h" #include "qp.h" #include "trace.h" -#include "sdma.h" +#include "verbs_txreq.h" unsigned int hfi1_qp_table_size =256 ;module_param_named (qp_table_size, hfi1_qp_table_size, uint,S_IRUGO );
drivers/staging/rdma/hfi1/ruc.c +1 -1
@@ -53,7 +53,7 @@#include "hfi.h" #include "mad.h" #include "qp.h" -#include "sdma.h" +#include "verbs_txreq.h" /* * Convert the AETH RNR timeout code into the number of microseconds.
drivers/staging/rdma/hfi1/sdma.h +1 -79
93 lines not on this page · raw message
drivers/staging/rdma/hfi1/sdma_txreq.h new file +130 -0
130 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.c +5 -106
154 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs_txreq.c new file +149 -0
149 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs_txreq.h new file +95 -0
95 lines not on this page · raw message
--
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/16 staging/rdma/hfi1: Remove header memcpy from sdma send path.
In reply to a message not in the archiveInstead of writing the header into a buffer then copying it into another buffer to be sent, remove that memcpy and instead build the header directly into the tx request that will be sent.
--- drivers/staging/rdma/hfi1/diag.c | 20 ++++++---- drivers/staging/rdma/hfi1/rc.c | 42 ++++++++++++++------- drivers/staging/rdma/hfi1/ruc.c | 22 ++++++----- drivers/staging/rdma/hfi1/uc.c | 30 ++++++++++----- drivers/staging/rdma/hfi1/ud.c | 56 ++++++++++++++++++---------- drivers/staging/rdma/hfi1/verbs.c | 63 ++++++++++++++----------------- drivers/staging/rdma/hfi1/verbs.h | 18 +++------ drivers/staging/rdma/hfi1/verbs_txreq.h | 1 8 files changed, 148 insertions(+), 104 deletions(-)
drivers/staging/rdma/hfi1/diag.c +13 -7
@@ -70,6 +70,7 @@#include "hfi.h" #include "device.h" #include "common.h" +#include "verbs_txreq.h" #include "trace.h" #undef pr_fmt
@@ -1682,8 +1683,6 @@ int snoop_send_dma_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps,int snoop_send_pio_handler (struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc) { -struct hfi1_qp_priv *priv = qp->priv; -struct ahg_ib_header *ahdr = priv->s_hdr;u32 hdrwords = qp->s_hdrwords;struct rvt_sge_state *ss = qp->s_cur_sge;u32 len = qp->s_cur_size;
@@ -1691,7 +1690,7 @@ int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps,u32 plen = hdrwords + dwords +2 ;/* includes pbc */ struct hfi1_pportdata *ppd = ps->ppd;struct snoop_packet *s_packet =NULL ; -u32 *hdr = (u32 *)&ahdr->ibh; +u32 *hdr = (u32 *)&ps->s_txreq->phdr.hdr;u32 length =0 ;struct rvt_sge_state temp_ss;void *data =NULL ;
@@ -1702,7 +1701,7 @@ int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps,struct capture_md md;u32 vl;u32 hdr_len = hdrwords <<2 ; -u32 tlen =HFI1_GET_PKT_LEN (&ahdr->ibh); +u32 tlen =HFI1_GET_PKT_LEN (&ps->s_txreq->phdr.hdr); md.u.pbc =0 ;
@@ -1729,7 +1728,7 @@ int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps, md.port =1 ; md.dir =PKT_DIR_EGRESS ;if (likely (pbc ==0 )) { - vl =be16_to_cpu (ahdr->ibh.lrh[0 ]) >>12 ; + vl =be16_to_cpu (ps->s_txreq->phdr.hdr.lrh[0 ]) >>12 ; md.u.pbc =create_pbc (ppd,0 , qp->s_srate, vl, plen); }else { md.u.pbc =0 ;
@@ -1791,7 +1790,7 @@ int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps, ret =HFI1_FILTER_HIT ; }else { ret = ppd->dd->hfi1_snoop.filter_callback ( - &ahdr->ibh, + &ps->s_txreq->phdr.hdr,NULL , ppd->dd->hfi1_snoop.filter_value); }
@@ -1823,9 +1822,16 @@ int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps,spin_unlock_irqrestore (&qp->s_lock, flags); }else if (qp->ibqp.qp_type ==IB_QPT_RC ) {spin_lock_irqsave (&qp->s_lock, flags); -hfi1_rc_send_complete (qp, &ahdr->ibh); +hfi1_rc_send_complete (qp, + &ps->s_txreq->phdr.hdr);spin_unlock_irqrestore (&qp->s_lock, flags); } + +/* +* If snoop is dropping the packet we need to put the +* txreq back because no one else will. +*/ +hfi1_put_txreq (ps->s_txreq);return 0 ; }break ;
drivers/staging/rdma/hfi1/rc.c +29 -13
100 lines not on this page · raw message
drivers/staging/rdma/hfi1/ruc.c +13 -9
@@ -54,6 +54,7 @@#include "mad.h" #include "qp.h" #include "verbs_txreq.h" +#include "trace.h" /* * Convert the AETH RNR timeout code into the number of microseconds.
@@ -698,6 +699,7 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr,static inline void build_ahg (struct rvt_qp *qp,u32 npsn) {struct hfi1_qp_priv *priv = qp->priv; +if (unlikely (qp->s_flags &RVT_S_AHG_CLEAR ))clear_ahg (qp);if (!(qp->s_flags &RVT_S_AHG_VALID )) {
@@ -740,10 +742,11 @@ static inline void build_ahg(struct rvt_qp *qp, u32 npsn) }void hfi1_make_ruc_header (struct rvt_qp *qp,struct hfi1_other_headers *ohdr, -u32 bth0,u32 bth2,int middle) +u32 bth0,u32 bth2,int middle, +struct hfi1_pkt_state *ps) { -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num);struct hfi1_qp_priv *priv = qp->priv; +struct hfi1_ibport *ibp = ps->ibp;u16 lrh0;u32 nwords;u32 extra_bytes;
@@ -754,7 +757,8 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct hfi1_other_headers *ohdr, nwords = (qp->s_cur_size + extra_bytes) >>2 ; lrh0 =HFI1_LRH_BTH ;if (unlikely (qp->remote_ah_attr.ah_flags &IB_AH_GRH )) { - qp->s_hdrwords +=hfi1_make_grh (ibp, &priv->s_hdr->ibh.u.l.grh, + qp->s_hdrwords +=hfi1_make_grh (ibp, + &ps->s_txreq->phdr.hdr.u.l.grh, &qp->remote_ah_attr.grh, qp->s_hdrwords, nwords); lrh0 =HFI1_LRH_GRH ;
@@ -784,11 +788,11 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct hfi1_other_headers *ohdr,build_ahg (qp, bth2); else qp->s_flags &= ~RVT_S_AHG_VALID; - priv->s_hdr->ibh.lrh[0 ] =cpu_to_be16 (lrh0); - priv->s_hdr->ibh.lrh[1 ] =cpu_to_be16 (qp->remote_ah_attr.dlid); - priv->s_hdr->ibh.lrh[2 ] = + ps->s_txreq->phdr.hdr.lrh[0 ] =cpu_to_be16 (lrh0); + ps->s_txreq->phdr.hdr.lrh[1 ] =cpu_to_be16 (qp->remote_ah_attr.dlid); + ps->s_txreq->phdr.hdr.lrh[2 ] =cpu_to_be16 (qp->s_hdrwords + nwords +SIZE_OF_CRC ); - priv->s_hdr->ibh.lrh[3 ] =cpu_to_be16 (ppd_from_ibp (ibp)->lid | + ps->s_txreq->phdr.hdr.lrh[3 ] =cpu_to_be16 (ppd_from_ibp (ibp)->lid | qp->remote_ah_attr.src_path_bits); bth0 |=hfi1_get_pkey (ibp, qp->s_pkey_index); bth0 |= extra_bytes <<20 ;
@@ -826,7 +830,7 @@ void hfi1_do_send(struct rvt_qp *qp) {struct hfi1_pkt_state ps;struct hfi1_qp_priv *priv = qp->priv; -int (*make_req)(struct rvt_qp *qp); +int (*make_req)(struct rvt_qp *qp,struct hfi1_pkt_state *ps);unsigned long flags;unsigned long timeout;unsigned long timeout_int;
@@ -906,7 +910,7 @@ void hfi1_do_send(struct rvt_qp *qp) }spin_lock_irqsave (&qp->s_lock, flags); } - }while (make_req (qp)); + }while (make_req (qp, &ps));spin_unlock_irqrestore (&qp->s_lock, flags); }
drivers/staging/rdma/hfi1/uc.c +21 -9
@@ -49,7 +49,7 @@*/ #include "hfi.h" -#include "sdma.h" +#include "verbs_txreq.h" #include "qp.h" /* cut down ridiculously long IB macro names */
@@ -63,7 +63,7 @@* * Return 1 if constructed; otherwise, return 0. */ -int hfi1_make_uc_req (struct rvt_qp *qp) +int hfi1_make_uc_req (struct rvt_qp *qp,struct hfi1_pkt_state *ps) {struct hfi1_qp_priv *priv = qp->priv;struct hfi1_other_headers *ohdr;
@@ -72,9 +72,12 @@ int hfi1_make_uc_req(struct rvt_qp *qp)u32 bth0 =0 ;u32 len;u32 pmtu = qp->pmtu; -int ret =0 ;int middle =0 ; + ps->s_txreq =get_txreq (ps->dev, qp); +if (IS_ERR (ps->s_txreq)) + goto bail_no_tx; +if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_SEND_OK )) {if (!(ib_rvt_state_ops[qp->state] &RVT_FLUSH_SEND )) goto bail;
@@ -90,12 +93,12 @@ int hfi1_make_uc_req(struct rvt_qp *qp)clear_ahg (qp); wqe =rvt_get_swqe_ptr (qp, qp->s_last);hfi1_send_complete (qp, wqe,IB_WC_WR_FLUSH_ERR ); - goto done; + goto done_free_tx; } - ohdr = &priv->s_hdr->ibh.u.oth; + ohdr = &ps->s_txreq->phdr.hdr.u.oth;if (qp->remote_ah_attr.ah_flags &IB_AH_GRH ) - ohdr = &priv->s_hdr->ibh.u.l.oth; + ohdr = &ps->s_txreq->phdr.hdr.u.l.oth;/* Get the next send request. */ wqe =rvt_get_swqe_ptr (qp, qp->s_cur);
@@ -235,13 +238,22 @@ int hfi1_make_uc_req(struct rvt_qp *qp) qp->s_cur_sge = &qp->s_sge; qp->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0 | (qp->s_state <<24 ), -mask_psn (qp->s_psn++), middle); -done: +mask_psn (qp->s_psn++), middle, ps); +return 1 ; + +done_free_tx: +hfi1_put_txreq (ps->s_txreq); + ps->s_txreq =NULL ;return 1 ; bail: +hfi1_put_txreq (ps->s_txreq); + +bail_no_tx: + ps->s_txreq =NULL ; qp->s_flags &= ~RVT_S_BUSY ; -return ret; + qp->s_hdrwords =0 ; +return 0 ; }/**
drivers/staging/rdma/hfi1/ud.c +36 -20
121 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.c +29 -34
162 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +7 -11
@@ -59,6 +59,7 @@#include <linux/workqueue.h> #include <linux/kthread.h> #include <linux/completion.h> +#include <linux/slab.h> #include <rdma/ib_pack.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_mad.h>
@@ -194,13 +195,6 @@ struct hfi1_pio_header { } __packed;/* -* used for force cacheline alignment for AHG -*/ -struct tx_pio_header { -struct hfi1_pio_header phdr; -}____cacheline_aligned ; - -/* * hfi1 specific data structures that will be hidden from rvt after the queue * pair is made common */
@@ -222,6 +216,7 @@ struct hfi1_pkt_state {struct hfi1_ibdev *dev;struct hfi1_ibport *ibp;struct hfi1_pportdata *ppd; +struct verbs_txreq *s_txreq; };#define HFI1_PSN_CREDIT 16
@@ -436,7 +431,8 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr, struct ib_global_route *grh, u32 hwords, u32 nwords);void hfi1_make_ruc_header (struct rvt_qp *qp,struct hfi1_other_headers *ohdr, -u32 bth0,u32 bth2,int middle); +u32 bth0,u32 bth2,int middle, +struct hfi1_pkt_state *ps);void _hfi1_do_send (struct work_struct *work);
@@ -447,11 +443,11 @@ void hfi1_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe,void hfi1_send_rc_ack (struct hfi1_ctxtdata *,struct rvt_qp *qp,int is_fecn); -int hfi1_make_rc_req (struct rvt_qp *qp); +int hfi1_make_rc_req (struct rvt_qp *qp,struct hfi1_pkt_state *ps); -int hfi1_make_uc_req (struct rvt_qp *qp); +int hfi1_make_uc_req (struct rvt_qp *qp,struct hfi1_pkt_state *ps); -int hfi1_make_ud_req (struct rvt_qp *qp); +int hfi1_make_ud_req (struct rvt_qp *qp,struct hfi1_pkt_state *ps);int hfi1_register_ib_device (struct hfi1_devdata *);
drivers/staging/rdma/hfi1/verbs_txreq.h +0 -1
@@ -63,7 +63,6 @@ struct verbs_txreq {struct rvt_mregion *mr;struct rvt_sge_state *ss;struct sdma_engine *sde; -struct send_context *psc;u16 hdr_dwords; };
--
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/16 staging/rdma/hfi1: remove s_rdma_mr
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
It can be conveyed in the verbs_txreq.
--- drivers/staging/rdma/hfi1/rc.c | 12 ++++++------ drivers/staging/rdma/hfi1/verbs.c | 8 -------- 2 files changed, 6 insertions(+), 14 deletions(-)
drivers/staging/rdma/hfi1/rc.c +6 -6
@@ -266,9 +266,9 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp, goto bail; }/* Copy SGE state in case we need to resend */ - qp->s_rdma_mr = e->rdma_sge.mr; -if (qp->s_rdma_mr) -rvt_get_mr (qp->s_rdma_mr); + ps->s_txreq->mr = e->rdma_sge.mr; +if (ps->s_txreq->mr) +rvt_get_mr (ps->s_txreq->mr); qp->s_ack_rdma_sge.sge = e->rdma_sge; qp->s_ack_rdma_sge.num_sge =1 ; qp->s_cur_sge = &qp->s_ack_rdma_sge;
@@ -305,9 +305,9 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,/* FALLTHROUGH */ case OP (RDMA_READ_RESPONSE_MIDDLE ): qp->s_cur_sge = &qp->s_ack_rdma_sge; - qp->s_rdma_mr = qp->s_ack_rdma_sge.sge.mr; -if (qp->s_rdma_mr) -rvt_get_mr (qp->s_rdma_mr); + ps->s_txreq->mr = qp->s_ack_rdma_sge.sge.mr; +if (ps->s_txreq->mr) +rvt_get_mr (ps->s_txreq->mr); len = qp->s_ack_rdma_sge.sge.sge_length;if (len > pmtu) { len = pmtu;
drivers/staging/rdma/hfi1/verbs.c +0 -8
@@ -728,9 +728,6 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps, pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen); } tx->wqe = qp->s_wqe; - tx->mr = qp->s_rdma_mr; -if (qp->s_rdma_mr) - qp->s_rdma_mr =NULL ; tx->hdr_dwords = hdrwords +2 ; ret =build_verbs_tx_desc (tx->sde, ss, len, tx, ahdr, pbc);if (unlikely (ret))
@@ -889,11 +886,6 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,trace_output_ibhdr (dd_from_ibdev (qp->ibqp.device), &ps->s_txreq->phdr.hdr); -if (qp->s_rdma_mr) { -rvt_put_mr (qp->s_rdma_mr); - qp->s_rdma_mr =NULL ; - } - pio_bail:if (qp->s_wqe) {spin_lock_irqsave (&qp->s_lock, flags);
--
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 6/16 staging/rdma/hfi1: Add s_sendcontext priv field
In reply to a message not in the archiveFrom: Jubin John <[email protected]>
s_sendcontext will be used to map the QPs to the send contexts for PIO.
--- drivers/staging/rdma/hfi1/qp.c | 13 +++++++++++-- drivers/staging/rdma/hfi1/ud.c | 1 + drivers/staging/rdma/hfi1/verbs.h | 9 +++++---- 3 files changed, 17 insertions(+), 6 deletions(-)
drivers/staging/rdma/hfi1/qp.c +11 -2
@@ -191,6 +191,9 @@ int hfi1_check_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr,if (!qp_to_sdma_engine (qp, sc) && dd->flags &HFI1_HAS_SEND_DMA )return -EINVAL ; + +if (!qp_to_send_context (qp, sc)) +return -EINVAL ; }if (attr_mask &IB_QP_ALT_PATH ) {
@@ -201,6 +204,9 @@ int hfi1_check_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr,if (!qp_to_sdma_engine (qp, sc) && dd->flags &HFI1_HAS_SEND_DMA )return -EINVAL ; + +if (!qp_to_send_context (qp, sc)) +return -EINVAL ; }return 0 ;
@@ -608,11 +614,13 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter)struct rvt_qp *qp = iter->qp;struct hfi1_qp_priv *priv = qp->priv;struct sdma_engine *sde; +struct send_context *send_context; sde =qp_to_sdma_engine (qp, priv->s_sc); wqe =rvt_get_swqe_ptr (qp, qp->s_last); + send_context =qp_to_send_context (qp, priv->s_sc); seq_printf(s, - "N %d %s QP%u R %u %s %u %u %u f=%x %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%u LID %x SL %u MTU %u %u %u %u SDE %p,%u\n", + "N %d %s QP%u R %u %s %u %u %u f=%x %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%u LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
@@ -641,7 +649,8 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) qp->s_retry_cnt, qp->s_rnr_retry_cnt, sde, - sde ? sde->this_idx : 0); + sde ? sde->this_idx :0 , + send_context); }void qp_comm_est (struct rvt_qp *qp)
drivers/staging/rdma/hfi1/ud.c +1 -0
@@ -394,6 +394,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) priv->s_sc = sc5; } priv->s_sde =qp_to_sdma_engine (qp, priv->s_sc); + priv->s_sendcontext =qp_to_send_context (qp, priv->s_sc); ps->s_txreq->phdr.hdr.lrh[0 ] =cpu_to_be16 (lrh0); ps->s_txreq->phdr.hdr.lrh[1 ] =cpu_to_be16 (ah_attr->dlid); ps->s_txreq->phdr.hdr.lrh[2] =
drivers/staging/rdma/hfi1/verbs.h +5 -4
@@ -199,10 +199,11 @@ struct hfi1_pio_header {* pair is made common */ struct hfi1_qp_priv { -struct ahg_ib_header *s_hdr;/* next packet header to send */ -struct sdma_engine *s_sde;/* current sde */ -u8 s_sc;/* SC[0..4] for next packet */ -u8 r_adefered;/* number of acks defered */ +struct ahg_ib_header *s_hdr;/* next header to send */ +struct sdma_engine *s_sde;/* current sde */ +struct send_context *s_sendcontext;/* current sendcontext */ +u8 s_sc;/* SC[0..4] for next packet */ +u8 r_adefered;/* number of acks defered */ struct iowait s_iowait;struct timer_list s_rnr_timer;struct rvt_qp *owner;
--
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 7/16 staging/rdma/hfi1: avoid passing pmtu
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
It is in the qp.
--- drivers/staging/rdma/hfi1/rc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rdma/hfi1/rc.c +3 -3
@@ -200,7 +200,6 @@ static u32 restart_sge(struct rvt_sge_state *ss, struct rvt_swqe *wqe,* @dev: the device for this QP * @qp: a pointer to the QP * @ohdr: a pointer to the IB header being constructed -* @pmtu: the path MTU * @ps: the xmit packet state * * Return 1 if constructed; otherwise, return 0.
@@ -208,7 +207,7 @@ static u32 restart_sge(struct rvt_sge_state *ss, struct rvt_swqe *wqe,* Note the QP s_lock must be held. */ static int make_rc_ack (struct hfi1_ibdev *dev,struct rvt_qp *qp, -struct hfi1_other_headers *ohdr,u32 pmtu, +struct hfi1_other_headers *ohdr,struct hfi1_pkt_state *ps) {struct rvt_ack_entry *e;
@@ -217,6 +216,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,u32 bth0;u32 bth2;int middle =0 ; +u32 pmtu = qp->pmtu;/* Don't send an ACK if we aren't supposed to. */ if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK ))
@@ -400,7 +400,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)/* Sending responses has higher priority over sending requests. */ if ((qp->s_flags &RVT_S_RESP_PENDING ) && -make_rc_ack (dev, qp, ohdr, pmtu, ps)) +make_rc_ack (dev, qp, ohdr, ps))return 1 ;if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_SEND_OK )) {
--
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 8/16 staging/rdma/hfi1: fix panic in send engine
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The send engine wasn't correctly handling pre-built packets, and worse, the pointer to a packet state's txreq wasn't initialized correctly.
To fix:
- all waiters need to save any prebuilt packets (smda waits already did)
- the progress routine needs to handle a QPs prebuilt packet and initialize the txreq pointer properly
To keep SDMA working, the dma send code needs to see if a packet has been built already. If not the code will build it.
--- drivers/staging/rdma/hfi1/iowait.h | 20 +++++++ drivers/staging/rdma/hfi1/rc.c | 4 + drivers/staging/rdma/hfi1/ruc.c | 2 + drivers/staging/rdma/hfi1/sdma_txreq.h | 5 ++ drivers/staging/rdma/hfi1/uc.c | 2 + drivers/staging/rdma/hfi1/ud.c | 6 ++ drivers/staging/rdma/hfi1/verbs.c | 85 +++++++++++++++---------------- drivers/staging/rdma/hfi1/verbs_txreq.h | 17 ++++++ 8 files changed, 95 insertions(+), 46 deletions(-)
drivers/staging/rdma/hfi1/iowait.h +20 -0
@@ -54,6 +54,7 @@#include <linux/workqueue.h> #include <linux/sched.h> +#include "sdma_txreq.h" /* * typedef (*restart_t)() - restart callback * @work: pointer to work structure
@@ -185,4 +186,23 @@ static inline void iowait_drain_wakeup(struct iowait *wait) wake_up(&wait->wait_dma); } +/** +* iowait_get_txhead() - get packet off of iowait list +* +* @wait wait struture +*/ +static inline struct sdma_txreq *iowait_get_txhead (struct iowait *wait) +{ +struct sdma_txreq *tx =NULL ; + +if (!list_empty (&wait->tx_head)) { + tx =list_first_entry ( + &wait->tx_head, + struct sdma_txreq, + list); +list_del_init (&tx->list); + } +return tx; +} +#endif
drivers/staging/rdma/hfi1/rc.c +4 -0
@@ -348,6 +348,8 @@ normal: } qp->s_rdma_ack_cnt++; qp->s_hdrwords = hwords; +/* pbc */ + ps->s_txreq->hdr_dwords = hwords +2 ; qp->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0, bth2, middle, ps);return 1 ;
@@ -750,6 +752,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) } qp->s_len -= len; qp->s_hdrwords = hwords; +/* pbc */ + ps->s_txreq->hdr_dwords = hwords +2 ; qp->s_cur_sge = ss; qp->s_cur_size = len; hfi1_make_ruc_header(
drivers/staging/rdma/hfi1/ruc.c +2 -0
@@ -879,6 +879,8 @@ void hfi1_do_send(struct rvt_qp *qp) timeout = jiffies + (timeout_int) /8 ; cpu = priv->s_sde ? priv->s_sde->cpu :cpumask_first (cpumask_of_node (ps.ppd->dd->node)); +/* insure a pre-built packet is handled */ + ps.s_txreq =get_waiting_verbs_txreq (qp); do { /* Check for a constructed packet to be sent. */ if (qp->s_hdrwords != 0) {
drivers/staging/rdma/hfi1/sdma_txreq.h +5 -0
@@ -127,4 +127,9 @@ struct sdma_txreq { struct sdma_desc descs[NUM_DESC]; }; +static inline int sdma_txreq_built (struct sdma_txreq *tx) +{ +return tx->num_desc; +} +#endif /* HFI1_SDMA_TXREQ_H */
drivers/staging/rdma/hfi1/uc.c +2 -0
@@ -235,6 +235,8 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) } qp->s_len -= len; qp->s_hdrwords = hwords; +/* pbc */ + ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ; qp->s_cur_sge = &qp->s_sge; qp->s_cur_size = len; hfi1_make_ruc_header(qp, ohdr, bth0 | (qp->s_state << 24),
drivers/staging/rdma/hfi1/ud.c +5 -1
@@ -53,8 +53,8 @@#include "hfi.h" #include "mad.h" -#include "qp.h" #include "verbs_txreq.h" +#include "qp.h" /** * ud_loopback - handle send on loopback QPs
@@ -394,7 +394,9 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) priv->s_sc = sc5; } priv->s_sde =qp_to_sdma_engine (qp, priv->s_sc); + ps->s_txreq->sde = priv->s_sde; priv->s_sendcontext =qp_to_send_context (qp, priv->s_sc); + ps->s_txreq->psc = priv->s_sendcontext; ps->s_txreq->phdr.hdr.lrh[0 ] =cpu_to_be16 (lrh0); ps->s_txreq->phdr.hdr.lrh[1 ] =cpu_to_be16 (ah_attr->dlid); ps->s_txreq->phdr.hdr.lrh[2] =
@@ -432,6 +434,8 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) priv->s_hdr->ahgidx =0 ; priv->s_hdr->tx_flags =0 ; priv->s_hdr->sde =NULL ; +/* pbc */ + ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ;return 1 ;
drivers/staging/rdma/hfi1/verbs.c +40 -45
140 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs_txreq.h +17 -0
@@ -63,6 +63,7 @@ struct verbs_txreq {struct rvt_mregion *mr;struct rvt_sge_state *ss;struct sdma_engine *sde; +struct send_context *psc;u16 hdr_dwords; };
@@ -74,6 +75,7 @@ static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev, struct rvt_qp *qp) {struct verbs_txreq *tx; +struct hfi1_qp_priv *priv = qp->priv; tx =kmem_cache_alloc (dev->verbs_txreq_cache,GFP_ATOMIC );if (unlikely (!tx)) {
@@ -84,9 +86,24 @@ static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev, } tx->qp = qp; tx->mr =NULL ; + tx->sde = priv->s_sde; + tx->psc = priv->s_sendcontext; +/* so that we can test if the sdma decriptors are there */ + tx->txreq.num_desc =0 ;return tx; } +static inline struct verbs_txreq *get_waiting_verbs_txreq (struct rvt_qp *qp) +{ +struct sdma_txreq *stx; +struct hfi1_qp_priv *priv = qp->priv; + + stx =iowait_get_txhead (&priv->s_iowait); +if (stx) + return container_of(stx, struct verbs_txreq, txreq); +return NULL ; +} +void hfi1_put_txreq (struct verbs_txreq *tx);int verbs_txreq_init (struct hfi1_ibdev *dev);void verbs_txreq_exit (struct hfi1_ibdev *dev);
--
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 9/16 staging/rdma/hfi1: use u8 for vl/sl
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The use should match the universal container size.
--- drivers/staging/rdma/hfi1/verbs.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +2 -2
@@ -809,7 +809,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,struct hfi1_pportdata *ppd = ps->ppd;u32 *hdr = (u32 *)&ps->s_txreq->phdr.hdr;u64 pbc_flags =0 ; -u32 sc5; +u8 sc5;unsigned long flags =0 ;struct send_context *sc;struct pio_buf *pbuf;
@@ -825,7 +825,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, goto bail; }if (likely (pbc ==0 )) { -u32 vl =sc_to_vlt (dd_from_ibdev (qp->ibqp.device), sc5); +u8 vl =sc_to_vlt (dd_from_ibdev (qp->ibqp.device), sc5);/* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */ pbc_flags |= (!!(sc5 &0x10 )) <<PBC_DC_INFO_SHIFT ; pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen);
--
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 10/16 staging/rdma/hfi1: Adaptive PIO for short messages
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The change requires a new pio_busy field in the iowait structure to track the number of outstanding pios. The new counter together with the sdma counter serve as the basis for a packet by packet decision as to which egress mechanism to use. Since packets given to different egress mechanisms are not ordered, this scheme will preserve the order.
The iowait drain/wait mechanisms are extended for a pio case. An additional qp wait flag is added for the PIO drain wait case.
Currently the only pio wait is for buffers, so the no_bufs_available() routine name is changed to pio_wait() and a third argument is passed with one of the two pio wait flags to generalize the routine. A module parameter is added to hold a configurable threshold. For now, the module parameter is zero.
A heuristic routine is added to return the func pointer of the proper egress routine to use.
The heuristic is as follows:
- SMI always uses pio
- GSI,UD qps <= threshold use pio
- UD qps > threadhold use sdma
o No coordination with sdma is required because order is not required and this qp pio count is not maintained for UD
- RC/UC ONLY packets <= threshold chose as follows:
o If sdmas pending, use SDMA
o Otherwise use pio and enable the pio tracking count at the time the pio buffer is allocated
- RC/UC ONLY packets > threshold use SDMA
o If pio's are pending the pio_wait with the new wait flag is called to delay for pios to drain
The threshold is potentially reduced by the QP's mtu.
The sc_buffer_alloc() has two additional args (a callback, a void *) which are exploited by the RC/UC cases to pass a new complete routine and a qp *.
When the shadow ring completes the credit associated with a packet, the new complete routine is called. The verbs_pio_complete() will then decrement the busy count and trigger any drain waiters in qp destroy or reset.
--- drivers/staging/rdma/hfi1/chip.c | 10 +++ drivers/staging/rdma/hfi1/chip.h | 1 drivers/staging/rdma/hfi1/hfi.h | 7 +- drivers/staging/rdma/hfi1/iowait.h | 89 ++++++++++++++++++++++ drivers/staging/rdma/hfi1/pio.c | 3 + drivers/staging/rdma/hfi1/qp.c | 25 ++++++ drivers/staging/rdma/hfi1/rc.c | 17 ++++ drivers/staging/rdma/hfi1/sdma.c | 14 ++-- drivers/staging/rdma/hfi1/uc.c | 10 ++- drivers/staging/rdma/hfi1/ud.c | 4 + drivers/staging/rdma/hfi1/verbs.c | 123 +++++++++++++++++++++++-------- drivers/staging/rdma/hfi1/verbs.h | 16 ++++ drivers/staging/rdma/hfi1/verbs_txreq.h | 5 + include/rdma/rdmavt_qp.h | 22 +++--- 14 files changed, 286 insertions(+), 60 deletions(-)
drivers/staging/rdma/hfi1/chip.c +10 -0
@@ -1588,6 +1588,14 @@ static u64 access_sw_pio_wait(const struct cntr_entry *entry,return dd->verbs_dev.n_piowait; } +static u64 access_sw_pio_drain (const struct cntr_entry *entry, +void *context,int vl,int mode,u64 data) +{ +struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + +return dd->verbs_dev.n_piodrain; +} +static u64 access_sw_vtx_wait (const struct cntr_entry *entry,void *context,int vl,int mode,u64 data) {
@@ -4129,6 +4137,8 @@ static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { access_sw_vtx_wait), [C_SW_PIO_WAIT ] =CNTR_ELEM ("PioWait" ,0 ,0 ,CNTR_NORMAL , access_sw_pio_wait), +[C_SW_PIO_DRAIN ] =CNTR_ELEM ("PioDrain" ,0 ,0 ,CNTR_NORMAL , + access_sw_pio_drain), [C_SW_KMEM_WAIT ] =CNTR_ELEM ("KmemWait" ,0 ,0 ,CNTR_NORMAL , access_sw_kmem_wait), [C_SW_SEND_SCHED] = CNTR_ELEM("SendSched", 0, 0, CNTR_NORMAL,
drivers/staging/rdma/hfi1/chip.h +1 -0
@@ -800,6 +800,7 @@ enum {C_SW_CPU_RCV_LIM ,C_SW_VTX_WAIT ,C_SW_PIO_WAIT , +C_SW_PIO_DRAIN ,C_SW_KMEM_WAIT ,C_SW_SEND_SCHED , C_SDMA_DESC_FETCHED_CNT,
drivers/staging/rdma/hfi1/hfi.h +3 -4
@@ -811,6 +811,7 @@ struct sdma_vl_map;#define BOARD_VERS_MAX 96/* how long the version string can be */ #define SERIAL_MAX 16/* length of the serial number */ +typedef int (*send_routine )(struct rvt_qp *,struct hfi1_pkt_state *,u64 );struct hfi1_devdata {struct hfi1_ibdev verbs_dev;/* must be first */ struct list_head list;
@@ -1121,10 +1122,8 @@ struct hfi1_devdata {* Handlers for outgoing data so that snoop/capture does not * have to have its hooks in the send path */ -int (*process_pio_send)(struct rvt_qp *qp,struct hfi1_pkt_state *ps, -u64 pbc); -int (*process_dma_send)(struct rvt_qp *qp,struct hfi1_pkt_state *ps, -u64 pbc); +send_routine process_pio_send; +send_routine process_dma_send;void (*pio_inline_send)(struct hfi1_devdata *dd,struct pio_buf *pbuf,u64 pbc,const void *from,size_t count);
drivers/staging/rdma/hfi1/iowait.h +89 -0
127 lines not on this page · raw message
drivers/staging/rdma/hfi1/pio.c +2 -1
@@ -1564,7 +1564,8 @@ full:write_sequnlock_irqrestore (&dev->iowait_lock, flags);for (i =0 ; i < n; i++) -hfi1_qp_wakeup (qps[i],RVT_S_WAIT_PIO ); +hfi1_qp_wakeup (qps[i], +RVT_S_WAIT_PIO |RVT_S_WAIT_PIO_DRAIN ); }/* translate a send credit update to a bit code of reasons */
drivers/staging/rdma/hfi1/qp.c +23 -2
@@ -359,6 +359,25 @@ void _hfi1_schedule_send(struct rvt_qp *qp) cpumask_first(cpumask_of_node(dd->node))); } +static void qp_pio_drain (struct rvt_qp *qp) +{ +struct hfi1_ibdev *dev; +struct hfi1_qp_priv *priv = qp->priv; + +if (!priv->s_sendcontext) +return ; + dev =to_idev (qp->ibqp.device); +while (iowait_pio_pending (&priv->s_iowait)) { +write_seqlock_irq (&dev->iowait_lock); +hfi1_sc_wantpiobuf_intr (priv->s_sendcontext,1 ); +write_sequnlock_irq (&dev->iowait_lock); +iowait_pio_drain (&priv->s_iowait); +write_seqlock_irq (&dev->iowait_lock); +hfi1_sc_wantpiobuf_intr (priv->s_sendcontext,0 ); +write_sequnlock_irq (&dev->iowait_lock); + } +} +/** * hfi1_schedule_send - schedule progress * @qp: the QP
@@ -620,7 +639,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) wqe =rvt_get_swqe_ptr (qp, qp->s_last); send_context =qp_to_send_context (qp, priv->s_sc); seq_printf(s, - "N %d %s QP%u R %u %s %u %u %u f=%x %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%u LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p\n", + "N %d %s QP%x R %u %s %u %u %u f=%x %u %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%x LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
@@ -630,7 +649,8 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) wqe ? wqe->wr.opcode :0 , qp->s_hdrwords, qp->s_flags, -atomic_read (&priv->s_iowait.sdma_busy), +iowait_sdma_pending (&priv->s_iowait), +iowait_pio_pending (&priv->s_iowait), !list_empty (&priv->s_iowait.list), qp->timeout, wqe ? wqe->ssn : 0,
@@ -740,6 +760,7 @@ void quiesce_qp(struct rvt_qp *qp)struct hfi1_qp_priv *priv = qp->priv;iowait_sdma_drain (&priv->s_iowait); +qp_pio_drain (qp);flush_tx_list (qp); }
drivers/staging/rdma/hfi1/rc.c +16 -1
@@ -181,6 +181,18 @@ void hfi1_del_timers_sync(struct rvt_qp *qp)del_timer_sync (&priv->s_rnr_timer); } +/* only opcode mask for adaptive pio */ +const u32 rc_only_opcode = +BIT (OP (SEND_ONLY ) &0x1f ) | +BIT (OP (SEND_ONLY_WITH_IMMEDIATE &0x1f )) | +BIT (OP (RDMA_WRITE_ONLY &0x1f )) | +BIT (OP (RDMA_WRITE_ONLY_WITH_IMMEDIATE &0x1f )) | +BIT (OP (RDMA_READ_REQUEST &0x1f )) | +BIT (OP (ACKNOWLEDGE &0x1f )) | +BIT (OP (ATOMIC_ACKNOWLEDGE &0x1f )) | +BIT (OP (COMPARE_SWAP &0x1f )) | +BIT (OP (FETCH_ADD &0x1f )); +static u32 restart_sge (struct rvt_sge_state *ss,struct rvt_swqe *wqe,u32 psn,u32 pmtu) {
@@ -217,6 +229,7 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp,u32 bth2;int middle =0 ;u32 pmtu = qp->pmtu; +struct hfi1_qp_priv *priv = qp->priv;/* Don't send an ACK if we aren't supposed to. */ if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK ))
@@ -350,6 +363,7 @@ normal: qp->s_hdrwords = hwords;/* pbc */ ps->s_txreq->hdr_dwords = hwords +2 ; + ps->s_txreq->sde = priv->s_sde; qp->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0, bth2, middle, ps);return 1 ;
@@ -413,7 +427,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)if (qp->s_last ==ACCESS_ONCE (qp->s_head)) goto bail;/* If DMAs are in progress, we can't flush immediately. */ -if (atomic_read (&priv->s_iowait.sdma_busy)) { +if (iowait_sdma_pending (&priv->s_iowait)) { qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; }
@@ -754,6 +768,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) qp->s_hdrwords = hwords;/* pbc */ ps->s_txreq->hdr_dwords = hwords +2 ; + ps->s_txreq->sde = priv->s_sde; qp->s_cur_sge = ss; qp->s_cur_size = len; hfi1_make_ruc_header(
drivers/staging/rdma/hfi1/sdma.c +7 -7
@@ -410,7 +410,7 @@ static void sdma_flush(struct sdma_engine *sde)#endif sdma_txclean (sde->dd, txp);if (wait) - drained =atomic_dec_and_test (&wait->sdma_busy); + drained =iowait_sdma_dec (wait);if (txp->complete) (*txp->complete)(txp,SDMA_TXREQ_S_ABORTED , drained);if (wait && drained)
@@ -584,7 +584,7 @@ static void sdma_flush_descq(struct sdma_engine *sde)/* remove from list */ sde->tx_ring[sde->tx_head++ & sde->sdma_mask] =NULL ;if (wait) - drained =atomic_dec_and_test (&wait->sdma_busy); + drained =iowait_sdma_dec (wait);#ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER trace_hfi1_sdma_out_sn (sde, txp->sn);if (WARN_ON_ONCE (sde->head_sn != txp->sn))
@@ -1499,7 +1499,7 @@ retry:/* remove from list */ sde->tx_ring[sde->tx_head++ & sde->sdma_mask] =NULL ;if (wait) - drained =atomic_dec_and_test (&wait->sdma_busy); + drained =iowait_sdma_dec (wait);#ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER trace_hfi1_sdma_out_sn (sde, txp->sn);if (WARN_ON_ONCE (sde->head_sn != txp->sn))
@@ -2093,14 +2093,14 @@ retry: goto nodesc; tail =submit_tx (sde, tx);if (wait) -atomic_inc (&wait->sdma_busy); +iowait_sdma_inc (wait);sdma_update_tail (sde, tail); unlock:spin_unlock_irqrestore (&sde->tail_lock, flags);return ret; unlock_noconn:if (wait) -atomic_inc (&wait->sdma_busy); +iowait_sdma_inc (wait); tx->next_descq_idx =0 ;#ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER tx->sn = sde->tail_sn++;
@@ -2182,7 +2182,7 @@ retry: } update_tail:if (wait) -atomic_add (count, &wait->sdma_busy); +iowait_sdma_add (wait, count);if (tail !=INVALID_TAIL )sdma_update_tail (sde, tail);spin_unlock_irqrestore (&sde->tail_lock, flags);
@@ -2193,7 +2193,7 @@ unlock_noconn: tx->wait = wait;list_del_init (&tx->list);if (wait) -atomic_inc (&wait->sdma_busy); +iowait_sdma_inc (wait); tx->next_descq_idx =0 ;#ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER tx->sn = sde->tail_sn++;
drivers/staging/rdma/hfi1/uc.c +9 -1
@@ -55,6 +55,13 @@/* cut down ridiculously long IB macro names */ #define OP (x) IB_OPCODE_UC_##x +/* only opcode mask for adaptive pio */ +const u32 uc_only_opcode = +BIT (OP (SEND_ONLY ) &0x1f ) | +BIT (OP (SEND_ONLY_WITH_IMMEDIATE &0x1f )) | +BIT (OP (RDMA_WRITE_ONLY &0x1f )) | +BIT (OP (RDMA_WRITE_ONLY_WITH_IMMEDIATE &0x1f )); +/** * hfi1_make_uc_req - construct a request packet (SEND, RDMA write) * @qp: a pointer to the QP
@@ -86,7 +93,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)if (qp->s_last ==ACCESS_ONCE (qp->s_head)) goto bail;/* If DMAs are in progress, we can't flush immediately. */ -if (atomic_read (&priv->s_iowait.sdma_busy)) { +if (iowait_sdma_pending (&priv->s_iowait)) { qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; }
@@ -237,6 +244,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) qp->s_hdrwords = hwords;/* pbc */ ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ; + ps->s_txreq->sde = priv->s_sde; qp->s_cur_sge = &qp->s_sge; qp->s_cur_size = len; hfi1_make_ruc_header(qp, ohdr, bth0 | (qp->s_state << 24),
drivers/staging/rdma/hfi1/ud.c +2 -2
@@ -294,7 +294,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)if (qp->s_last ==ACCESS_ONCE (qp->s_head)) goto bail;/* If DMAs are in progress, we can't flush immediately. */ -if (atomic_read (&priv->s_iowait.sdma_busy)) { +if (iowait_sdma_pending (&priv->s_iowait)) { qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; }
@@ -331,7 +331,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)* Instead of waiting, we could queue a * zero length descriptor so we get a callback. */ -if (atomic_read (&priv->s_iowait.sdma_busy)) { +if (iowait_sdma_pending (&priv->s_iowait)) { qp->s_flags |=RVT_S_WAIT_DMA ; goto bail; }
drivers/staging/rdma/hfi1/verbs.c +91 -32
199 lines not on this page · raw message
drivers/staging/rdma/hfi1/verbs.h +16 -0
@@ -265,6 +265,7 @@ struct hfi1_ibdev {struct timer_list mem_timer;u64 n_piowait; +u64 n_piodrain;u64 n_txwait;u64 n_kmem_wait;
@@ -425,6 +426,19 @@ void hfi1_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr,int hfi1_check_send_wqe (struct rvt_qp *qp,struct rvt_swqe *wqe); +extern const u32 rc_only_opcode; +extern const u32 uc_only_opcode; + +static inline u8 get_opcode (struct hfi1_ib_header *h) +{ +u16 lnh =be16_to_cpu (h->lrh[0 ]) &3 ; + +if (lnh ==IB_LNH_IBA_LOCAL ) +return be32_to_cpu (h->u.oth.bth[0 ]) >>24 ; +else +return be32_to_cpu (h->u.l.oth.bth[0 ]) >>24 ; +} +int hfi1_ruc_check_hdr (struct hfi1_ibport *ibp,struct hfi1_ib_header *hdr,int has_grh,struct rvt_qp *qp,u32 bth0);
@@ -494,6 +508,8 @@ extern unsigned int hfi1_max_srq_sges;extern unsigned int hfi1_max_srq_wrs; +extern unsigned short piothreshold; +extern const u32 ib_hfi1_rnr_table[];#endif /* HFI1_VERBS_H */
drivers/staging/rdma/hfi1/verbs_txreq.h +5 -0
@@ -93,6 +93,11 @@ static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,return tx; } +static inline struct sdma_txreq *get_sdma_txreq (struct verbs_txreq *tx) +{ +return &tx->txreq; +} +static inline struct verbs_txreq *get_waiting_verbs_txreq (struct rvt_qp *qp) {struct sdma_txreq *stx;
include/rdma/rdmavt_qp.h +12 -10
@@ -82,6 +82,7 @@* RVT_S_WAIT_DMA - waiting for send DMA queue to drain before generating * next send completion entry not via send DMA * RVT_S_WAIT_PIO - waiting for a send buffer to be available +* RVT_S_WAIT_PIO_DRAIN - waiting for a qp to drain pio packets * RVT_S_WAIT_TX - waiting for a struct verbs_txreq to be available * RVT_S_WAIT_DMA_DESC - waiting for DMA descriptors to be available * RVT_S_WAIT_KMEM - waiting for kernel memory to be available
@@ -101,16 +102,17 @@#define RVT_S_WAIT_SSN_CREDIT 0x0100#define RVT_S_WAIT_DMA 0x0200#define RVT_S_WAIT_PIO 0x0400 -#define RVT_S_WAIT_TX 0x0800 -#define RVT_S_WAIT_DMA_DESC 0x1000 -#define RVT_S_WAIT_KMEM 0x2000 -#define RVT_S_WAIT_PSN 0x4000 -#define RVT_S_WAIT_ACK 0x8000 -#define RVT_S_SEND_ONE 0x10000 -#define RVT_S_UNLIMITED_CREDIT 0x20000 -#define RVT_S_AHG_VALID 0x40000 -#define RVT_S_AHG_CLEAR 0x80000 -#define RVT_S_ECN 0x100000 +#define RVT_S_WAIT_PIO_DRAIN 0x0800 +#define RVT_S_WAIT_TX 0x1000 +#define RVT_S_WAIT_DMA_DESC 0x2000 +#define RVT_S_WAIT_KMEM 0x4000 +#define RVT_S_WAIT_PSN 0x8000 +#define RVT_S_WAIT_ACK 0x10000 +#define RVT_S_SEND_ONE 0x20000 +#define RVT_S_UNLIMITED_CREDIT 0x40000 +#define RVT_S_AHG_VALID 0x80000 +#define RVT_S_AHG_CLEAR 0x100000 +#define RVT_S_ECN 0x200000/* * Wait flags that would prevent any packet type from being sent.
--
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 11/16 IB/qib, staging/rdma/hfi1, IB/rdmavt: progress selection changes
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The non-rdamvt versions of qib and hfi1 allow for a differing heuristic to override a schedule progress in favor of a direct call the the progress routine.
This patch adds that for both drivers and rdmavt.
--- drivers/infiniband/hw/qib/qib_qp.c | 7 +++++-- drivers/infiniband/sw/rdmavt/qp.c | 10 +++++++--- drivers/staging/rdma/hfi1/qp.c | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/infiniband/hw/qib/qib_qp.c +5 -2
@@ -484,12 +484,13 @@ void qib_get_credit(struct rvt_qp *qp, u32 aeth)* the ring but after the wqe has been * setup. * -* Returns 0 on success, -EINVAL on failure +* Returns 1 to force direct progress, 0 otherwise, -EINVAL on failure */ int qib_check_send_wqe (struct rvt_qp *qp,struct rvt_swqe *wqe) {struct rvt_ah *ah; +int ret =0 ;switch (qp->ibqp.qp_type) {case IB_QPT_RC :
@@ -503,11 +504,13 @@ int qib_check_send_wqe(struct rvt_qp *qp, ah =ibah_to_rvtah (wqe->ud_wr.ah);if (wqe->length > (1 << ah->log_pmtu))return -EINVAL ; +/* progress hint */ + ret =1 ;break ;default :break ; } -return 0 ; +return ret; }#ifdef CONFIG_DEBUG_FS
drivers/infiniband/sw/rdmavt/qp.c +7 -3
@@ -1430,7 +1430,9 @@ static inline u32 qp_get_savail(struct rvt_qp *qp)* @qp: the QP to post on * @wr: the work request to send */ -static int rvt_post_one_wr (struct rvt_qp *qp,struct ib_send_wr *wr) +static int rvt_post_one_wr (struct rvt_qp *qp, +struct ib_send_wr *wr, +int *call_send) {struct rvt_swqe *wqe;u32 next;
@@ -1532,8 +1534,10 @@ static int rvt_post_one_wr(struct rvt_qp *qp, struct ib_send_wr *wr)/* general part of wqe valid - allow for driver checks */ if (rdi->driver_f.check_send_wqe) { ret = rdi->driver_f.check_send_wqe (qp, wqe); -if (ret) +if (ret <0 ) goto bail_inval_free; +if (ret) + *call_send = ret; } log_pmtu = qp->log_pmtu;
@@ -1606,7 +1610,7 @@ int rvt_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, call_send = qp->s_head ==ACCESS_ONCE (qp->s_last) && !wr->next;for (; wr; wr = wr->next) { - err =rvt_post_one_wr (qp, wr); + err =rvt_post_one_wr (qp, wr, &call_send);if (unlikely (err)) { *bad_wr = wr; goto bail;
drivers/staging/rdma/hfi1/qp.c +2 -1
@@ -73,6 +73,7 @@ static int iowait_sleep(struct sdma_txreq *stx, unsigned seq);static void iowait_wakeup (struct iowait *wait,int reason); +static void qp_pio_drain (struct rvt_qp *qp);static inline unsigned mk_qpn (struct rvt_qpn_table *qpt,struct rvt_qpn_map *map,unsigned off)
@@ -272,7 +273,7 @@ int hfi1_check_send_wqe(struct rvt_qp *qp,default :break ; } -return 0 ; +return wqe->length <= piothreshold; }/**
--
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 12/16 staging/rdma/hfi: fix CQ completion order issue
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The current implementation of the sdma_wait variable has a timing hole that can cause a completion Q entry to be returned from a pio send prior to an older sdma packets completion queue entry.
The sdma_wait variable used to be decremented prior to calling the packet complete routine. The hole is between decrement and the verbs completion where send engine using pio could return a out of order completion in that window.
This patch closes the hole by allowing an API option to
specify an sdma_drained callback. The atomic dec
is positioned after the complete callback to avoid the window as long as the pio path doesn't execute when there is a non-zero sdma count.
--- drivers/staging/rdma/hfi1/iowait.h | 12 +++- drivers/staging/rdma/hfi1/qp.c | 20 ++++++- drivers/staging/rdma/hfi1/sdma.c | 94 ++++++++++---------------------- drivers/staging/rdma/hfi1/sdma.h | 4 + drivers/staging/rdma/hfi1/sdma_txreq.h | 2 - drivers/staging/rdma/hfi1/user_sdma.c | 7 +- drivers/staging/rdma/hfi1/verbs.c | 18 +----- 7 files changed, 65 insertions(+), 92 deletions(-)
drivers/staging/rdma/hfi1/iowait.h +9 -3
@@ -69,7 +69,8 @@ struct sdma_engine;* @list: used to add/insert into QP/PQ wait lists * @tx_head: overflow list of sdma_txreq's * @sleep: no space callback -* @wakeup: space callback +* @wakeup: space callback wakeup +* @sdma_drained: sdma count drained * @iowork: workqueue overhead * @wait_dma: wait for sdma_busy == 0 * @wait_pio: wait for pio_busy == 0
@@ -104,6 +105,7 @@ struct iowait {struct sdma_txreq *tx, unsigned seq);void (*wakeup)(struct iowait *wait,int reason); +void (*sdma_drained)(struct iowait *wait);struct work_struct iowork;wait_queue_head_t wait_dma;wait_queue_head_t wait_pio;
@@ -122,7 +124,7 @@ struct iowait {* @tx_limit: limit for overflow queuing * @func: restart function for workqueue * @sleep: sleep function for no space -* @wakeup: wakeup function for no space +* @resume: wakeup function for no space * * This function initializes the iowait * structure embedded in the QP or PQ.
@@ -138,7 +140,8 @@ static inline void iowait_init(struct iowait *wait, struct sdma_txreq *tx, unsigned seq), - void (*wakeup)(struct iowait *wait, int reason)) + void (*wakeup)(struct iowait *wait, int reason), + void (*sdma_drained)(struct iowait *wait)) { wait->count = 0;INIT_LIST_HEAD (&wait->list);
@@ -151,6 +154,7 @@ static inline void iowait_init( wait->tx_limit = tx_limit; wait->sleep = sleep; wait->wakeup = wakeup; + wait->sdma_drained = sdma_drained; }/**
@@ -273,6 +277,8 @@ static inline void iowait_drain_wakeup(struct iowait *wait) {wake_up (&wait->wait_dma);wake_up (&wait->wait_pio); +if (wait->sdma_drained) + wait->sdma_drained (wait); }/**
drivers/staging/rdma/hfi1/qp.c +19 -1
@@ -73,6 +73,7 @@ static int iowait_sleep(struct sdma_txreq *stx, unsigned seq);static void iowait_wakeup (struct iowait *wait,int reason); +static void iowait_sdma_drained (struct iowait *wait);static void qp_pio_drain (struct rvt_qp *qp); static inline unsigned mk_qpn(struct rvt_qpn_table *qpt,
@@ -509,6 +510,22 @@ static void iowait_wakeup(struct iowait *wait, int reason)hfi1_qp_wakeup (qp,RVT_S_WAIT_DMA_DESC ); } +static void iowait_sdma_drained (struct iowait *wait) +{ +struct rvt_qp *qp =iowait_to_qp (wait); + +/* +* This happens when the send engine notes +* a QP in the error state and cannot +* do the flush work until that QP's +* sdma work has finished. +*/ +if (qp->s_flags &RVT_S_WAIT_DMA ) { + qp->s_flags &= ~RVT_S_WAIT_DMA ; +hfi1_schedule_send (qp); + } +} +/** * * qp_to_sdma_engine - map a qp to a send engine
@@ -774,7 +791,8 @@ void notify_qp_reset(struct rvt_qp *qp)1 , _hfi1_do_send, iowait_sleep, - iowait_wakeup); + iowait_wakeup, + iowait_sdma_drained); priv->r_adefered =0 ;clear_ahg (qp); }
drivers/staging/rdma/hfi1/sdma.c +29 -65
135 lines not on this page · raw message
drivers/staging/rdma/hfi1/sdma.h +2 -2
@@ -555,7 +555,7 @@ static inline int sdma_txinit_ahg( u8 num_ahg, u32 *ahg, u8 ahg_hlen, - void (*cb)(struct sdma_txreq *, int, int)) + void (*cb)(struct sdma_txreq *, int)) { if (tlen == 0) return -ENODATA;
@@ -618,7 +618,7 @@ static inline int sdma_txinit(struct sdma_txreq *tx, u16 flags, u16 tlen, - void (*cb)(struct sdma_txreq *, int, int)) + void (*cb)(struct sdma_txreq *, int)) { return sdma_txinit_ahg(tx, flags, tlen, 0, 0, NULL, 0, cb); }
drivers/staging/rdma/hfi1/sdma_txreq.h +1 -1
@@ -93,7 +93,7 @@ struct sdma_desc {#define SDMA_TXREQ_F_USE_AHG 0x0004struct sdma_txreq ; -typedef void (*callback_t )(struct sdma_txreq *,int ,int ); +typedef void (*callback_t )(struct sdma_txreq *,int );struct iowait ;struct sdma_txreq {
drivers/staging/rdma/hfi1/user_sdma.c +3 -4
@@ -273,7 +273,7 @@ struct user_sdma_txreq {static int user_sdma_send_pkts (struct user_sdma_request *,unsigned );static int num_user_pages (const struct iovec *); -static void user_sdma_txreq_cb (struct sdma_txreq *,int ,int ); +static void user_sdma_txreq_cb (struct sdma_txreq *,int );static inline void pq_update (struct hfi1_user_sdma_pkt_q *);static void user_sdma_free_request (struct user_sdma_request *,bool ); static int pin_vector_pages(struct user_sdma_request *,
@@ -388,7 +388,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)init_waitqueue_head (&pq->wait);iowait_init (&pq->busy,0 ,NULL , defer_packet_queue, - activate_packet_queue); + activate_packet_queue,NULL ); pq->reqidx =0 ;snprintf (buf,64 ,"txreq-kmem-cache-%u-%u-%u" , dd->unit, uctxt->ctxt, fd->subctxt);
@@ -1341,8 +1341,7 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,* tx request have been processed by the DMA engine. Called in * interrupt context. */ -static void user_sdma_txreq_cb (struct sdma_txreq *txreq,int status, -int drain) +static void user_sdma_txreq_cb (struct sdma_txreq *txreq,int status) {struct user_sdma_txreq *tx = container_of(txreq, struct user_sdma_txreq, txreq);
drivers/staging/rdma/hfi1/verbs.c +2 -16
@@ -130,8 +130,7 @@ MODULE_PARM_DESC(piothreshold, "size used to determine sdma vs. pio");static void verbs_sdma_complete (struct sdma_txreq *cookie, -int status, -int drained); +int status); static int pio_wait(struct rvt_qp *qp, struct send_context *sc,
@@ -523,8 +522,7 @@ void update_sge(struct rvt_sge_state *ss, u32 length)/* New API */ static void verbs_sdma_complete (struct sdma_txreq *cookie, -int status, -int drained) +int status) {struct verbs_txreq *tx = container_of(cookie, struct verbs_txreq, txreq);
@@ -539,18 +537,6 @@ static void verbs_sdma_complete( hdr = &tx->phdr.hdr;hfi1_rc_send_complete (qp, hdr); } -if (drained) { -/* -* This happens when the send engine notes -* a QP in the error state and cannot -* do the flush work until that QP's -* sdma work has finished. -*/ -if (qp->s_flags &RVT_S_WAIT_DMA ) { - qp->s_flags &= ~RVT_S_WAIT_DMA ; -hfi1_schedule_send (qp); - } - }spin_unlock (&qp->s_lock);hfi1_put_txreq (tx);
--
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 13/16 staging/rdma/hfi1: Determine actual operational VLs
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Use shared credits and dedicated credits for each VL to determine the actual number of operational VLs.
--- drivers/staging/rdma/hfi1/chip.c | 37 +++++++++++++++++++++++++++++-------- drivers/staging/rdma/hfi1/diag.c | 2 +- drivers/staging/rdma/hfi1/hfi.h | 3 ++- 3 files changed, 32 insertions(+), 10 deletions(-)
drivers/staging/rdma/hfi1/chip.c +29 -8
@@ -10305,12 +10305,6 @@ int hfi1_set_ib_cfg(struct hfi1_pportdata *ppd, int which, u32 val) ppd->vls_operational = val;if (!ppd->port) ret = -EINVAL ; -else - ret =sdma_map_init ( - ppd->dd, - ppd->port -1 , - val, -NULL ); }break ;/*
@@ -10721,12 +10715,15 @@ static void wait_for_vl_status_clear(struct hfi1_devdata *dd, u64 mask,* raise = if the new limit is higher than the current value (may be changed * earlier in the algorithm), set the new limit to the new value */ -int set_buffer_control (struct hfi1_devdata *dd,struct buffer_control *new_bc) +int set_buffer_control (struct hfi1_pportdata *ppd, +struct buffer_control *new_bc) { +struct hfi1_devdata *dd = ppd->dd;u64 changing_mask, ld_mask, stat_mask;int change_count;int i, use_all_mask;int this_shared_changing; +int vl_count =0 , ret;/* * A0: add the variable any_shared_limit_changing below and in the * algorithm above. If removing A0 support, it can be removed.
@@ -10878,6 +10875,28 @@ int set_buffer_control(struct hfi1_devdata *dd, struct buffer_control *new_bc)/* bracket the credit change with a total adjustment */ if (new_total < cur_total)set_global_limit (dd, new_total); + +/* +* Determine the actual number of operational VLS using the number of +* dedicated and shared credits for each VL. +*/ +if (change_count >0 ) { +for (i =0 ; i <TXE_NUM_DATA_VL ; i++) +if (be16_to_cpu (new_bc->vl[i].dedicated) >0 || +be16_to_cpu (new_bc->vl[i].shared) >0 ) + vl_count++; + ppd->actual_vls_operational = vl_count; + ret =sdma_map_init (dd, ppd->port -1 , vl_count ? + ppd->actual_vls_operational : + ppd->vls_operational, +NULL ); +if (ret ==0 ) + ret =pio_map_init (dd, ppd->port -1 , vl_count ? + ppd->actual_vls_operational : + ppd->vls_operational,NULL ); +if (ret) +return ret; + }return 0 ; }
@@ -10969,7 +10988,7 @@ int fm_set_table(struct hfi1_pportdata *ppd, int which, void *t) VL_ARB_LOW_PRIO_TABLE_SIZE, t);break ;case FM_TBL_BUFFER_CONTROL : - ret =set_buffer_control (ppd->dd, t); + ret =set_buffer_control (ppd, t);break ;case FM_TBL_SC2VLNT :set_sc2vlnt (ppd->dd, t);
@@ -13990,6 +14009,7 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev, } ppd->vls_supported = num_vls; ppd->vls_operational = ppd->vls_supported; + ppd->actual_vls_operational = ppd->vls_supported;/* Set the default MTU. */ for (vl =0 ; vl < num_vls; vl++) dd->vld[vl].mtu = hfi1_max_mtu;
@@ -14074,6 +14094,7 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev, num_vls, dd->chip_sdma_engines); num_vls = dd->chip_sdma_engines; ppd->vls_supported = dd->chip_sdma_engines; + ppd->vls_operational = ppd->vls_supported; }/*
drivers/staging/rdma/hfi1/diag.c +1 -1
@@ -1017,7 +1017,7 @@ static long hfi1_assign_snoop_link_credits(struct hfi1_pportdata *ppd, t.vl[i].dedicated = be_per_vl_credits; t.vl[15 ].dedicated =cpu_to_be16 (vl15_credits); -return set_buffer_control (ppd->dd, &t); +return set_buffer_control (ppd, &t); err_exit: snoop_dbg("port_state = 0x%x, total_credits = %d, vl15_credits = %d",
drivers/staging/rdma/hfi1/hfi.h +2 -1
@@ -644,6 +644,7 @@ struct hfi1_pportdata {u16 link_speed_active;u8 vls_supported;u8 vls_operational; +u8 actual_vls_operational;/* LID mask control */ u8 lmc;/* Rx Polarity inversion (compensate for ~tx on partner) */
@@ -1516,7 +1517,7 @@ int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps, u64 pbc);void snoop_inline_pio_send (struct hfi1_devdata *dd,struct pio_buf *pbuf,u64 pbc,const void *from,size_t count); -int set_buffer_control (struct hfi1_devdata *dd,struct buffer_control *bc); +int set_buffer_control (struct hfi1_pportdata *ppd,struct buffer_control *bc);static inline struct hfi1_devdata *dd_from_ppd (struct hfi1_pportdata *ppd) {
--
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 14/16 staging/rdma/hfi1: Add qp to send context mapping for PIO
In reply to a message not in the archiveFrom: Jubin John <[email protected]>
PIO send context mapping is changed from per-VL to QPN based.
qp to send context mapping is done using a mapping infrastructure similar to the current vl to sdma engine mapping.
--- drivers/staging/rdma/hfi1/hfi.h | 6 + drivers/staging/rdma/hfi1/init.c | 2 drivers/staging/rdma/hfi1/pio.c | 241 ++++++++++++++++++++++++++++++++++++- drivers/staging/rdma/hfi1/pio.h | 106 ++++++++++++++++ drivers/staging/rdma/hfi1/qp.c | 24 ++++ drivers/staging/rdma/hfi1/qp.h | 1 drivers/staging/rdma/hfi1/verbs.c | 12 -- drivers/staging/rdma/hfi1/verbs.h | 2 8 files changed, 375 insertions(+), 19 deletions(-)
drivers/staging/rdma/hfi1/hfi.h +6 -0
@@ -842,6 +842,12 @@ struct hfi1_devdata {spinlock_t sc_lock;/* Per VL data. Enough for all VLs but not all elements are set/used. */ struct per_vl_data vld[PER_VL_SEND_CONTEXTS ]; +/* lock for pio_map */ +spinlock_t pio_map_lock; +/* array of kernel send contexts */ +struct send_context **kernel_send_context; +/* array of vl maps */ +struct pio_vl_map __rcu *pio_map;/* seqlock for sc2vl */ seqlock_t sc2vl_lock;u64 sc2vl[4 ];
drivers/staging/rdma/hfi1/init.c +2 -0
@@ -1050,6 +1050,7 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra)mutex_init (&dd->qsfp_i2c_mutex);seqlock_init (&dd->sc2vl_lock);spin_lock_init (&dd->sde_map_lock); +spin_lock_init (&dd->pio_map_lock);init_waitqueue_head (&dd->event_queue); dd->int_counter =alloc_percpu (u64);
@@ -1317,6 +1318,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd) } }kfree (tmp); +free_pio_map (dd);/* must follow rcv context free - need to remove rcv's hooks */ for (ctxt =0 ; ctxt < dd->num_send_contexts; ctxt++)sc_free (dd->send_contexts[ctxt].sc);
drivers/staging/rdma/hfi1/pio.c +236 -5
289 lines not on this page · raw message
drivers/staging/rdma/hfi1/pio.h +106 -0
112 lines not on this page · raw message
drivers/staging/rdma/hfi1/qp.c +24 -0
@@ -552,6 +552,30 @@ struct sdma_engine *qp_to_sdma_engine(struct rvt_qp *qp, u8 sc5)return sde; } +/* +* qp_to_send_context - map a qp to a send context +* @qp: the QP +* @sc5: the 5 bit sc +* +* Return: +* A send context for the qp +*/ +struct send_context *qp_to_send_context (struct rvt_qp *qp,u8 sc5) +{ +struct hfi1_devdata *dd =dd_from_ibdev (qp->ibqp.device); + +switch (qp->ibqp.qp_type) { +case IB_QPT_SMI : +/* SMA packets to VL15 */ +return dd->vld[15 ].sc; +default : +break ; + } + +return pio_select_send_context_sc (dd, qp->ibqp.qp_num >> dd->qos_shift, + sc5); +} +struct qp_iter {struct hfi1_ibdev *dev;struct rvt_qp *qp;
drivers/staging/rdma/hfi1/qp.h +1 -0
@@ -109,6 +109,7 @@ void hfi1_get_credit(struct rvt_qp *qp, u32 aeth);void hfi1_qp_wakeup (struct rvt_qp *qp,u32 flag);struct sdma_engine *qp_to_sdma_engine (struct rvt_qp *qp,u8 sc5); +struct send_context *qp_to_send_context (struct rvt_qp *qp,u8 sc5);struct qp_iter ;
drivers/staging/rdma/hfi1/verbs.c +0 -12
@@ -783,18 +783,6 @@ static int pio_wait(struct rvt_qp *qp,return ret; } -struct send_context *qp_to_send_context (struct rvt_qp *qp,u8 sc5) -{ -struct hfi1_devdata *dd =dd_from_ibdev (qp->ibqp.device); -struct hfi1_pportdata *ppd = dd->pport + (qp->port_num -1 ); -u8 vl; - - vl =sc_to_vlt (dd, sc5); -if (vl >= ppd->vls_supported && vl !=15 ) -return NULL ; -return dd->vld[vl].sc; -} -static void verbs_pio_complete (void *arg,int code) {struct rvt_qp *qp = (struct rvt_qp *)arg;
drivers/staging/rdma/hfi1/verbs.h +0 -2
@@ -478,8 +478,6 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,int hfi1_verbs_send_pio (struct rvt_qp *qp,struct hfi1_pkt_state *ps,u64 pbc); -struct send_context *qp_to_send_context (struct rvt_qp *qp,u8 sc5); -extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];extern const u8 hdr_len_by_opcode[];
--
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 15/16 staging/rdma/hfi1: Add send context sw index
In reply to a message not in the archiveFrom: Jubin John <[email protected]>
Print the qp's send context sw index in the qpstats
--- drivers/staging/rdma/hfi1/qp.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rdma/hfi1/qp.c +3 -2
@@ -681,7 +681,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) wqe =rvt_get_swqe_ptr (qp, qp->s_last); send_context =qp_to_send_context (qp, priv->s_sc); seq_printf(s, - "N %d %s QP%x R %u %s %u %u %u f=%x %u %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%x LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p\n", + "N %d %s QP%x R %u %s %u %u %u f=%x %u %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%x LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p,%u\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
@@ -712,7 +712,8 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) qp->s_rnr_retry_cnt, sde, sde ? sde->this_idx :0 , - send_context); + send_context, + send_context ? send_context->sw_index : 0); }void qp_comm_est (struct rvt_qp *qp)
--
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 16/16 staging/rdma/hfi1: add cq head and tail information to qpstats
In reply to a message not in the archiveFrom: Vennila Megavannan <[email protected]>
This enables debugging issues related to cq event signalling mechanism
--- drivers/staging/rdma/hfi1/qp.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rdma/hfi1/qp.c +4 -2
@@ -681,7 +681,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) wqe =rvt_get_swqe_ptr (qp, qp->s_last); send_context =qp_to_send_context (qp, priv->s_sc); seq_printf(s, - "N %d %s QP%x R %u %s %u %u %u f=%x %u %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%x LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p,%u\n", + "N %d %s QP%x R %u %s %u %u %u f=%x %u %u %u %u %u %u PSN %x %x %x %x %x (%u %u %u %u %u %u %u) QP%x LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p,%u CQ %u %u\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
@@ -713,7 +713,9 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter) sde, sde ? sde->this_idx :0 , send_context, - send_context ? send_context->sw_index : 0); + send_context ? send_context->sw_index :0 , +ibcq_to_rvtcq (qp->ibqp.send_cq)->queue->head, + ibcq_to_rvtcq(qp->ibqp.send_cq)->queue->tail); }void qp_comm_est (struct rvt_qp *qp)
--
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