IB/hfi1: Adaptive PIO bug fixes and a few others
Subsystems (3)
cover IB/hfi1: Adaptive PIO bug fixes and a few others
Fix some bugs with the adaptive PIO feature and enable it by default. There are also two other minor bug fixes coming along for the ride in this series.
Patches apply on the "Bug fixes post destaging of driver" patch series which was recently posted. Should apply cleanly on the hfi1 branch of Doug's GitHub repo.
Can be seen in my repo as well:
https://github.com/ddalessa/kernel/tree/for-4.6.
---
Alex Estrin (1):
IB/rdmavt: Post receive for QP in ERR state
Easwar Hariharan (1):
IB/hfi1: Improve LED beaconing
Mike Marciniszyn (8):
IB/hfi1: Report pid in qp_stats to aid debug IB/hfi1: Fix issues with qp_stats print IB/hfi1: Add unique trace point for pio and sdma send IB/hfi1: Fix ordering of trace for accuracy IB/hfi1: Fix PIO wakeup timing hole
IB/hfi1: Fix panic in adaptive pio
IB/hfi1: Fix adaptive pio packet corruption IB/hfi1: Enable adaptive pio by default
drivers/infiniband/hw/hfi1/driver.c | 59 +++++++++++++++-------------------- drivers/infiniband/hw/hfi1/hfi.h | 10 ++---- drivers/infiniband/hw/hfi1/mad.c | 20 ++++++------ drivers/infiniband/hw/hfi1/pio.c | 12 ++++--- drivers/infiniband/hw/hfi1/qp.c | 7 +++- drivers/infiniband/hw/hfi1/rc.c | 2 + drivers/infiniband/hw/hfi1/trace.h | 10 +++++- drivers/infiniband/hw/hfi1/verbs.c | 42 ++++++++++++++----------- drivers/infiniband/sw/rdmavt/qp.c | 34 +++++++++++++++----- include/rdma/rdmavt_qp.h | 1 + 10 files changed, 110 insertions(+), 87 deletions(-)
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/10 IB/hfi1: Improve LED beaconing
In reply to a message not in the archiveFrom: Easwar Hariharan <[email protected]>
The current LED beaconing code is unclear and uses the timer handler to turn off the timer. This patch simplifies the code by removing the special semantics of timeon = timeoff = 0 being interpreted as a request to turn off the beaconing.
--- drivers/infiniband/hw/hfi1/driver.c | 59 +++++++++++++++-------------------- drivers/infiniband/hw/hfi1/hfi.h | 10 ++---- drivers/infiniband/hw/hfi1/mad.c | 20 ++++++------ 3 files changed, 38 insertions(+), 51 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +25 -34
@@ -1170,18 +1170,20 @@ void shutdown_led_override(struct hfi1_pportdata *ppd)struct hfi1_devdata *dd = ppd->dd;/* -* This pairs with the memory barrier implied by the atomic_dec in -* hfi1_set_led_override to ensure that we read the correct state of -* LED beaconing represented by led_override_timer_active +* This pairs with the memory barrier in hfi1_start_led_override to +* ensure that we read the correct state of LED beaconing represented +* by led_override_timer_active */ -smp_mb (); +smp_rmb ();if (atomic_read (&ppd->led_override_timer_active)) {del_timer_sync (&ppd->led_override_timer);atomic_set (&ppd->led_override_timer_active,0 ); +/* Ensure the atomic_set is visible to all CPUs */ +smp_wmb (); } -/* Shut off LEDs after we are sure timer is not running */ -setextled (dd,0 ); +/* Hand control of the LED to the DC for normal operation */ +write_csr (dd,DCC_CFG_LED_CNTRL ,0 ); }static void run_led_override (unsigned long opaque)
@@ -1195,59 +1197,48 @@ static void run_led_override(unsigned long opaque)return ; phase_idx = ppd->led_override_phase &1 ; +setextled (dd, phase_idx); timeout = ppd->led_override_vals[phase_idx]; +/* Set up for next phase */ ppd->led_override_phase = !ppd->led_override_phase; -/* -* don't re-fire the timer if user asked for it to be off; we let -* it fire one more time after they turn it off to simplify -*/ -if (ppd->led_override_vals[0 ] || ppd->led_override_vals[1 ]) { -mod_timer (&ppd->led_override_timer, jiffies + timeout); - }else { -/* Hand control of the LED to the DC for normal operation */ -write_csr (dd,DCC_CFG_LED_CNTRL ,0 ); -/* Record that we did not re-fire the timer */ -atomic_dec (&ppd->led_override_timer_active); - } +mod_timer (&ppd->led_override_timer, jiffies + timeout); }/* * To have the LED blink in a particular pattern, provide timeon and timeoff -* in milliseconds. To turn off custom blinking and return to normal operation, -* provide timeon = timeoff = 0. +* in milliseconds. +* To turn off custom blinking and return to normal operation, use +* shutdown_led_override() */ -void hfi1_set_led_override (struct hfi1_pportdata *ppd,unsigned int timeon, -unsigned int timeoff) +void hfi1_start_led_override (struct hfi1_pportdata *ppd,unsigned int timeon, +unsigned int timeoff) { -struct hfi1_devdata *dd = ppd->dd; - -if (!(dd->flags &HFI1_INITTED )) +if (!(ppd->dd->flags &HFI1_INITTED ))return ;/* Convert to jiffies for direct use in timer */ ppd->led_override_vals[0 ] =msecs_to_jiffies (timeoff); ppd->led_override_vals[1 ] =msecs_to_jiffies (timeon); - ppd->led_override_phase =1 ;/* Arbitrarily start from LED on phase */ + +/* Arbitrarily start from LED on phase */ + ppd->led_override_phase =1 ;/* * If the timer has not already been started, do so. Use a "quick" -* timeout so the function will be called soon, to look at our request. +* timeout so the handler will be called soon to look at our request. */ -if (atomic_inc_return (&ppd->led_override_timer_active) ==1 ) { -/* Need to start timer */ +if (!timer_pending (&ppd->led_override_timer)) {setup_timer (&ppd->led_override_timer, run_led_override, (unsigned long )ppd); - ppd->led_override_timer.expires = jiffies +1 ;add_timer (&ppd->led_override_timer); - }else { -if (ppd->led_override_vals[0 ] || ppd->led_override_vals[1 ]) -mod_timer (&ppd->led_override_timer, jiffies +1 ); -atomic_dec (&ppd->led_override_timer_active); +atomic_set (&ppd->led_override_timer_active,1 ); +/* Ensure the atomic_set is visible to all CPUs */ +smp_wmb (); } }
drivers/infiniband/hw/hfi1/hfi.h +3 -7
@@ -1623,13 +1623,9 @@ void hfi1_free_devdata(struct hfi1_devdata *);void cc_state_reclaim (struct rcu_head *rcu);struct hfi1_devdata *hfi1_alloc_devdata (struct pci_dev *pdev,size_t extra); -void hfi1_set_led_override (struct hfi1_pportdata *ppd,unsigned int timeon, -unsigned int timeoff); -/* -* Only to be used for driver unload or device reset where we cannot allow -* the timer to fire even the one extra time, else use hfi1_set_led_override -* with timeon = timeoff = 0 -*/ +/* LED beaconing functions */ +void hfi1_start_led_override (struct hfi1_pportdata *ppd,unsigned int timeon, +unsigned int timeoff);void shutdown_led_override (struct hfi1_pportdata *ppd);#define HFI1_CREDIT_RETURN_RATE (100)
drivers/infiniband/hw/hfi1/mad.c +10 -10
@@ -583,11 +583,11 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, pi->port_states.ledenable_offlinereason |= ppd->is_sm_config_started <<5 ;/* -* This pairs with the memory barrier implied by the atomic_dec in -* hfi1_set_led_override to ensure that we read the correct state of -* LED beaconing represented by led_override_timer_active +* This pairs with the memory barrier in hfi1_start_led_override to +* ensure that we read the correct state of LED beaconing represented +* by led_override_timer_active */ -smp_mb (); +smp_rmb (); is_beaconing_active = !!atomic_read (&ppd->led_override_timer_active); pi->port_states.ledenable_offlinereason |= is_beaconing_active <<6 ; pi->port_states.ledenable_offlinereason |=
@@ -3598,11 +3598,11 @@ static int __subn_get_opa_led_info(struct opa_smp *smp, u32 am, u8 *data, }/* -* This pairs with the memory barrier implied by the atomic_dec in -* hfi1_set_led_override to ensure that we read the correct state of -* LED beaconing represented by led_override_timer_active +* This pairs with the memory barrier in hfi1_start_led_override to +* ensure that we read the correct state of LED beaconing represented +* by led_override_timer_active */ -smp_mb (); +smp_rmb (); is_beaconing_active = !!atomic_read (&ppd->led_override_timer_active); p->rsvd_led_mask =cpu_to_be32 (is_beaconing_active <<OPA_LED_SHIFT );
@@ -3627,9 +3627,9 @@ static int __subn_set_opa_led_info(struct opa_smp *smp, u32 am, u8 *data, }if (on) -hfi1_set_led_override (dd->pport,2000 ,1500 ); +hfi1_start_led_override (dd->pport,2000 ,1500 );else -hfi1_set_led_override (dd->pport,0 ,0 ); +shutdown_led_override (dd->pport);return __subn_get_opa_led_info (smp, am, data, ibdev, port, resp_len); }
--
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/10 IB/hfi1: Report pid in qp_stats to aid debug
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Tracking user/QP ownership is needed to debug issues with user ULPs like OpenMPI.
--- drivers/infiniband/hw/hfi1/qp.c | 5 +++-- drivers/infiniband/sw/rdmavt/qp.c | 1 + include/rdma/rdmavt_qp.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/qp.c +3 -2
@@ -678,7 +678,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 CQ %u %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 PID %d\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) send_context, 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); +ibcq_to_rvtcq (qp->ibqp.send_cq)->queue->tail, + qp->pid); }void qp_comm_est (struct rvt_qp *qp)
drivers/infiniband/sw/rdmavt/qp.c +1 -0
@@ -786,6 +786,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, goto bail_ip; } } + qp->pid = current->pid; }spin_lock (&rdi->n_qps_lock);
include/rdma/rdmavt_qp.h +1 -0
@@ -251,6 +251,7 @@ struct rvt_qp {enum ib_mtu path_mtu;int srate_mbps;/* s_srate (below) converted to Mbit/s */ +pid_t pid;/* pid for user mode QPs */ u32 remote_qpn;u32 qkey;/* QKEY for this QP (for UD or RD) */ u32 s_size;/* send work queue size */
--
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/10 IB/hfi1: Fix issues with qp_stats print
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The changes are to aid in coorelating trace information with QPs between the trace and qp_stats information
Such changes include adds a space after QP and clarifying that the second QP is actually the remote QP.
--- drivers/infiniband/hw/hfi1/qp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/qp.c +1 -1
@@ -678,7 +678,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 CQ %u %u PID %d\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) RQP %x LID %x SL %u MTU %u %u %u %u SDE %p,%u SC %p,%u SCQ %u %u PID %d\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
--
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/10 IB/hfi1: Add unique trace point for pio and sdma send
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
This allows for separately enabling pio and sdma tracepoints to cut the volume of trace information.
--- drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/trace.h | 10 +++++++++- drivers/infiniband/hw/hfi1/verbs.c | 8 ++++---- 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +1 -1
@@ -881,7 +881,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp, goto queue_ack; } -trace_output_ibhdr (dd_from_ibdev (qp->ibqp.device), &hdr); +trace_ack_output_ibhdr (dd_from_ibdev (qp->ibqp.device), &hdr);/* write the pbc and data */ ppd->dd->pio_inline_send (ppd->dd, pbuf, pbc, &hdr, hwords);
drivers/infiniband/hw/hfi1/trace.h +9 -1
@@ -530,7 +530,15 @@ DEFINE_EVENT(hfi1_ibhdr_template, input_ibhdr, TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), TP_ARGS(dd, hdr)); -DEFINE_EVENT (hfi1_ibhdr_template, output_ibhdr, +DEFINE_EVENT (hfi1_ibhdr_template, pio_output_ibhdr, + TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), +TP_ARGS (dd, hdr)); + +DEFINE_EVENT (hfi1_ibhdr_template, ack_output_ibhdr, + TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), +TP_ARGS (dd, hdr)); + +DEFINE_EVENT (hfi1_ibhdr_template, sdma_output_ibhdr, TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr),TP_ARGS (dd, hdr));
drivers/infiniband/hw/hfi1/verbs.c +4 -4
@@ -891,8 +891,8 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,if (unlikely (ret)) goto bail_build; } -trace_output_ibhdr (dd_from_ibdev (qp->ibqp.device), - &ps->s_txreq->phdr.hdr); +trace_sdma_output_ibhdr (dd_from_ibdev (qp->ibqp.device), + &ps->s_txreq->phdr.hdr); ret =sdma_send_txreq (tx->sde, &priv->s_iowait, &tx->txreq);if (unlikely (ret == -ECOMM )) goto bail_ecomm;
@@ -1067,8 +1067,8 @@ 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); +trace_pio_output_ibhdr (dd_from_ibdev (qp->ibqp.device), + &ps->s_txreq->phdr.hdr); pio_bail:if (qp->s_wqe) {
--
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/10 IB/hfi1: Fix ordering of trace for accuracy
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The postitioning of the sdma ibhdr trace was
causing an extra trace message when the tx send
returned -EBUSY.
Move the trace to just before the return
and handle negative return values to avoid
any trace.
--- drivers/infiniband/hw/hfi1/verbs.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +6 -3
@@ -891,11 +891,14 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,if (unlikely (ret)) goto bail_build; } + ret =sdma_send_txreq (tx->sde, &priv->s_iowait, &tx->txreq); +if (unlikely (ret <0 )) { +if (ret == -ECOMM ) + goto bail_ecomm; +return ret; + }trace_sdma_output_ibhdr (dd_from_ibdev (qp->ibqp.device), &ps->s_txreq->phdr.hdr); - ret =sdma_send_txreq (tx->sde, &priv->s_iowait, &tx->txreq); -if (unlikely (ret == -ECOMM )) - goto bail_ecomm;return ret; bail_ecomm:
--
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/10 IB/hfi1: Fix PIO wakeup timing hole
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
There is a timing hole if there had been greater than PIO_WAIT_BATCH_SIZE waiters. This code will dispatch the first
batch but leave the others in the queue. If the restarted waiters
don't in turn wait on a buffer, there is a hang.
Fix by forcing a return when the QP queue is non-empty.
--- drivers/infiniband/hw/hfi1/pio.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hfi1/pio.c +7 -5
@@ -1545,7 +1545,7 @@ static void sc_piobufavail(struct send_context *sc)struct iowait *wait;if (n ==ARRAY_SIZE (qps)) - goto full; +break ; wait = list_first_entry(list, struct iowait, list); qp =iowait_to_qp (wait); priv = qp->priv;
@@ -1554,12 +1554,14 @@ static void sc_piobufavail(struct send_context *sc) qps[n++] = qp; }/* -* Counting: only call wantpiobuf_intr() if there were waiters and they -* are now all gone. +* If there had been waiters and there are more +* insure that we redo the force to avoid a potential hang. */ -if (n) +if (n) {hfi1_sc_wantpiobuf_intr (sc,0 ); -full: +if (!list_empty (list)) +hfi1_sc_wantpiobuf_intr (sc,1 ); + }write_sequnlock_irqrestore (&dev->iowait_lock, flags);for (i =0 ; i < n; i++)
--
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/10 IB/hfi1: Fix panic in adaptive pio
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The following panic occurs while running ib_send_bw -a with adaptive pio turned on:
[ 8551.143596] BUG: unable to handle kernel NULL pointer dereference at (null) [ 8551.152986] IP: [<ffffffffa0902a94>] pio_wait.isra.21+0x34/0x190 [hfi1] [ 8551.160926] PGD 80db21067 PUD 80bb45067 PMD 0 [ 8551.166431] Oops: 0000 [#1] SMP [ 8551.276725] task: ffff880816bf15c0 ti: ffff880812ac0000 task.ti: ffff880812ac0000 [ 8551.285705] RIP: 0010:[<ffffffffa0902a94>] pio_wait.isra.21+0x34/0x190 [hfi1] [ 8551.296462] RSP: 0018:ffff880812ac3b58 EFLAGS: 00010282 [ 8551.303029] RAX: 000000000000002d RBX: 0000000000000000 RCX: 0000000000000800 [ 8551.311633] RDX: ffff880812ac3c08 RSI: 0000000000000000 RDI: ffff8800b6665e40 [ 8551.320228] RBP: ffff880812ac3ba0 R08: 0000000000001000 R09: ffffffffa09039a0 [ 8551.328820] R10: ffff880817a0c000 R11: 0000000000000000 R12: ffff8800b6665e40 [ 8551.337406] R13: ffff880817a0c000 R14: ffff8800b6665800 R15: ffff8800b6665e40 [ 8551.355640] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8551.362674] CR2: 0000000000000000 CR3: 000000080abe8000 CR4: 00000000001406e0 [ 8551.371262] Stack: [ 8551.374119] ffff880812ac3bf0 ffff88080cf54010 ffff880800000800 ffff880812ac3c08 [ 8551.383036] ffff8800b6665800 ffff8800b6665e40 0000000000000202 ffffffffa08e7b80 [ 8551.391941] 00000001007de431 ffff880812ac3bc8 ffffffffa0904645 ffff8800b6665800 [ 8551.400859] Call Trace: [ 8551.404214] [<ffffffffa08e7b80>] ? hfi1_del_timers_sync+0x30/0x30 [hfi1] [ 8551.412417] [<ffffffffa0904645>] hfi1_verbs_send+0x215/0x330 [hfi1] [ 8551.420154] [<ffffffffa08ec126>] hfi1_do_send+0x166/0x350 [hfi1] [ 8551.427618] [<ffffffffa055a533>] rvt_post_send+0x533/0x6a0 [rdmavt] [ 8551.435367] [<ffffffffa050760f>] ib_uverbs_post_send+0x30f/0x530 [ib_uverbs] [ 8551.443999] [<ffffffffa0501367>] ib_uverbs_write+0x117/0x380 [ib_uverbs] [ 8551.452269] [<ffffffff815810ab>] ? sock_recvmsg+0x3b/0x50 [ 8551.459071] [<ffffffff81581152>] ? sock_read_iter+0x92/0xe0 [ 8551.466068] [<ffffffff81212857>] __vfs_write+0x37/0x100 [ 8551.472692] [<ffffffff81213532>] ? rw_verify_area+0x52/0xd0 [ 8551.479682] [<ffffffff81213782>] vfs_write+0xa2/0x1a0 [ 8551.486089] [<ffffffff81003176>] ? do_audit_syscall_entry+0x66/0x70 [ 8551.493891] [<ffffffff812146c5>] SyS_write+0x55/0xc0 [ 8551.500220] [<ffffffff816ae0ee>] entry_SYSCALL_64_fastpath+0x12/0x71 [ 8551.531284] RIP [<ffffffffa0902a94>] pio_wait.isra.21+0x34/0x190 [hfi1] [ 8551.539508] RSP <ffff880812ac3b58> [ 8551.544110] CR2: 0000000000000000
The priv s_sendcontext pointer was not setup properly. Fix with this patch by using the s_sendcontext and eliminating its send engine use.
--- drivers/infiniband/hw/hfi1/qp.c | 2 ++ drivers/infiniband/hw/hfi1/verbs.c | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hfi1/qp.c +2 -0
@@ -220,6 +220,7 @@ void hfi1_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr,if (attr_mask &IB_QP_AV ) { priv->s_sc =ah_to_sc (ibqp->device, &qp->remote_ah_attr); priv->s_sde =qp_to_sdma_engine (qp, priv->s_sc); + priv->s_sendcontext =qp_to_send_context (qp, priv->s_sc); } if (attr_mask & IB_QP_PATH_MIG_STATE &&
@@ -228,6 +229,7 @@ void hfi1_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr, qp->s_flags |=RVT_S_AHG_CLEAR ; priv->s_sc =ah_to_sc (ibqp->device, &qp->remote_ah_attr); priv->s_sde =qp_to_sdma_engine (qp, priv->s_sc); + priv->s_sendcontext =qp_to_send_context (qp, priv->s_sc); } }
drivers/infiniband/hw/hfi1/verbs.c +1 -5
@@ -1005,12 +1005,8 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,/* vl15 special case taken care of in ud.c */ sc5 = priv->s_sc; - sc =qp_to_send_context (qp, sc5); + sc = ps->s_txreq->psc; -if (!sc) { - ret = -EINVAL ; - goto bail; - }if (likely (pbc ==0 )) {u8 vl =sc_to_vlt (dd_from_ibdev (qp->ibqp.device), sc5);/* set PBC_DC_INFO bit (aka SC[4]) in pbc_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 8/10 IB/hfi1: Fix adaptive pio packet corruption
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The adaptive pio heuristic missed a case that causes a corrupted packet on the wire.
The case is if SDMA egress had been chosen for a pio-able packet and
then encountered a ring space wait, the packet is queued. The sge
cursor had been incremented as part of the packet build out for SDMA.
After the send engine restart, the heuristic might now chose pio based on the sdma count being zero and start the mmio copy using the already incremented sge cursor.
Fix this by forcing SDMA egress when the SDMA descriptor has already been built.
Additionally, the code to wait for a QPs pio count to zero when switching to SDMA was missing. Add it.
There is also an issue with UD QPs, in that the different SLs can pick a different egress send context. For now, just insure the UD/GSI always go through SDMA.
--- drivers/infiniband/hw/hfi1/verbs.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +13 -6
@@ -1179,10 +1179,11 @@ bad:* and size */ static inline send_routine get_send_routine (struct rvt_qp *qp, -struct hfi1_ib_header *h) +struct verbs_txreq *tx) {struct hfi1_devdata *dd =dd_from_ibdev (qp->ibqp.device);struct hfi1_qp_priv *priv = qp->priv; +struct hfi1_ib_header *h = &tx->phdr.hdr;if (unlikely (!(dd->flags &HFI1_HAS_SEND_DMA )))return dd->process_pio_send;
@@ -1191,21 +1192,21 @@ static inline send_routine get_send_routine(struct rvt_qp *qp,return dd->process_pio_send;case IB_QPT_GSI :case IB_QPT_UD : -if (piothreshold && qp->s_cur_size <= piothreshold) -return dd->process_pio_send;break ;case IB_QPT_RC :if (piothreshold && qp->s_cur_size <=min (piothreshold, qp->pmtu) && (BIT (get_opcode (h) &0x1f ) & rc_only_opcode) && -iowait_sdma_pending (&priv->s_iowait) ==0 ) +iowait_sdma_pending (&priv->s_iowait) ==0 && + !sdma_txreq_built (&tx->txreq))return dd->process_pio_send;break ;case IB_QPT_UC :if (piothreshold && qp->s_cur_size <=min (piothreshold, qp->pmtu) && (BIT (get_opcode (h) &0x1f ) & uc_only_opcode) && -iowait_sdma_pending (&priv->s_iowait) ==0 ) +iowait_sdma_pending (&priv->s_iowait) ==0 && + !sdma_txreq_built (&tx->txreq))return dd->process_pio_send;break ;default :
@@ -1225,10 +1226,11 @@ static inline send_routine get_send_routine(struct rvt_qp *qp,int hfi1_verbs_send (struct rvt_qp *qp,struct hfi1_pkt_state *ps) {struct hfi1_devdata *dd =dd_from_ibdev (qp->ibqp.device); +struct hfi1_qp_priv *priv = qp->priv;send_routine sr;int ret; - sr =get_send_routine (qp, &ps->s_txreq->phdr.hdr); + sr =get_send_routine (qp, ps->s_txreq); ret =egress_pkey_check (dd->pport, &ps->s_txreq->phdr.hdr, qp);if (unlikely (ret)) {/*
@@ -1250,6 +1252,11 @@ int hfi1_verbs_send(struct rvt_qp *qp, struct hfi1_pkt_state *ps) }return -EINVAL ; } +if (sr == dd->process_dma_send &&iowait_pio_pending (&priv->s_iowait)) +return pio_wait (qp, + ps->s_txreq->psc, + ps, +RVT_S_WAIT_PIO_DRAIN );return sr (qp, ps,0 ); }
--
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/10 IB/hfi1: Enable adaptive pio by default
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
Set the piothreshold to the agreed upon default of 256B.
--- drivers/infiniband/hw/hfi1/verbs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +1 -1
@@ -121,7 +121,7 @@ unsigned int hfi1_max_srq_wrs = 0x1FFFF;module_param_named (max_srq_wrs, hfi1_max_srq_wrs, uint,S_IRUGO );MODULE_PARM_DESC (max_srq_wrs,"Maximum number of SRQ WRs support" ); -unsigned short piothreshold; +unsigned short piothreshold =256 ;module_param (piothreshold, ushort,S_IRUGO );MODULE_PARM_DESC (piothreshold,"size used to determine sdma vs. pio" );
--
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/10 IB/rdmavt: Post receive for QP in ERR state
In reply to a message not in the archiveFrom: Alex Estrin <[email protected]>
Accordingly IB Spec post WR to receive queue must
complete with error if QP is in Error state.
Please refer to C10-42, C10-97.2.1
--- drivers/infiniband/sw/rdmavt/qp.c | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-)
drivers/infiniband/sw/rdmavt/qp.c +24 -9
@@ -1364,6 +1364,8 @@ int rvt_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,struct rvt_qp *qp =ibqp_to_rvtqp (ibqp);struct rvt_rwq *wq = qp->r_rq.wq;unsigned long flags; +int qp_err_flush = (ib_rvt_state_ops[qp->state] &RVT_FLUSH_RECV ) && + !qp->ibqp.srq;/* Check that state is OK to post receive. */ if (!(ib_rvt_state_ops[qp->state] &RVT_POST_RECV_OK ) || !wq) {
@@ -1390,15 +1392,28 @@ int rvt_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, *bad_wr = wr;return -ENOMEM ; } - - wqe =rvt_get_rwqe_ptr (&qp->r_rq, wq->head); - wqe->wr_id = wr->wr_id; - wqe->num_sge = wr->num_sge; -for (i =0 ; i < wr->num_sge; i++) - wqe->sg_list[i] = wr->sg_list[i]; -/* Make sure queue entry is written before the head index. */ -smp_wmb (); - wq->head = next; +if (unlikely (qp_err_flush)) { +struct ib_wc wc; + +memset (&wc,0 ,sizeof (wc)); + wc.qp = &qp->ibqp; + wc.opcode =IB_WC_RECV ; + wc.wr_id = wr->wr_id; + wc.status =IB_WC_WR_FLUSH_ERR ; +rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc,1 ); + }else { + wqe =rvt_get_rwqe_ptr (&qp->r_rq, wq->head); + wqe->wr_id = wr->wr_id; + wqe->num_sge = wr->num_sge; +for (i =0 ; i < wr->num_sge; i++) + wqe->sg_list[i] = wr->sg_list[i]; +/* +* Make sure queue entry is written +* before the head index. +*/ +smp_wmb (); + wq->head = next; + }spin_unlock_irqrestore (&qp->r_rq.lock, flags); }return 0 ;
--
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