IB/hfi1,core: Driver updates for 1/26/2018
Subsystems (2)
cover IB/hfi1,core: Driver updates for 1/26/2018
Hi Jason and Doug,
For the most part this is the usual sort of fixes and clean ups with some things that help optmize performance thrown in. There are three patches that may be of a broader interest. There is a change to core header files for iWARP AH as well as a fix to ipoib for a scenario where we can wind up in no-carrier state.
The other patch by Mike R comes out of the discussion [1] from a previous submission.
As always my GitHub had these in-tree for context:
https://github.com/ddalessa/kernel/tree/for-4.16
[1] https://marc.info/?l=linux-rdma&m=151394843919393&w=2
---
Alex Estrin (3):
IB/hfi1: Fix for early release of sdma context IB/hfi1: hfi1_open_file() missing kobject_put in err path IB/ipoib: Fix for potential no-carrier state
Bartlomiej Dudek (1):
IB/hfi1: Do not override given pcie_pset value
Don Hiatt (1):
IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
Kamenee Arumugam (1):
IB/hfi1: Convert PortXmitWait/PortVLXmitWait counters to flit times
Michael J. Ruhl (1):
IB/hfi1: Re-order IRQ cleanup to address driver cleanup race
Mike Marciniszyn (1):
IB/hfi1: Remove blind constants from 16B update
Mitko Haralanov (2):
IB/hfi1: Remove dependence on qp->s_hdrwords IB/hfi1: Show fault stats in both TX and RX directions
Sebastian Sanchez (6):
IB/hfi1: Prevent LNI hang when LCB can't obtain lanes IB/hfi1: Compute BTH only for RDMA_WRITE_LAST/SEND_LAST packet IB/hfi1: Optimize packet type comparison using 9B and bypass code paths IB/hfi1: Look up ibport using a pointer in receive path IB/hfi1: Remove unnecessary fecn and becn fields
IB/hfi1: Optimize process_receive_ib()
drivers/infiniband/hw/hfi1/chip.c | 133 +++++++++++++++++++++------ drivers/infiniband/hw/hfi1/chip.h | 19 +++- drivers/infiniband/hw/hfi1/chip_registers.h | 7 + drivers/infiniband/hw/hfi1/debugfs.c | 9 ++ drivers/infiniband/hw/hfi1/driver.c | 49 +++++----- drivers/infiniband/hw/hfi1/file_ops.c | 1 drivers/infiniband/hw/hfi1/hfi.h | 26 +++-- drivers/infiniband/hw/hfi1/init.c | 14 +++ drivers/infiniband/hw/hfi1/iowait.h | 9 ++ drivers/infiniband/hw/hfi1/mad.c | 127 ++++++++++++++++++++++++-- drivers/infiniband/hw/hfi1/mad.h | 47 +++++++++- drivers/infiniband/hw/hfi1/pcie.c | 23 ++--- drivers/infiniband/hw/hfi1/qp.c | 4 - drivers/infiniband/hw/hfi1/qp.h | 13 +++ drivers/infiniband/hw/hfi1/rc.c | 51 +++++----- drivers/infiniband/hw/hfi1/ruc.c | 47 +++------- drivers/infiniband/hw/hfi1/sdma.c | 13 +-- drivers/infiniband/hw/hfi1/sdma.h | 1 drivers/infiniband/hw/hfi1/trace.c | 8 +- drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 16 ++- drivers/infiniband/hw/hfi1/trace_rx.h | 28 ++---- drivers/infiniband/hw/hfi1/uc.c | 9 -- drivers/infiniband/hw/hfi1/ud.c | 39 ++++---- drivers/infiniband/hw/hfi1/verbs.c | 10 +- drivers/infiniband/hw/hfi1/verbs.h | 24 ++--- drivers/infiniband/hw/hfi1/verbs_txreq.h | 7 + drivers/infiniband/hw/qib/qib_rc.c | 3 - drivers/infiniband/hw/qib/qib_uc.c | 3 - drivers/infiniband/hw/qib/qib_ud.c | 3 - drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 + include/rdma/ib_hdrs.h | 19 +++- include/rdma/ib_verbs.h | 15 ++- 32 files changed, 530 insertions(+), 250 deletions(-)
--
-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
A message that is not in the archive (sent off-list or not yet received): 20180126142640.6868.12402.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
PATCH 1/16 IB/hfi1: Do not override given pcie_pset value
From: Bartlomiej Dudek <[email protected]>
During PCIe Gen 3 transistion, pcie_pset is read and might be overridden to a default value(i.e. 255) in do_pcie_gen3_transition() routine.
If the pcie_pset value is overridden then this new value will be used during initialization of next adapter on a different card.
Introducing a new local variable to avoid modification of pcie_pset
--- drivers/infiniband/hw/hfi1/pcie.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/infiniband/hw/hfi1/pcie.c +12 -11
@@ -1034,6 +1034,7 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd)int do_retry, retry_count =0 ;int intnum =0 ;uint default_pset; +uint pset = pcie_pset;u16 target_vector, target_speed;u16 lnkctl2, vendor;u8 div;
@@ -1201,16 +1202,16 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd)* * Set Gen3EqPsetReqVec, leave other fields 0. */ -if (pcie_pset ==UNSET_PSET ) - pcie_pset = default_pset; -if (pcie_pset >10 ) {/* valid range is 0-10, inclusive */ +if (pset ==UNSET_PSET ) + pset = default_pset; +if (pset >10 ) {/* valid range is 0-10, inclusive */ dd_dev_err (dd,"%s: Invalid Eq Pset %u, setting to %d\n" , - __func__, pcie_pset, default_pset); - pcie_pset = default_pset; + __func__, pset, default_pset); + pset = default_pset; } -dd_dev_info (dd,"%s: using EQ Pset %u\n" , __func__, pcie_pset); +dd_dev_info (dd,"%s: using EQ Pset %u\n" , __func__, pset);pci_write_config_dword (dd->pcidev,PCIE_CFG_REG_PL106 , - ((1 << pcie_pset) << + ((1 << pset) <<PCIE_CFG_REG_PL106_GEN3_EQ_PSET_REQ_VEC_SHIFT ) |PCIE_CFG_REG_PL106_GEN3_EQ_EVAL2MS_DISABLE_SMASK |PCIE_CFG_REG_PL106_GEN3_EQ_PHASE23_EXIT_MODE_SMASK );
@@ -1240,10 +1241,10 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd)/* apply static CTLE tunings */ u8 pcie_dc, pcie_lf, pcie_hf, pcie_bw; - pcie_dc = ctle_tunings[pcie_pset][0 ]; - pcie_lf = ctle_tunings[pcie_pset][1 ]; - pcie_hf = ctle_tunings[pcie_pset][2 ]; - pcie_bw = ctle_tunings[pcie_pset][3 ]; + pcie_dc = ctle_tunings[pset][0 ]; + pcie_lf = ctle_tunings[pset][1 ]; + pcie_hf = ctle_tunings[pset][2 ]; + pcie_bw = ctle_tunings[pset][3 ];write_gasket_interrupt (dd, intnum++,0x0026 ,0x0200 | pcie_dc);write_gasket_interrupt (dd, intnum++,0x0026 ,0x0100 | pcie_lf);write_gasket_interrupt (dd, intnum++,0x0026 ,0x0000 | pcie_hf);
--
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/hfi1: Fix for early release of sdma context
In reply to a message not in the archiveFrom: Alex Estrin <[email protected]>
With IRQF_SHARED flag set and CONFIG_DEBUG_SHIRQ enabled module removal may result in panic in sdma_interrupt() routine if associated sdma context was released before pci_free_irq();
[ 9198.939885] BUG: unable to handle kernel NULL pointer dereference at (null) [ 9198.940514] IP: sdma_make_progress+0xa5/0x450 [hfi1] [ 9198.941114] PGD 170bdc0067 P4D 170bdc0067 PUD 172063e067 PMD 0 [ 9198.941783] Oops: 0000 [#1] SMP ..... [ 9198.958877] CPU: 132 PID: 64173 Comm: rmmod Tainted: G OE 4.14.0-rc4+ #1 [ 9198.961032] Hardware name: Intel Corporation S7200AP/S7200AP, BIOS S72C610.86B.01.02.0118.080620171935 08/06/2017 [ 9198.963323] task: ffff9681397f0000 task.stack: ffffae1647c40000 [ 9198.965695] RIP: 0010:sdma_make_progress+0xa5/0x450 [hfi1] [ 9198.968082] RSP: 0018:ffffae1647c43be8 EFLAGS: 00010046 [ 9198.970503] RAX: 0000000000000000 RBX: ffff9680ce8b5ca8 RCX: 0000000000000000 [ 9198.973006] RDX: 0000000000000000 RSI: 0000000001a00d28 RDI: ffff9680ce8b5ca0 [ 9198.975546] RBP: ffffae1647c43c40 R08: ffff96814325ec00 R09: 00000000ffffffff [ 9198.978142] R10: 000000004325e501 R11: ffff96814325ec00 R12: ffff9680ce8b5c44 [ 9198.980779] R13: ffff9680ce8b5ca0 R14: 0000000000000000 R15: ffff9680ce8b5b00 [ 9198.983462] FS: 00007f31196ba740(0000) GS:ffff96819df00000(0000) knlGS:0000000000000000 [ 9198.986231] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9198.989036] CR2: 0000000000000000 CR3: 000000170833f000 CR4: 00000000001406e0 [ 9198.991911] Call Trace: [ 9198.994847] sdma_engine_interrupt+0x82/0x100 [hfi1] [ 9198.997852] sdma_interrupt+0x61/0xc0 [hfi1] [ 9199.000852] __free_irq+0x1b3/0x2d0 [ 9199.003873] free_irq+0x35/0x70 [ 9199.006909] pci_free_irq+0x1c/0x30 [ 9199.009999] clean_up_interrupts+0x53/0xf0 [hfi1] [ 9199.013137] hfi1_start_cleanup+0x117/0x190 [hfi1] [ 9199.016315] postinit_cleanup+0x1d/0x270 [hfi1] [ 9199.019529] remove_one+0x1f3/0x210 [hfi1] [ 9199.022738] pci_device_remove+0x39/0xc0 [ 9199.025974] device_release_driver_internal+0x141/0x210 [ 9199.029268] driver_detach+0x3f/0x80 [ 9199.032580] bus_remove_driver+0x55/0xd0 [ 9199.035931] driver_unregister+0x2c/0x50 [ 9199.039321] pci_unregister_driver+0x2a/0xa0 [ 9199.042755] hfi1_mod_cleanup+0x10/0xb50 [hfi1] [ 9199.046196] SyS_delete_module+0x171/0x250
...
Fix by exporting sdma_clean() and removing from sdma_exit(). sdma_exit() now just manipulates the engine state, leaving the memory free to sdma_clean() which is now called just before the dd is freed.
--- drivers/infiniband/hw/hfi1/init.c | 1 + drivers/infiniband/hw/hfi1/sdma.c | 13 +++++++------ drivers/infiniband/hw/hfi1/sdma.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/init.c +1 -0
@@ -1218,6 +1218,7 @@ static void __hfi1_free_devdata(struct kobject *kobj)free_percpu (dd->rcv_limit);free_percpu (dd->send_schedule);free_percpu (dd->tx_opstats); +sdma_clean (dd, dd->num_sdma);rvt_dealloc_device (&dd->verbs_dev.rdi); }
drivers/infiniband/hw/hfi1/sdma.c +7 -6
@@ -1276,13 +1276,15 @@ int sdma_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_engines)return -ENOMEM ; } -/* -* Clean up allocated memory. -* -* This routine is can be called regardless of the success of sdma_init() +/** +* sdma_clean() Clean up allocated memory +* @dd: struct hfi1_devdata +* @num_engines: num sdma engines * +* This routine can be called regardless of the success of +* sdma_init() */ -static void sdma_clean (struct hfi1_devdata *dd,size_t num_engines) +void sdma_clean (struct hfi1_devdata *dd,size_t num_engines) {size_t i;struct sdma_engine *sde;
@@ -1618,7 +1620,6 @@ void sdma_exit(struct hfi1_devdata *dd)*/ sdma_finalput (&sde->state); } -sdma_clean (dd, dd->num_sdma); }/*
drivers/infiniband/hw/hfi1/sdma.h +1 -0
@@ -420,6 +420,7 @@ struct sdma_engine {int sdma_init (struct hfi1_devdata *dd,u8 port);void sdma_start (struct hfi1_devdata *dd);void sdma_exit (struct hfi1_devdata *dd); +void sdma_clean (struct hfi1_devdata *dd,size_t num_engines);void sdma_all_running (struct hfi1_devdata *dd);void sdma_all_idle (struct hfi1_devdata *dd);void sdma_freeze_notify (struct hfi1_devdata *dd,int go_idle);
--
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 IB/hfi1: Remove dependence on qp->s_hdrwords
In reply to a message not in the archiveFrom: Mitko Haralanov <[email protected]>
The s_hdrwords variable was used to indicate whether a packet was already built on a previous iteration of the send engine. This variable assumed the protection of the QP's RVT_S_BUSY flag, which was required since the the QP's s_lock was dropped just prior to the packet being queued on the one of the egress mechanisms.
Support for multiple send engine instantiations require that the field not be used due to concurency issues. The ps.txreq signals the "already built" without the potential concurency issues.
Fix by getting rid of all s_hdrword usage. A wrapper
is added to test for the already built case that used to use s_hdrwords.
What used to be stored in s_hdrwords is now in the txreq. The PBC is not counted, but is added in the pio/sdma code paths prior to posting the packet.
--- drivers/infiniband/hw/hfi1/iowait.h | 9 +++++++++ drivers/infiniband/hw/hfi1/qp.c | 4 +--- drivers/infiniband/hw/hfi1/qp.h | 13 +++++++++++++ drivers/infiniband/hw/hfi1/rc.c | 10 ++-------- drivers/infiniband/hw/hfi1/ruc.c | 23 +++++++++++------------ drivers/infiniband/hw/hfi1/uc.c | 6 +----- drivers/infiniband/hw/hfi1/ud.c | 27 ++++++++++++--------------- drivers/infiniband/hw/hfi1/verbs.c | 10 +++++----- drivers/infiniband/hw/hfi1/verbs.h | 11 ----------- drivers/infiniband/hw/hfi1/verbs_txreq.h | 7 +++++++ 10 files changed, 61 insertions(+), 59 deletions(-)
drivers/infiniband/hw/hfi1/iowait.h +9 -0
@@ -371,4 +371,13 @@ static inline void iowait_starve_find_max(struct iowait *w, u8 *max, } } +/** +* iowait_packet_queued() - determine if a packet is already built +* @wait: the wait structure +*/ +static inline bool iowait_packet_queued (struct iowait *wait) +{ +return !list_empty (&wait->tx_head); +} +#endif
drivers/infiniband/hw/hfi1/qp.c +1 -3
@@ -565,7 +565,7 @@ void qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter)if (qp->s_ack_queue) e = &qp->s_ack_queue[qp->s_tail_ack_queue]; seq_printf(s, - "N %d %s QP %x R %u %s %u %u %u f=%x %u %u %u %u %u %u SPSN %x %x %x %x %x RPSN %x S(%u %u %u %u %u %u %u) R(%u %u %u) RQP %x LID %x SL %u MTU %u %u %u %u %u SDE %p,%u SC %p,%u SCQ %u %u PID %d OS %x %x E %x %x %x RNR %d %s %d\n", + "N %d %s QP %x R %u %s %u %u f=%x %u %u %u %u %u %u SPSN %x %x %x %x %x RPSN %x S(%u %u %u %u %u %u %u) R(%u %u %u) RQP %x LID %x SL %u MTU %u %u %u %u %u SDE %p,%u SC %p,%u SCQ %u %u PID %d OS %x %x E %x %x %x RNR %d %s %d\n", iter->n, qp_idle(qp) ? "I" : "B", qp->ibqp.qp_num,
@@ -573,7 +573,6 @@ void qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter) qp_type_str[qp->ibqp.qp_type], qp->state, wqe ? wqe->wr.opcode :0 , - qp->s_hdrwords, qp->s_flags,iowait_sdma_pending (&priv->s_iowait), iowait_pio_pending(&priv->s_iowait),
@@ -795,7 +794,6 @@ void notify_error_qp(struct rvt_qp *qp) }if (!(qp->s_flags &RVT_S_BUSY )) { - qp->s_hdrwords =0 ;if (qp->s_rdma_mr) {rvt_put_mr (qp->s_rdma_mr); qp->s_rdma_mr =NULL ;
drivers/infiniband/hw/hfi1/qp.h +13 -0
@@ -51,12 +51,25 @@#include <rdma/rdmavt_qp.h> #include "verbs.h" #include "sdma.h" +#include "verbs_txreq.h" extern unsigned int hfi1_qp_table_size;extern const struct rvt_operation_params hfi1_post_parms[];/* +* Send if not busy or waiting for I/O and either +* a RC response is pending or we can process send work requests. +*/ +static inline int hfi1_send_ok (struct rvt_qp *qp) +{ +return !(qp->s_flags & (RVT_S_BUSY |RVT_S_ANY_WAIT_IO )) && + (verbs_txreq_queued (qp) || + (qp->s_flags &RVT_S_RESP_PENDING ) || + !(qp->s_flags &RVT_S_ANY_WAIT_SEND )); +} + +/* * free_ahg - clear ahg from QP */ static inline void clear_ahg (struct rvt_qp *qp)
drivers/infiniband/hw/hfi1/rc.c +2 -8
@@ -226,12 +226,10 @@ static int make_rc_ack(struct hfi1_ibdev *dev, struct rvt_qp *qp, bth2 =mask_psn (qp->s_ack_psn); } qp->s_rdma_ack_cnt++; - qp->s_hdrwords = hwords; ps->s_txreq->sde = priv->s_sde; ps->s_txreq->s_cur_size = len; + ps->s_txreq->hdr_dwords = hwords;hfi1_make_ruc_header (qp, ohdr, bth0, bth2, middle, ps); -/* pbc */ - ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ;return 1 ; bail:
@@ -387,7 +385,6 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) : IB_WC_SUCCESS);if (local_ops)atomic_dec (&qp->local_ops_pending); - qp->s_hdrwords =0 ; goto done_free_tx; }
@@ -690,7 +687,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) bth2 |=IB_BTH_REQ_ACK ; } qp->s_len -= len; - qp->s_hdrwords = hwords; + ps->s_txreq->hdr_dwords = hwords; ps->s_txreq->sde = priv->s_sde; ps->s_txreq->ss = ss; ps->s_txreq->s_cur_size = len;
@@ -701,8 +698,6 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) bth2, middle, ps); -/* pbc */ - ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ;return 1 ; done_free_tx:
@@ -716,7 +711,6 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) bail_no_tx: ps->s_txreq =NULL ; qp->s_flags &= ~RVT_S_BUSY ; - qp->s_hdrwords =0 ;return 0 ; }
drivers/infiniband/hw/hfi1/ruc.c +11 -12
@@ -757,8 +757,9 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,u32 slid;u16 pkey =hfi1_get_pkey (ibp, qp->s_pkey_index);u8 l4 =OPA_16B_L4_IB_LOCAL ; -u8 extra_bytes =hfi1_get_16b_padding ((qp->s_hdrwords <<2 ), - ps->s_txreq->s_cur_size); +u8 extra_bytes =hfi1_get_16b_padding ( + (ps->s_txreq->hdr_dwords <<2 ), + ps->s_txreq->s_cur_size);u32 nwords =SIZE_OF_CRC + ((ps->s_txreq->s_cur_size + extra_bytes +SIZE_OF_LT ) >>2 );u8 becn =0 ;
@@ -778,9 +779,9 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, grd->sgid_index =0 ; grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; l4 =OPA_16B_L4_IB_GLOBAL ; - hdrwords = qp->s_hdrwords -4 ; - qp->s_hdrwords +=hfi1_make_grh (ibp, grh, grd, - hdrwords, nwords); + hdrwords = ps->s_txreq->hdr_dwords -4 ; + ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh, grd, + hdrwords, nwords); middle =0 ; }
@@ -814,7 +815,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, slid,opa_get_lid (rdma_ah_get_dlid (&qp->remote_ah_attr),16B ), - (qp->s_hdrwords + nwords) >>1 , + (ps->s_txreq->hdr_dwords + nwords) >>1 , pkey, becn, 0, l4, priv->s_sc); }
@@ -834,10 +835,10 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,if (unlikely (rdma_ah_get_ah_flags (&qp->remote_ah_attr) &IB_AH_GRH )) {struct ib_grh *grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; -int hdrwords = qp->s_hdrwords -2 ; +int hdrwords = ps->s_txreq->hdr_dwords -2 ; lrh0 =HFI1_LRH_GRH ; - qp->s_hdrwords += + ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh,rdma_ah_read_grh (&qp->remote_ah_attr), hdrwords, nwords);
@@ -866,7 +867,7 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,hfi1_make_ruc_bth (qp, ohdr, bth0, bth1, bth2);hfi1_make_ib_hdr (&ps->s_txreq->phdr.hdr.ibh, lrh0, - qp->s_hdrwords + nwords, + ps->s_txreq->hdr_dwords + nwords,opa_get_lid (rdma_ah_get_dlid (&qp->remote_ah_attr),9B ),ppd_from_ibp (ibp)->lid |rdma_ah_get_path_bits (&qp->remote_ah_attr));
@@ -1031,7 +1032,7 @@ void hfi1_do_send(struct rvt_qp *qp, bool in_thread) ps.s_txreq =get_waiting_verbs_txreq (qp); do { /* Check for a constructed packet to be sent. */ - if (qp->s_hdrwords != 0) { + if (ps.s_txreq) { spin_unlock_irqrestore(&qp->s_lock, ps.flags); /* * If the packet cannot be sent now, return and
@@ -1039,8 +1040,6 @@ void hfi1_do_send(struct rvt_qp *qp, bool in_thread)*/ if (hfi1_verbs_send (qp, &ps))return ; -/* Record that s_ahg is empty. */ - qp->s_hdrwords =0 ;/* allow other tasks to run */ if (schedule_send_yield (qp, &ps))return ;
drivers/infiniband/hw/hfi1/uc.c +1 -5
@@ -146,7 +146,6 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) : IB_WC_SUCCESS);if (local_ops)atomic_dec (&qp->local_ops_pending); - qp->s_hdrwords =0 ; goto done_free_tx; }/*
@@ -269,14 +268,12 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)break ; } qp->s_len -= len; - qp->s_hdrwords = hwords; + ps->s_txreq->hdr_dwords = hwords; ps->s_txreq->sde = priv->s_sde; ps->s_txreq->ss = &qp->s_sge; ps->s_txreq->s_cur_size = len;hfi1_make_ruc_header (qp, ohdr, bth0 | (qp->s_state <<24 ),mask_psn (qp->s_psn++), middle, ps); -/* pbc */ - ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ;return 1 ; done_free_tx:
@@ -290,7 +287,6 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) bail_no_tx: ps->s_txreq =NULL ; qp->s_flags &= ~RVT_S_BUSY ; - qp->s_hdrwords =0 ;return 0 ; }
drivers/infiniband/hw/hfi1/ud.c +12 -15
@@ -340,15 +340,15 @@ void hfi1_make_ud_req_9B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, extra_bytes = -wqe->length &3 ; nwords = ((wqe->length + extra_bytes) >>2 ) +SIZE_OF_CRC ;/* header size in dwords LRH+BTH+DETH = (8+12+8)/4. */ - qp->s_hdrwords =7 ; + ps->s_txreq->hdr_dwords =7 ;if (wqe->wr.opcode ==IB_WR_SEND_WITH_IMM ) - qp->s_hdrwords++; + ps->s_txreq->hdr_dwords++;if (rdma_ah_get_ah_flags (ah_attr) &IB_AH_GRH ) { grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; - qp->s_hdrwords +=hfi1_make_grh (ibp, grh, -rdma_ah_read_grh (ah_attr), - qp->s_hdrwords -2 , nwords); + ps->s_txreq->hdr_dwords += +hfi1_make_grh (ibp, grh,rdma_ah_read_grh (ah_attr), + ps->s_txreq->hdr_dwords -2 , nwords); lrh0 =HFI1_LRH_GRH ; ohdr = &ps->s_txreq->phdr.hdr.ibh.u.l.oth; }else {
@@ -381,7 +381,7 @@ void hfi1_make_ud_req_9B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, } }hfi1_make_bth_deth (qp, wqe, ohdr, &pkey, extra_bytes, false); - len = qp->s_hdrwords + nwords; + len = ps->s_txreq->hdr_dwords + nwords;/* Setup the packet */ ps->s_txreq->phdr.hdr.hdr_type =HFI1_PKT_TYPE_9B ;
@@ -405,12 +405,12 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, ppd =ppd_from_ibp (ibp); ah_attr = &ibah_to_rvtah (wqe->ud_wr.ah)->attr;/* header size in dwords 16B LRH+BTH+DETH = (16+12+8)/4. */ - qp->s_hdrwords =9 ; + ps->s_txreq->hdr_dwords =9 ;if (wqe->wr.opcode ==IB_WR_SEND_WITH_IMM ) - qp->s_hdrwords++; + ps->s_txreq->hdr_dwords++;/* SW provides space for CRC and LT for bypass packets. */ - extra_bytes =hfi1_get_16b_padding ((qp->s_hdrwords <<2 ), + extra_bytes =hfi1_get_16b_padding ((ps->s_txreq->hdr_dwords <<2 ), wqe->length); nwords = ((wqe->length + extra_bytes +SIZE_OF_LT ) >>2 ) +SIZE_OF_CRC ;
@@ -428,8 +428,8 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, grd->sgid_index =0 ; } grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; - qp->s_hdrwords +=hfi1_make_grh (ibp, grh, grd, - qp->s_hdrwords -4 , nwords); + ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh, grd, + ps->s_txreq->hdr_dwords -4 , nwords); ohdr = &ps->s_txreq->phdr.hdr.opah.u.l.oth; l4 =OPA_16B_L4_IB_GLOBAL ; }else {
@@ -452,7 +452,7 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps,hfi1_make_bth_deth (qp, wqe, ohdr, &pkey, extra_bytes, true);/* Convert dwords to flits */ - len = (qp->s_hdrwords + nwords) >>1 ; + len = (ps->s_txreq->hdr_dwords + nwords) >>1 ;/* Setup the packet */ ps->s_txreq->phdr.hdr.hdr_type =HFI1_PKT_TYPE_16B ;
@@ -564,8 +564,6 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) priv->s_ahg->ahgcount =0 ; priv->s_ahg->ahgidx =0 ; priv->s_ahg->tx_flags =0 ; -/* pbc */ - ps->s_txreq->hdr_dwords = qp->s_hdrwords +2 ;return 1 ;
@@ -580,7 +578,6 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) bail_no_tx: ps->s_txreq =NULL ; qp->s_flags &= ~RVT_S_BUSY ; - qp->s_hdrwords =0 ;return 0 ; }
drivers/infiniband/hw/hfi1/verbs.c +5 -5
@@ -835,7 +835,7 @@ static int build_verbs_tx_desc( {int ret =0 ;struct hfi1_sdma_header *phdr = &tx->phdr; -u16 hdrbytes = tx->hdr_dwords <<2 ; +u16 hdrbytes = (tx->hdr_dwords +sizeof (pbc) /4 ) <<2 ;u8 extra_bytes =0 ;if (tx->phdr.hdr.hdr_type) {
@@ -901,7 +901,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps, {struct hfi1_qp_priv *priv = qp->priv;struct hfi1_ahg_info *ahg_info = priv->s_ahg; -u32 hdrwords = qp->s_hdrwords; +u32 hdrwords = ps->s_txreq->hdr_dwords;u32 len = ps->s_txreq->s_cur_size;u32 plen;struct hfi1_ibdev *dev = ps->dev;
@@ -919,7 +919,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps, }else { dwords = (len +3 ) >>2 ; } - plen = hdrwords + dwords +2 ; + plen = hdrwords + dwords +sizeof (pbc) /4 ; tx = ps->s_txreq;if (!sdma_txreq_built (&tx->txreq)) {
@@ -1038,7 +1038,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, u64 pbc) {struct hfi1_qp_priv *priv = qp->priv; -u32 hdrwords = qp->s_hdrwords; +u32 hdrwords = ps->s_txreq->hdr_dwords;struct rvt_sge_state *ss = ps->s_txreq->ss;u32 len = ps->s_txreq->s_cur_size;u32 dwords;
@@ -1064,7 +1064,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, dwords = (len +3 ) >>2 ; hdr = (u32 *)&ps->s_txreq->phdr.hdr.ibh; } - plen = hdrwords + dwords +2 ; + plen = hdrwords + dwords +sizeof (pbc) /4 ;/* only RC/UC use complete */ switch (qp->ibqp.qp_type) {
drivers/infiniband/hw/hfi1/verbs.h +0 -11
@@ -246,17 +246,6 @@ struct hfi1_ibdev { }/* -* Send if not busy or waiting for I/O and either -* a RC response is pending or we can process send work requests. -*/ -static inline int hfi1_send_ok (struct rvt_qp *qp) -{ -return !(qp->s_flags & (RVT_S_BUSY |RVT_S_ANY_WAIT_IO )) && - (qp->s_hdrwords || (qp->s_flags &RVT_S_RESP_PENDING ) || - !(qp->s_flags &RVT_S_ANY_WAIT_SEND )); -} - -/* * This must be called with s_lock held. */ void hfi1_bad_pkey(struct hfi1_ibport *ibp, u32 key, u32 sl,
drivers/infiniband/hw/hfi1/verbs_txreq.h +7 -0
@@ -113,6 +113,13 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,return NULL ; } +static inline bool verbs_txreq_queued (struct rvt_qp *qp) +{ +struct hfi1_qp_priv *priv = qp->priv; + +return iowait_packet_queued (&priv->s_iowait); +} +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 4/16 IB/hfi1: Remove blind constants from 16B update
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
These values were introduced as part of the 16B code to account for the varying size of the LRH between the differing packet formats.
Replace the blind constants with defines based on FIELD_SIZEOF() calls.
--- drivers/infiniband/hw/hfi1/driver.c | 6 ++++-- drivers/infiniband/hw/hfi1/ruc.c | 13 ++++++------- drivers/infiniband/hw/hfi1/ud.c | 15 ++++++++++----- drivers/infiniband/hw/hfi1/verbs.h | 5 +++++ 4 files changed, 25 insertions(+), 14 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +4 -2
@@ -1492,8 +1492,10 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet)/* Query commonly used fields from packet header */ packet->opcode =ib_bth_get_opcode (packet->ohdr); - packet->hlen = hdr_len_by_opcode[packet->opcode] +8 + grh_len; - packet->payload = packet->ebuf + packet->hlen - (4 *sizeof (u32)); +/* hdr_len_by_opcode already has an IB LRH factored in */ + packet->hlen = hdr_len_by_opcode[packet->opcode] + + (LRH_16B_BYTES -LRH_9B_BYTES ) + grh_len; + packet->payload = packet->ebuf + packet->hlen -LRH_16B_BYTES ; packet->slid =hfi1_16B_get_slid (packet->hdr); packet->dlid =hfi1_16B_get_dlid (packet->hdr);if (unlikely (hfi1_is_16B_mcast (packet->dlid)))
drivers/infiniband/hw/hfi1/ruc.c +6 -7
@@ -769,8 +769,6 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,struct ib_grh *grh;struct ib_global_route *grd =rdma_ah_retrieve_grh (&qp->remote_ah_attr); -int hdrwords; -/* * Ensure OPA GIDs are transformed to IB gids * before creating the GRH.
@@ -779,9 +777,10 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, grd->sgid_index =0 ; grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; l4 =OPA_16B_L4_IB_GLOBAL ; - hdrwords = ps->s_txreq->hdr_dwords -4 ; - ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh, grd, - hdrwords, nwords); + ps->s_txreq->hdr_dwords += +hfi1_make_grh (ibp, grh, grd, + ps->s_txreq->hdr_dwords -LRH_16B_DWORDS , + nwords); middle =0 ; }
@@ -835,13 +834,13 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,if (unlikely (rdma_ah_get_ah_flags (&qp->remote_ah_attr) &IB_AH_GRH )) {struct ib_grh *grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; -int hdrwords = ps->s_txreq->hdr_dwords -2 ; lrh0 =HFI1_LRH_GRH ; ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh,rdma_ah_read_grh (&qp->remote_ah_attr), - hdrwords, nwords); + ps->s_txreq->hdr_dwords -LRH_9B_DWORDS , + nwords); middle =0 ; } lrh0 |= (priv->s_sc & 0xf) << 12 |
drivers/infiniband/hw/hfi1/ud.c +10 -5
@@ -348,7 +348,8 @@ void hfi1_make_ud_req_9B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh,rdma_ah_read_grh (ah_attr), - ps->s_txreq->hdr_dwords -2 , nwords); + ps->s_txreq->hdr_dwords -LRH_9B_DWORDS , + nwords); lrh0 =HFI1_LRH_GRH ; ohdr = &ps->s_txreq->phdr.hdr.ibh.u.l.oth; }else {
@@ -428,8 +429,10 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, grd->sgid_index =0 ; } grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; - ps->s_txreq->hdr_dwords +=hfi1_make_grh (ibp, grh, grd, - ps->s_txreq->hdr_dwords -4 , nwords); + ps->s_txreq->hdr_dwords +=hfi1_make_grh ( + ibp, grh, grd, + ps->s_txreq->hdr_dwords -LRH_16B_DWORDS , + nwords); ohdr = &ps->s_txreq->phdr.hdr.opah.u.l.oth; l4 =OPA_16B_L4_IB_GLOBAL ; }else {
@@ -648,7 +651,8 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,struct ib_grh *grh = &hdr.u.l.grh; grh->version_tclass_flow = old_grh->version_tclass_flow; - grh->paylen =cpu_to_be16 ((hwords -4 + nwords) <<2 ); + grh->paylen =cpu_to_be16 ( + (hwords -LRH_16B_DWORDS + nwords) <<2 ); grh->hop_limit =0xff ; grh->sgid = old_grh->dgid; grh->dgid = old_grh->sgid;
@@ -702,7 +706,8 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,struct ib_grh *grh = &hdr.u.l.grh; grh->version_tclass_flow = old_grh->version_tclass_flow; - grh->paylen =cpu_to_be16 ((hwords -2 +SIZE_OF_CRC ) <<2 ); + grh->paylen =cpu_to_be16 ( + (hwords -LRH_9B_DWORDS +SIZE_OF_CRC ) <<2 ); grh->hop_limit =0xff ; grh->sgid = old_grh->dgid; grh->dgid = old_grh->sgid;
drivers/infiniband/hw/hfi1/verbs.h +5 -0
@@ -105,6 +105,11 @@ enum { HFI1_HAS_GRH = (1 << 0), }; +#define LRH_16B_BYTES (FIELD_SIZEOF(struct hfi1_16b_header, lrh)) +#define LRH_16B_DWORDS (LRH_16B_BYTES / sizeof(u32)) +#define LRH_9B_BYTES (FIELD_SIZEOF(struct ib_header, lrh)) +#define LRH_9B_DWORDS (LRH_9B_BYTES / sizeof(u32)) +struct hfi1_16b_header {u32 lrh[4 ];union {
--
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 IB/hfi1: Convert PortXmitWait/PortVLXmitWait counters to flit times
In reply to a message not in the archiveFrom: Kamenee Arumugam <[email protected]>
HFI's counters SendWaitCnt and SendWaitVlCnt are in units of TXE cycle time (at 805MHz). OPA counters PortXmitWait and PortVLXmtWait are in units of flit times.
Convert the counter values to flit units using following conversion formula:
PortXmitWait =
SendWaitCnt * 2 * (4 /link_width) * (25 Gbps /link_speed) PortVLXmitWait = SendWaitVLCnt * 2 * (4 /link_width) * (25 Gbps /link_speed)
At link up or downgrade events, the link width can change. To ensure accurate counter calculations, sample the counters after the events, during counter requests, and then aggregate the OPA counters.
--- drivers/infiniband/hw/hfi1/chip.c | 64 +++++++++++++++++-- drivers/infiniband/hw/hfi1/chip.h | 4 + drivers/infiniband/hw/hfi1/hfi.h | 7 ++ drivers/infiniband/hw/hfi1/init.c | 9 +++ drivers/infiniband/hw/hfi1/mad.c | 127 ++++++++++++++++++++++++++++++++++--- drivers/infiniband/hw/hfi1/mad.h | 47 +++++++++++++- 6 files changed, 239 insertions(+), 19 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +58 -6
@@ -1083,6 +1083,7 @@ static int qos_rmt_entries(struct hfi1_devdata *dd, unsigned int *mp,static void clear_full_mgmt_pkey (struct hfi1_pportdata *ppd);static int wait_link_transfer_active (struct hfi1_devdata *dd,int wait_ms);static void clear_rsm_rule (struct hfi1_devdata *dd,u8 rule_index); +static void update_xmit_counters (struct hfi1_pportdata *ppd,u16 link_width);/* * Error interrupt table entry. This is used as input to the interrupt
@@ -6905,6 +6906,32 @@ void handle_freeze(struct work_struct *work)/* no longer frozen */ } +/** +* update_xmit_counters - update PortXmitWait/PortVlXmitWait +* counters. +* @ppd: info of physical Hfi port +* @link_width: new link width after link up or downgrade +* +* Update the PortXmitWait and PortVlXmitWait counters after +* a link up or downgrade event to reflect a link width change. +*/ +static void update_xmit_counters (struct hfi1_pportdata *ppd,u16 link_width) +{ +int i; +u16 tx_width; +u16 link_speed; + + tx_width =tx_link_width (link_width); + link_speed =get_link_speed (ppd->link_speed_active); + +/* +* There are C_VL_COUNT number of PortVLXmitWait counters. +* Adding 1 to C_VL_COUNT to include the PortXmitWait counter. +*/ +for (i =0 ; i <C_VL_COUNT +1 ; i++) +get_xmit_wait_counters (ppd, tx_width, link_speed, i); +} +/* * Handle a link up interrupt from the 8051. *
@@ -7526,18 +7553,29 @@ void handle_verify_cap(struct work_struct *work)set_link_state (ppd,HLS_GOING_UP ); } -/* -* Apply the link width downgrade enabled policy against the current active -* link widths. +/** +* apply_link_downgrade_policy - Apply the link width downgrade enabled +* policy against the current active link widths. +* @ppd: info of physical Hfi port +* @refresh_widths: True indicates link downgrade event +* @return: True indicates a successful link downgrade. False indicates +* link downgrade event failed and the link will bounce back to +* default link width. * -* Called when the enabled policy changes or the active link widths change. +* Called when the enabled policy changes or the active link widths +* change. +* Refresh_widths indicates that a link downgrade occurred. The +* link_downgraded variable is set by refresh_widths and +* determines the success/failure of the policy application. */ -void apply_link_downgrade_policy (struct hfi1_pportdata *ppd,int refresh_widths) +bool apply_link_downgrade_policy (struct hfi1_pportdata *ppd, +bool refresh_widths) {int do_bounce =0 ;int tries;u16 lwde;u16 tx, rx; +bool link_downgraded = refresh_widths;/* use the hls lock to avoid a race with actual link up */ tries =0 ;
@@ -7571,6 +7609,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths) ppd->link_width_downgrade_rx_active == 0) {/* the 8051 reported a dead link as a downgrade */ dd_dev_err (ppd->dd,"Link downgrade is really a link down, ignoring\n" ); + link_downgraded = false; } else if (lwde == 0) {/* downgrade is disabled */
@@ -7587,6 +7626,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths) ppd->link_width_downgrade_tx_active, ppd->link_width_downgrade_rx_active); do_bounce =1 ; + link_downgraded = false; } }else if ((lwde & ppd->link_width_downgrade_tx_active) ==0 || (lwde & ppd->link_width_downgrade_rx_active) ==0 ) {
@@ -7598,6 +7638,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths) lwde, ppd->link_width_downgrade_tx_active, ppd->link_width_downgrade_rx_active); do_bounce =1 ; + link_downgraded = false; } done:
@@ -7609,6 +7650,8 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)set_link_state (ppd,HLS_DN_OFFLINE );start_link (ppd); } + +return link_downgraded; }/*
@@ -7622,7 +7665,8 @@ void handle_link_downgrade(struct work_struct *work) link_downgrade_work);dd_dev_info (ppd->dd,"8051: Link width downgrade\n" ); -apply_link_downgrade_policy (ppd,1 ); +if (apply_link_downgrade_policy (ppd, true)) +update_xmit_counters (ppd, ppd->link_width_downgrade_tx_active); }static char *dcc_err_string (char *buf,int buf_len,u64 flags)
@@ -10597,6 +10641,14 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)add_rcvctrl (dd,RCV_CTRL_RCV_PORT_ENABLE_SMASK );handle_linkup_change (dd,1 ); + +/* +* After link up, a new link width will have been set. +* Update the xmit counters with regards to the new +* link width. +*/ +update_xmit_counters (ppd, ppd->link_width_active); + ppd->host_link_state =HLS_UP_INIT ;update_statusp (ppd,IB_PORT_INIT );break ;
drivers/infiniband/hw/hfi1/chip.h +2 -2
@@ -736,8 +736,8 @@ void set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason,int start_link (struct hfi1_pportdata *ppd);int bringup_serdes (struct hfi1_pportdata *ppd);void set_intr_state (struct hfi1_devdata *dd,u32 enable); -void apply_link_downgrade_policy (struct hfi1_pportdata *ppd, -int refresh_widths); +bool apply_link_downgrade_policy (struct hfi1_pportdata *ppd, +bool refresh_widths);void update_usrhead (struct hfi1_ctxtdata *rcd,u32 hd,u32 updegr,u32 egrhd,u32 intr_adjust,u32 npkts);int stop_drain_data_vls (struct hfi1_devdata *dd);
drivers/infiniband/hw/hfi1/hfi.h +7 -0
@@ -858,6 +858,13 @@ struct hfi1_pportdata {struct work_struct linkstate_active_work;/* Does this port need to prescan for FECNs */ bool cc_prescan; +/* +* Sample sendWaitCnt & sendWaitVlCnt during link transition +* and counter request. +*/ +u64 port_vl_xmit_wait_last[C_VL_COUNT +1 ]; +u16 prev_link_width; +u64 vl_xmit_flit_cnt[C_VL_COUNT +1 ]; };typedef int (*rhf_rcv_function_ptr )(struct hfi1_packet *packet);
drivers/infiniband/hw/hfi1/init.c +9 -0
@@ -637,6 +637,15 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, ppd->dd = dd; ppd->hw_pidx = hw_pidx; ppd->port = port;/* IB port number, not index */ + ppd->prev_link_width =LINK_WIDTH_DEFAULT ; +/* +* There are C_VL_COUNT number of PortVLXmitWait counters. +* Adding 1 to C_VL_COUNT to include the PortXmitWait counter. +*/ +for (i =0 ; i <C_VL_COUNT +1 ; i++) { + ppd->port_vl_xmit_wait_last[i] =0 ; + ppd->vl_xmit_flit_cnt[i] =0 ; + } default_pkey_idx =1 ;
drivers/infiniband/hw/hfi1/mad.c +117 -10
187 lines not on this page · raw message
drivers/infiniband/hw/hfi1/mad.h +46 -1
57 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 6/16 IB/hfi1: hfi1_open_file() missing kobject_put in err path
In reply to a message not in the archiveFrom: Alex Estrin <[email protected]>
The dd refcount is speculatively incremented prior to allocating the fd memory with kzalloc(). If that kzalloc() failed the dd refcount leaks.
--- drivers/infiniband/hw/hfi1/file_ops.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/infiniband/hw/hfi1/file_ops.c +1 -0
@@ -210,6 +210,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp) fd->dd = dd; fp->private_data = fd; }else { +kobject_put (&dd->kobj); fp->private_data =NULL ;if (atomic_dec_and_test (&dd->user_refcount))
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180126143203.6868.85360.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
Re: [PATCH for-next 06/16] IB/hfi1: hfi1_open_file() missing kobject_put in err path
Quoted 17 lines · Dennis Dalessandro
From: Alex Estrin <[email protected]>
The dd refcount is speculatively incremented prior to allocating the fd memory with
kzalloc(). If thatkzalloc()failed the dd refcount leaks.Fixes e11ffbd57520 ("IB/hfi1: Do not free hfi1 cdev parent structure early")Reviewed-by Michael J Ruhl <[email protected]>Signed-off-by Alex Estrin <[email protected]>Signed-off-by Dennis Dalessandro <[email protected]>drivers/infiniband/hw/hfi1/file_ops.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)drivers/infiniband/hw/hfi1/file_ops.c +1
-0+++ b/drivers/infiniband/hw/hfi1/file_ops.c
drivers/infiniband/hw/hfi1/file_ops.c static int hfi1_file_open(struct inode *inode, struct file *fp) · line 216
Quoted 7 lines
drivers/infiniband/hw/hfi1/file_ops.c +1
-0@@ -210,6 +210,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp) fd->dd = dd; fp->private_data = fd; }else { +kobject_put (&dd->kobj); fp->private_data =NULL ;if (atomic_dec_and_test (&dd->user_refcount))
Ugh that reads horribly.
Put the kobject_get when you copy the pointer:
fd->dd = dd;
kobject_get(&fd->dd->kobj);Then it actually makes sense what is happening.
Jsaon
--
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 IB/hfi1: Show fault stats in both TX and RX directions
In reply to a message not in the archiveFrom: Mitko Haralanov <[email protected]>
The routine which shows the fault stats checks the counters to determine whether to show any stats based on the number of transmitted pkts/bytes for a particular opcode.
Unfortunately, it only checked the receive counters. As a result, if any packet faults have happened for packets egressing the HFI, those stats would not be shown.
In order to fix this, the routine is amended to also check the TX counters. With this change the pkt/byte counts are the sum of both TX and RX counts for the opcode.
--- drivers/infiniband/hw/hfi1/debugfs.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/debugfs.c +8 -1
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015-2017 Intel Corporation. +* Copyright(c) 2015-2018 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -1201,6 +1201,13 @@ static int _fault_stats_seq_show(struct seq_file *s, void *v) }hfi1_rcd_put (rcd); } +for_each_possible_cpu (j) { +struct hfi1_opcode_stats_perctx *sp = +per_cpu_ptr (dd->tx_opstats, j); + + n_packets += sp->stats[i].n_packets; + n_bytes += sp->stats[i].n_bytes; + }if (!n_packets && !n_bytes)return SEQ_SKIP ; if (!ibd->fault_opcode->n_rxfaults[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 8/16 IB/hfi1: Prevent LNI hang when LCB can't obtain lanes
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
When the LCB isn't able to get any lanes operational on the first transition into mission mode, the link transfer active never happens and the LNI stays in the polling state indefinitely.
Reset LCB upon receiving an 8051 interrupt for LCB to try to obtain lanes with firmware version 1.25.0 or later. Also, update the LCB reset value in other parts of the code with a macro defined to make the code more maintainable and rename functions with the link_width label to link_mode to reflect the fact that those functions set and read link related data not just the link width.
--- drivers/infiniband/hw/hfi1/chip.c | 51 +++++++++++++++++++-------- drivers/infiniband/hw/hfi1/chip.h | 15 +++++++- drivers/infiniband/hw/hfi1/chip_registers.h | 7 +++- 3 files changed, 53 insertions(+), 20 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +35 -16
@@ -1032,8 +1032,8 @@ static void read_vc_remote_fabric(struct hfi1_devdata *dd, u8 *vau, u8 *z, u8 *vcu, u16 *vl15buf, u8 *crc_sizes);static void read_vc_remote_link_width (struct hfi1_devdata *dd,u8 *remote_tx_rate,u16 *link_widths); -static void read_vc_local_link_width (struct hfi1_devdata *dd,u8 *misc_bits, -u8 *flag_bits,u16 *link_widths); +static void read_vc_local_link_mode (struct hfi1_devdata *dd,u8 *misc_bits, +u8 *flag_bits,u16 *link_widths);static void read_remote_device_id (struct hfi1_devdata *dd,u16 *device_id,u8 *device_rev);static void read_local_lni (struct hfi1_devdata *dd,u8 *enable_lane_rx);
@@ -6351,6 +6351,18 @@ static void handle_8051_request(struct hfi1_pportdata *ppd) type);hreq_response (dd,HREQ_NOT_SUPPORTED ,0 );break ; +case HREQ_LCB_RESET : +/* Put the LCB, RX FPE and TX FPE into reset */ +write_csr (dd,DCC_CFG_RESET ,LCB_RX_FPE_TX_FPE_INTO_RESET ); +/* Make sure the write completed */ + (void )read_csr (dd,DCC_CFG_RESET ); +/* Hold the reset long enough to take effect */ +udelay (1 ); +/* Take the LCB, RX FPE and TX FPE out of reset */ +write_csr (dd,DCC_CFG_RESET ,LCB_RX_FPE_TX_FPE_OUT_OF_RESET ); +hreq_response (dd,HREQ_SUCCESS ,0 ); + +break ;case HREQ_CONFIG_DONE :hreq_response (dd,HREQ_SUCCESS ,0 );break ;
@@ -6461,8 +6473,7 @@ static void lcb_shutdown(struct hfi1_devdata *dd, int abort) dd->lcb_err_en =read_csr (dd,DC_LCB_ERR_EN ); reg =read_csr (dd,DCC_CFG_RESET );write_csr (dd,DCC_CFG_RESET , reg | - (1ull <<DCC_CFG_RESET_RESET_LCB_SHIFT ) | - (1ull <<DCC_CFG_RESET_RESET_RX_FPE_SHIFT )); +DCC_CFG_RESET_RESET_LCB |DCC_CFG_RESET_RESET_RX_FPE ); (void )read_csr (dd,DCC_CFG_RESET );/* make sure the write completed */ if (!abort) {udelay (1 );/* must hold for the longer of 16cclks or 20ns */
@@ -6527,7 +6538,7 @@ static void _dc_start(struct hfi1_devdata *dd) __func__);/* Take away reset for LCB and RX FPE (set in lcb_shutdown). */ -write_csr (dd,DCC_CFG_RESET ,0x10 ); +write_csr (dd,DCC_CFG_RESET ,LCB_RX_FPE_TX_FPE_OUT_OF_RESET );/* lcb_shutdown() with abort=1 does not restore these */ write_csr (dd,DC_LCB_ERR_EN , dd->lcb_err_en); dd->dc_shutdown =0 ;
@@ -7348,7 +7359,7 @@ static void get_linkup_widths(struct hfi1_devdata *dd, u16 *tx_width,u8 misc_bits, local_flags;u16 active_tx, active_rx; -read_vc_local_link_width (dd, &misc_bits, &local_flags, &widths); +read_vc_local_link_mode (dd, &misc_bits, &local_flags, &widths); tx = widths >>12 ; rx = (widths >>8 ) &0xf ;
@@ -8820,29 +8831,29 @@ static int write_vc_local_fabric(struct hfi1_devdata *dd, u8 vau, u8 z, u8 vcu, GENERAL_CONFIG, frame); } -static void read_vc_local_link_width (struct hfi1_devdata *dd,u8 *misc_bits, -u8 *flag_bits,u16 *link_widths) +static void read_vc_local_link_mode (struct hfi1_devdata *dd,u8 *misc_bits, +u8 *flag_bits,u16 *link_widths) {u32 frame; -read_8051_config (dd,VERIFY_CAP_LOCAL_LINK_WIDTH ,GENERAL_CONFIG , +read_8051_config (dd,VERIFY_CAP_LOCAL_LINK_MODE ,GENERAL_CONFIG , &frame); *misc_bits = (frame >>MISC_CONFIG_BITS_SHIFT ) &MISC_CONFIG_BITS_MASK ; *flag_bits = (frame >>LOCAL_FLAG_BITS_SHIFT ) &LOCAL_FLAG_BITS_MASK ; *link_widths = (frame >>LINK_WIDTH_SHIFT ) &LINK_WIDTH_MASK ; } -static int write_vc_local_link_width (struct hfi1_devdata *dd, -u8 misc_bits, -u8 flag_bits, -u16 link_widths) +static int write_vc_local_link_mode (struct hfi1_devdata *dd, +u8 misc_bits, +u8 flag_bits, +u16 link_widths) {u32 frame; frame = (u32 )misc_bits <<MISC_CONFIG_BITS_SHIFT | (u32 )flag_bits <<LOCAL_FLAG_BITS_SHIFT | (u32 )link_widths <<LINK_WIDTH_SHIFT ; -return load_8051_config (dd,VERIFY_CAP_LOCAL_LINK_WIDTH ,GENERAL_CONFIG , +return load_8051_config (dd,VERIFY_CAP_LOCAL_LINK_MODE ,GENERAL_CONFIG , frame); }
@@ -9312,8 +9323,16 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)if (loopback ==LOOPBACK_SERDES ) misc_bits |=1 <<LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT ; - ret =write_vc_local_link_width (dd, misc_bits,0 , -opa_to_vc_link_widths ( +/* +* An external device configuration request is used to reset the LCB +* to retry to obtain operational lanes when the first attempt is +* unsuccesful. +*/ +if (dd->dc8051_ver >=dc8051_ver (1 ,25 ,0 )) + misc_bits |=1 <<EXT_CFG_LCB_RESET_SUPPORTED_SHIFT ; + + ret =write_vc_local_link_mode (dd, misc_bits,0 , +opa_to_vc_link_widths ( ppd->link_width_enabled));if (ret !=HCMD_SUCCESS ) goto set_local_link_attributes_fail;
drivers/infiniband/hw/hfi1/chip.h +13 -2
@@ -196,6 +196,15 @@#define LSTATE_ARMED 0x3#define LSTATE_ACTIVE 0x4 +/* DCC_CFG_RESET reset states */ +#define LCB_RX_FPE_TX_FPE_INTO_RESET (DCC_CFG_RESET_RESET_LCB | \ + DCC_CFG_RESET_RESET_TX_FPE | \ + DCC_CFG_RESET_RESET_RX_FPE | \ + DCC_CFG_RESET_ENABLE_CCLK_BCC) +/* 0x17 */ + +#define LCB_RX_FPE_TX_FPE_OUT_OF_RESET DCC_CFG_RESET_ENABLE_CCLK_BCC/* 0x10 */ +/* DC8051_STS_CUR_STATE port values (physical link states) */ #define PLS_DISABLED 0x30#define PLS_OFFLINE 0x90
@@ -283,6 +292,7 @@#define HREQ_SET_TX_EQ_ABS 0x04#define HREQ_SET_TX_EQ_REL 0x05#define HREQ_ENABLE 0x06 +#define HREQ_LCB_RESET 0x07#define HREQ_CONFIG_DONE 0xfe#define HREQ_INTERFACE_TEST 0xff
@@ -383,7 +393,7 @@#define TX_SETTINGS 0x06#define VERIFY_CAP_LOCAL_PHY 0x07#define VERIFY_CAP_LOCAL_FABRIC 0x08 -#define VERIFY_CAP_LOCAL_LINK_WIDTH 0x09 +#define VERIFY_CAP_LOCAL_LINK_MODE 0x09#define LOCAL_DEVICE_ID 0x0a#define RESERVED_REGISTERS 0x0b#define LOCAL_LNI_INFO 0x0c
@@ -584,8 +594,9 @@ enum {#define LOOPBACK_LCB 2#define LOOPBACK_CABLE 3/* external cable */ -/* set up serdes bit in MISC_CONFIG_BITS */ +/* set up bits in MISC_CONFIG_BITS */ #define LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT 0 +#define EXT_CFG_LCB_RESET_SUPPORTED_SHIFT 3/* read and write hardware registers */ u64 read_csr (const struct hfi1_devdata *dd,u32 offset);
drivers/infiniband/hw/hfi1/chip_registers.h +5 -2
@@ -97,8 +97,11 @@#define DCC_CFG_PORT_CONFIG_MTU_CAP_SHIFT 32#define DCC_CFG_PORT_CONFIG_MTU_CAP_SMASK 0x700000000ull#define DCC_CFG_RESET (DCC_CSRS + 0x000000000000) -#define DCC_CFG_RESET_RESET_LCB_SHIFT 0 -#define DCC_CFG_RESET_RESET_RX_FPE_SHIFT 2 +#define DCC_CFG_RESET_RESET_LCB BIT_ULL(0) +#define DCC_CFG_RESET_RESET_TX_FPE BIT_ULL(1) +#define DCC_CFG_RESET_RESET_RX_FPE BIT_ULL(2) +#define DCC_CFG_RESET_RESET_8051 BIT_ULL(3) +#define DCC_CFG_RESET_ENABLE_CCLK_BCC BIT_ULL(4)#define DCC_CFG_SC_VL_TABLE_15_0 (DCC_CSRS + 0x000000000028)#define DCC_CFG_SC_VL_TABLE_15_0_ENTRY0_SHIFT 0#define DCC_CFG_SC_VL_TABLE_15_0_ENTRY10_SHIFT 40
--
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 IB/hfi1: Compute BTH only for RDMA_WRITE_LAST/SEND_LAST packet
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
In hfi1_rc_rcv(), BTH is computed for all packets received. However, it's only used for packets received with opcodes RDMA_WRITE_LAST and SEND_LAST, and it is a costly operation.
Compute BTH only in the RDMA_WRITE_LAST/SEND_LAST code path and let the compiler handle endianness conversion for bitwise operations.
--- drivers/infiniband/hw/hfi1/rc.c | 3 +-- drivers/infiniband/hw/hfi1/uc.c | 3 +-- drivers/infiniband/hw/hfi1/ud.c | 3 +-- drivers/infiniband/hw/qib/qib_rc.c | 3 +-- drivers/infiniband/hw/qib/qib_uc.c | 3 +-- drivers/infiniband/hw/qib/qib_ud.c | 3 +-- include/rdma/ib_hdrs.h | 4 ++++ 7 files changed, 10 insertions(+), 12 deletions(-)
drivers/infiniband/hw/hfi1/rc.c +1 -2
@@ -2035,7 +2035,6 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)struct rvt_qp *qp = packet->qp;struct hfi1_ibport *ibp =rcd_to_iport (rcd);struct ib_other_headers *ohdr = packet->ohdr; -u32 bth0 =be32_to_cpu (ohdr->bth[0 ]);u32 opcode = packet->opcode;u32 hdrsize = packet->hlen;u32 psn =ib_bth_get_psn (packet->ohdr);
@@ -2233,7 +2232,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) wc.port_num =0 ;/* Signal completion event if the solicited bit is set. */ rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, - (bth0 &IB_BTH_SOLICITED ) !=0 ); +ib_bth_is_solicited (ohdr));break ;case OP (RDMA_WRITE_ONLY ):
drivers/infiniband/hw/hfi1/uc.c +1 -2
@@ -478,8 +478,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) wc.port_num =0 ;/* Signal completion event if the solicited bit is set. */ rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +ib_bth_is_solicited (ohdr));break ;case OP (RDMA_WRITE_FIRST ):
drivers/infiniband/hw/hfi1/ud.c +1 -2
@@ -1050,8 +1050,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) wc.port_num = qp->port_num;/* Signal completion event if the solicited bit is set. */ rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +ib_bth_is_solicited (ohdr));return ; drop:
drivers/infiniband/hw/qib/qib_rc.c +1 -2
@@ -1916,8 +1916,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr, wc.port_num =0 ;/* Signal completion event if the solicited bit is set. */ rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +ib_bth_is_solicited (ohdr));break ;case OP (RDMA_WRITE_FIRST ):
drivers/infiniband/hw/qib/qib_uc.c +1 -2
@@ -403,8 +403,7 @@ void qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr, wc.port_num =0 ;/* Signal completion event if the solicited bit is set. */ rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +ib_bth_is_solicited (ohdr));break ;case OP (RDMA_WRITE_FIRST ):
drivers/infiniband/hw/qib/qib_ud.c +1 -2
@@ -581,8 +581,7 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, wc.port_num = qp->port_num;/* Signal completion event if the solicited bit is set. */ rvt_cq_enter (ibcq_to_rvtcq (qp->ibqp.recv_cq), &wc, - (ohdr->bth[0 ] & -cpu_to_be32 (IB_BTH_SOLICITED )) !=0 ); +ib_bth_is_solicited (ohdr));return ; drop:
include/rdma/ib_hdrs.h +4 -0
@@ -331,4 +331,8 @@ static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr) IB_BTH_TVER_MASK); } +static inline bool ib_bth_is_solicited (struct ib_other_headers *ohdr) +{ +return !!(ohdr->bth[0 ] &cpu_to_be32 (IB_BTH_SOLICITED )); +}#endif /* IB_HDRS_H */
--
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 IB/hfi1: Optimize packet type comparison using 9B and bypass code paths
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
The packet type comparison used to find out if a packet is a bypass packet in the hot path is an expensive operation as seen in a profile.
Determine packet's pkey and migration bit through the bypass and 9B code paths instead.
--- drivers/infiniband/hw/hfi1/driver.c | 4 ++++ drivers/infiniband/hw/hfi1/hfi.h | 2 ++ drivers/infiniband/hw/hfi1/ruc.c | 15 ++------------- drivers/infiniband/hw/hfi1/verbs.h | 5 +++++ include/rdma/ib_hdrs.h | 5 +++++ 5 files changed, 18 insertions(+), 13 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +4 -0
@@ -1440,6 +1440,8 @@ static int hfi1_setup_9B_packet(struct hfi1_packet *packet) packet->extra_byte =0 ; packet->fecn =ib_bth_get_fecn (packet->ohdr); packet->becn =ib_bth_get_becn (packet->ohdr); + packet->pkey =ib_bth_get_pkey (packet->ohdr); + packet->migrated =ib_bth_is_migration (packet->ohdr);return 0 ; drop:
@@ -1508,6 +1510,8 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet) packet->extra_byte =SIZE_OF_LT ; packet->fecn =hfi1_16B_get_fecn (packet->hdr); packet->becn =hfi1_16B_get_becn (packet->hdr); + packet->pkey =hfi1_16B_get_pkey (packet->hdr); + packet->migrated =opa_bth_is_migration (packet->ohdr);if (hfi1_bypass_ingress_pkt_check (packet)) goto drop;
drivers/infiniband/hw/hfi1/hfi.h +2 -0
@@ -341,6 +341,7 @@ struct hfi1_packet {u32 slid;u16 tlen;s16 etail; +u16 pkey;u8 hlen;u8 numpkt;u8 rsize;
@@ -353,6 +354,7 @@ struct hfi1_packet {u8 opcode;bool becn;bool fecn; +bool migrated; };/* Packet types */
drivers/infiniband/hw/hfi1/ruc.c +2 -13
@@ -225,19 +225,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_packet *packet)u32 dlid = packet->dlid;u32 slid = packet->slid;u32 sl = packet->sl; -int migrated; -u32 bth0, bth1; -u16 pkey; - - bth0 =be32_to_cpu (packet->ohdr->bth[0 ]); - bth1 =be32_to_cpu (packet->ohdr->bth[1 ]); -if (packet->etype ==RHF_RCV_TYPE_BYPASS ) { - pkey =hfi1_16B_get_pkey (packet->hdr); - migrated = bth1 &OPA_BTH_MIG_REQ ; - }else { - pkey =ib_bth_get_pkey (packet->ohdr); - migrated = bth0 &IB_BTH_MIG_REQ ; - } +bool migrated = packet->migrated; +u16 pkey = packet->pkey;if (qp->s_mig_state ==IB_MIG_ARMED && migrated) {if (!packet->grh) {
drivers/infiniband/hw/hfi1/verbs.h +5 -0
@@ -410,6 +410,11 @@ static inline void cacheless_memcpy(void *dst, void *src, size_t n)__copy_user_nocache (dst, (void __user *)src, n,0 ); } +static inline bool opa_bth_is_migration (struct ib_other_headers *ohdr) +{ +return !!(ohdr->bth[1 ] &cpu_to_be32 (OPA_BTH_MIG_REQ )); +} +extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];extern const u8 hdr_len_by_opcode[];
include/rdma/ib_hdrs.h +5 -0
@@ -335,4 +335,9 @@ static inline bool ib_bth_is_solicited(struct ib_other_headers *ohdr) {return !!(ohdr->bth[0 ] &cpu_to_be32 (IB_BTH_SOLICITED )); } + +static inline bool ib_bth_is_migration (struct ib_other_headers *ohdr) +{ +return !!(ohdr->bth[0 ] &cpu_to_be32 (IB_BTH_MIG_REQ )); +}#endif /* IB_HDRS_H */
--
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/hfi1: Look up ibport using a pointer in receive path
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
In the receive path, hfi1_ibport is looked up by indexing into an array. A profile shows this to be expensive. The receive context data has a pointer to the ibport data, use that pointer instead.
--- drivers/infiniband/hw/hfi1/driver.c | 14 ++++++++------ drivers/infiniband/hw/hfi1/rc.c | 36 ++++++++++++++++++++--------------- drivers/infiniband/hw/hfi1/verbs.h | 3 +-- 3 files changed, 30 insertions(+), 23 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +8 -6
@@ -634,9 +634,10 @@ static void __prescan_rxq(struct hfi1_packet *packet) } } -static void process_rcv_qp_work (struct hfi1_ctxtdata *rcd) +static void process_rcv_qp_work (struct hfi1_packet *packet) {struct rvt_qp *qp, *nqp; +struct hfi1_ctxtdata *rcd = packet->rcd;/* * Iterate over all QPs waiting to respond.
@@ -646,7 +647,8 @@ static void process_rcv_qp_work(struct hfi1_ctxtdata *rcd)list_del_init (&qp->rspwait);if (qp->r_flags &RVT_R_RSP_NAK ) { qp->r_flags &= ~RVT_R_RSP_NAK ; -hfi1_send_rc_ack (rcd, qp,0 ); + packet->qp = qp; +hfi1_send_rc_ack (packet,0 ); }if (qp->r_flags &RVT_R_RSP_SEND ) {unsigned long flags;
@@ -667,7 +669,7 @@ static noinline int max_packet_exceeded(struct hfi1_packet *packet, int thread)if (thread) {if ((packet->numpkt & (MAX_PKT_RECV_THREAD -1 )) ==0 )/* allow defered processing */ -process_rcv_qp_work (packet->rcd); +process_rcv_qp_work (packet);cond_resched ();return RCV_PKT_OK ; }else {
@@ -809,7 +811,7 @@ int handle_receive_interrupt_nodma_rtail(struct hfi1_ctxtdata *rcd, int thread) last =RCV_PKT_DONE ;process_rcv_update (last, &packet); } -process_rcv_qp_work (rcd); +process_rcv_qp_work (&packet); rcd->head = packet.rhqoff; bail:finish_packet (&packet);
@@ -838,7 +840,7 @@ int handle_receive_interrupt_dma_rtail(struct hfi1_ctxtdata *rcd, int thread) last =RCV_PKT_DONE ;process_rcv_update (last, &packet); } -process_rcv_qp_work (rcd); +process_rcv_qp_work (&packet); rcd->head = packet.rhqoff; bail:finish_packet (&packet);
@@ -1068,7 +1070,7 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread)process_rcv_update (last, &packet); } -process_rcv_qp_work (rcd); +process_rcv_qp_work (&packet); rcd->head = packet.rhqoff; bail:
drivers/infiniband/hw/hfi1/rc.c +21 -15
@@ -730,14 +730,16 @@ static inline void hfi1_make_bth_aeth(struct rvt_qp *qp, ohdr->bth[2 ] =cpu_to_be32 (mask_psn (qp->r_ack_psn)); } -static inline void hfi1_queue_rc_ack (struct rvt_qp *qp,bool is_fecn) +static inline void hfi1_queue_rc_ack (struct hfi1_packet *packet,bool is_fecn) { -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); +struct rvt_qp *qp = packet->qp; +struct hfi1_ibport *ibp;unsigned long flags;spin_lock_irqsave (&qp->s_lock, flags);if (!(ib_rvt_state_ops[qp->state] &RVT_PROCESS_RECV_OK )) goto unlock; + ibp =rcd_to_iport (packet->rcd);this_cpu_inc (*ibp->rvp.rc_qacks); qp->s_flags |=RVT_S_ACK_PENDING |RVT_S_RESP_PENDING ; qp->s_nak_state = qp->r_nak_state;
@@ -751,13 +753,14 @@ static inline void hfi1_queue_rc_ack(struct rvt_qp *qp, bool is_fecn)spin_unlock_irqrestore (&qp->s_lock, flags); } -static inline void hfi1_make_rc_ack_9B (struct rvt_qp *qp, +static inline void hfi1_make_rc_ack_9B (struct hfi1_packet *packet,struct hfi1_opa_header *opa_hdr,u8 sc5,bool is_fecn,u64 *pbc_flags,u32 *hwords,u32 *nwords) { -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); +struct rvt_qp *qp = packet->qp; +struct hfi1_ibport *ibp =rcd_to_iport (packet->rcd);struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);struct ib_header *hdr = &opa_hdr->ibh;struct ib_other_headers *ohdr;
@@ -798,13 +801,14 @@ static inline void hfi1_make_rc_ack_9B(struct rvt_qp *qp,hfi1_make_bth_aeth (qp, ohdr, bth0, bth1); } -static inline void hfi1_make_rc_ack_16B (struct rvt_qp *qp, +static inline void hfi1_make_rc_ack_16B (struct hfi1_packet *packet,struct hfi1_opa_header *opa_hdr,u8 sc5,bool is_fecn,u64 *pbc_flags,u32 *hwords,u32 *nwords) { -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); +struct rvt_qp *qp = packet->qp; +struct hfi1_ibport *ibp =rcd_to_iport (packet->rcd);struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);struct hfi1_16b_header *hdr = &opa_hdr->opah;struct ib_other_headers *ohdr;
@@ -850,7 +854,7 @@ static inline void hfi1_make_rc_ack_16B(struct rvt_qp *qp,hfi1_make_bth_aeth (qp, ohdr, bth0, bth1); } -typedef void (*hfi1_make_rc_ack)(struct rvt_qp *qp, +typedef void (*hfi1_make_rc_ack)(struct hfi1_packet *packet, struct hfi1_opa_header *opa_hdr, u8 sc5, bool is_fecn, u64 *pbc_flags, u32 *hwords,
@@ -870,9 +874,10 @@ typedef void (*hfi1_make_rc_ack)(struct rvt_qp *qp,* Note that RDMA reads and atomics are handled in the * send side QP state and send engine. */ -void hfi1_send_rc_ack (struct hfi1_ctxtdata *rcd, -struct rvt_qp *qp,bool is_fecn) +void hfi1_send_rc_ack (struct hfi1_packet *packet,bool is_fecn) { +struct hfi1_ctxtdata *rcd = packet->rcd; +struct rvt_qp *qp = packet->qp;struct hfi1_ibport *ibp =rcd_to_iport (rcd);struct hfi1_qp_priv *priv = qp->priv;struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);
@@ -889,14 +894,14 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd,/* Don't send ACK or NAK if a RDMA read or atomic is pending. */ if (qp->s_flags &RVT_S_RESP_PENDING ) { -hfi1_queue_rc_ack (qp, is_fecn); +hfi1_queue_rc_ack (packet, is_fecn);return ; }/* Ensure s_rdma_ack_cnt changes are committed */ smp_read_barrier_depends ();if (qp->s_rdma_ack_cnt) { -hfi1_queue_rc_ack (qp, is_fecn); +hfi1_queue_rc_ack (packet, is_fecn);return ; }
@@ -905,7 +910,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd,return ;/* Make the appropriate header */ - hfi1_make_rc_ack_tbl[priv->hdr_type](qp, &opa_hdr, sc5, is_fecn, + hfi1_make_rc_ack_tbl[priv->hdr_type](packet, &opa_hdr, sc5, is_fecn, &pbc_flags, &hwords, &nwords); plen =2 /* PBC */ + hwords + nwords;
@@ -919,7 +924,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd,* so that when enough buffer space becomes available, * the ACK is sent ahead of other outgoing packets. */ -hfi1_queue_rc_ack (qp, is_fecn); +hfi1_queue_rc_ack (packet, is_fecn);return ; } trace_ack_output_ibhdr(dd_from_ibdev(qp->ibqp.device),
@@ -1537,7 +1542,7 @@ static void rc_rcv_resp(struct hfi1_packet *packet)void *data = packet->payload;u32 tlen = packet->tlen;struct rvt_qp *qp = packet->qp; -struct hfi1_ibport *ibp =to_iport (qp->ibqp.device, qp->port_num); +struct hfi1_ibport *ibp;struct ib_other_headers *ohdr = packet->ohdr;struct rvt_swqe *wqe;enum ib_wc_status status;
@@ -1695,6 +1700,7 @@ static void rc_rcv_resp(struct hfi1_packet *packet) goto ack_err; ack_seq_err: + ibp =rcd_to_iport (rcd);rdma_seq_err (qp, ibp, psn, rcd); goto ack_done;
@@ -2476,7 +2482,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) qp->r_nak_state =IB_NAK_REMOTE_ACCESS_ERROR ; qp->r_ack_psn = qp->r_psn; send_ack: -hfi1_send_rc_ack (rcd, qp, is_fecn); +hfi1_send_rc_ack (packet, is_fecn); } void hfi1_rc_hdrerr(
drivers/infiniband/hw/hfi1/verbs.h +1 -2
@@ -363,8 +363,7 @@ void hfi1_make_ruc_header(struct rvt_qp *qp, struct ib_other_headers *ohdr,void hfi1_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status); -void hfi1_send_rc_ack (struct hfi1_ctxtdata *rcd,struct rvt_qp *qp, -bool is_fecn); +void hfi1_send_rc_ack (struct hfi1_packet *packet,bool is_fecn);int hfi1_make_rc_req (struct rvt_qp *qp,struct hfi1_pkt_state *ps);
--
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 IB/hfi1: Remove unnecessary fecn and becn fields
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
packet->fecn and packet->becn are calculated in the hot path and are never used. Remove these fields as they show to be costly in a profile. Also, remove initialization for becn and fecn in process_ecn() as they're unconditionally assigned in the function and ensure fecn and becn variables use a boolean type.
--- drivers/infiniband/hw/hfi1/driver.c | 4 ---- drivers/infiniband/hw/hfi1/hfi.h | 16 +++++----------- drivers/infiniband/hw/hfi1/rc.c | 2 +- drivers/infiniband/hw/hfi1/ruc.c | 4 ++-- drivers/infiniband/hw/hfi1/trace.c | 8 ++++---- drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 16 ++++++++-------- include/rdma/ib_hdrs.h | 10 ++++------ 7 files changed, 24 insertions(+), 36 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +0 -4
@@ -1440,8 +1440,6 @@ static int hfi1_setup_9B_packet(struct hfi1_packet *packet) packet->sc =hfi1_9B_get_sc5 (hdr, packet->rhf); packet->pad =ib_bth_get_pad (packet->ohdr); packet->extra_byte =0 ; - packet->fecn =ib_bth_get_fecn (packet->ohdr); - packet->becn =ib_bth_get_becn (packet->ohdr); packet->pkey =ib_bth_get_pkey (packet->ohdr); packet->migrated =ib_bth_is_migration (packet->ohdr);
@@ -1510,8 +1508,6 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet) packet->sl = ibp->sc_to_sl[packet->sc]; packet->pad =hfi1_16B_bth_get_pad (packet->ohdr); packet->extra_byte =SIZE_OF_LT ; - packet->fecn =hfi1_16B_get_fecn (packet->hdr); - packet->becn =hfi1_16B_get_becn (packet->hdr); packet->pkey =hfi1_16B_get_pkey (packet->hdr); packet->migrated =opa_bth_is_migration (packet->ohdr);
drivers/infiniband/hw/hfi1/hfi.h +5 -11
@@ -352,8 +352,6 @@ struct hfi1_packet {u8 sc;u8 sl;u8 opcode; -bool becn; -bool fecn;bool migrated; };
@@ -1788,19 +1786,15 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,static inline bool process_ecn (struct rvt_qp *qp,struct hfi1_packet *pkt,bool do_cnp) { -struct ib_other_headers *ohdr = pkt->ohdr; - -u32 bth1; -bool becn = false; -bool fecn = false; +bool becn; +bool fecn;if (pkt->etype ==RHF_RCV_TYPE_BYPASS ) { fecn =hfi1_16B_get_fecn (pkt->hdr); becn =hfi1_16B_get_becn (pkt->hdr); }else { - bth1 =be32_to_cpu (ohdr->bth[1 ]); - fecn = bth1 &IB_FECN_SMASK ; - becn = bth1 &IB_BECN_SMASK ; + fecn =ib_bth_get_fecn (pkt->ohdr); + becn =ib_bth_get_becn (pkt->ohdr); }if (unlikely (fecn || becn)) {hfi1_process_ecn_slowpath (qp, pkt, do_cnp);
@@ -2425,7 +2419,7 @@ static inline void hfi1_make_ib_hdr(struct ib_header *hdr,static inline void hfi1_make_16b_hdr (struct hfi1_16b_header *hdr,u32 slid,u32 dlid,u16 len,u16 pkey, -u8 becn,u8 fecn,u8 l4, +bool becn,bool fecn,u8 l4,u8 sc) {u32 lrh0 =0 ;
drivers/infiniband/hw/hfi1/rc.c +1 -1
@@ -814,7 +814,7 @@ static inline void hfi1_make_rc_ack_16B(struct hfi1_packet *packet,struct ib_other_headers *ohdr;u32 bth0, bth1 =0 ;u16 len, pkey; -u8 becn = !!is_fecn; +bool becn = is_fecn;u8 l4 =OPA_16B_L4_IB_LOCAL ;u8 extra_bytes;
drivers/infiniband/hw/hfi1/ruc.c +2 -2
@@ -751,7 +751,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, ps->s_txreq->s_cur_size);u32 nwords =SIZE_OF_CRC + ((ps->s_txreq->s_cur_size + extra_bytes +SIZE_OF_LT ) >>2 ); -u8 becn =0 ; +bool becn = false;if (unlikely (rdma_ah_get_ah_flags (&qp->remote_ah_attr) &IB_AH_GRH ) &&hfi1_check_mcast (rdma_ah_get_dlid (&qp->remote_ah_attr))) {
@@ -788,7 +788,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,if (qp->s_flags &RVT_S_ECN ) { qp->s_flags &= ~RVT_S_ECN ;/* we recently received a FECN, so return a BECN */ - becn =1 ; + becn = true; }hfi1_make_ruc_bth (qp, ohdr, bth0, bth1, bth2);
drivers/infiniband/hw/hfi1/trace.c +4 -4
@@ -138,7 +138,7 @@ u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opa_hdr) }void hfi1_trace_parse_9b_bth (struct ib_other_headers *ohdr, -u8 *ack,u8 *becn,u8 *fecn,u8 *mig, +u8 *ack,bool *becn,bool *fecn,u8 *mig,u8 *se,u8 *pad,u8 *opcode,u8 *tver,u16 *pkey,u32 *psn,u32 *qpn) {
@@ -184,7 +184,7 @@ void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5, }void hfi1_trace_parse_16b_hdr (struct hfi1_16b_header *hdr, -u8 *age,u8 *becn,u8 *fecn, +u8 *age,bool *becn,bool *fecn,u8 *l4,u8 *rc,u8 *sc,u16 *entropy,u16 *len,u16 *pkey,u32 *dlid,u32 *slid)
@@ -207,7 +207,7 @@ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,#define LRH_16B_PRN "age:%d becn:%d fecn:%d l4:%d " \ "rc:%d sc:%d pkey:0x%.4x entropy:0x%.4x"const char *hfi1_trace_fmt_lrh (struct trace_seq *p,bool bypass, -u8 age,u8 becn,u8 fecn,u8 l4, +u8 age,bool becn,bool fecn,u8 l4,u8 lnh,const char *lnh_name,u8 lver,u8 rc,u8 sc,u8 sl,u16 entropy,u16 len,u16 pkey,u32 dlid,u32 slid)
@@ -235,7 +235,7 @@ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,"op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \"qpn:0x%.6x a:%d psn:0x%.8x" const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass, - u8 ack, u8 becn, u8 fecn, u8 mig, + u8 ack, bool becn, bool fecn, u8 mig, u8 se, u8 pad, u8 opcode, const char *opname, u8 tver, u16 pkey, u32 psn, u32 qpn) {
drivers/infiniband/hw/hfi1/trace_ibhdrs.h +8 -8
@@ -101,7 +101,7 @@u8 hfi1_trace_packet_hdr_len (struct hfi1_packet *packet);const char *hfi1_trace_get_packet_l4_str (u8 l4);void hfi1_trace_parse_9b_bth (struct ib_other_headers *ohdr, -u8 *ack,u8 *becn,u8 *fecn,u8 *mig, +u8 *ack,bool *becn,bool *fecn,u8 *mig,u8 *se,u8 *pad,u8 *opcode,u8 *tver,u16 *pkey,u32 *psn,u32 *qpn); void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
@@ -112,19 +112,19 @@ void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr, u8 *pad, u8 *se, u8 *tver, u32 *psn, u32 *qpn);void hfi1_trace_parse_16b_hdr (struct hfi1_16b_header *hdr, -u8 *age,u8 *becn,u8 *fecn, +u8 *age,bool *becn,bool *fecn,u8 *l4,u8 *rc,u8 *sc,u16 *entropy,u16 *len,u16 *pkey,u32 *dlid,u32 *slid);const char *hfi1_trace_fmt_lrh (struct trace_seq *p,bool bypass, -u8 age,u8 becn,u8 fecn,u8 l4, +u8 age,bool becn,bool fecn,u8 l4,u8 lnh,const char *lnh_name,u8 lver,u8 rc,u8 sc,u8 sl,u16 entropy,u16 len,u16 pkey,u32 dlid,u32 slid);const char *hfi1_trace_fmt_bth (struct trace_seq *p,bool bypass, -u8 ack,u8 becn,u8 fecn,u8 mig, +u8 ack,bool becn,bool fecn,u8 mig,u8 se,u8 pad,u8 opcode,const char *opname,u8 tver,u16 pkey,u32 psn,u32 qpn);
@@ -148,8 +148,8 @@ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr, __field(u8, etype) __field(u8, ack) __field(u8, age) - __field(u8, becn) - __field(u8, fecn) + __field(bool, becn) + __field(bool, fecn) __field(u8, l2) __field(u8, l4)__field (u8, lnh)
@@ -290,8 +290,8 @@ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr, __field(u8, hdr_type) __field(u8, ack) __field(u8, age) - __field(u8, becn) - __field(u8, fecn) + __field(bool, becn) + __field(bool, fecn) __field(u8, l4) __field(u8, lnh)__field (u8, lver)
include/rdma/ib_hdrs.h +4 -6
@@ -313,16 +313,14 @@ static inline u32 ib_bth_get_qpn(struct ib_other_headers *ohdr)return (u32)((be32_to_cpu (ohdr->bth[1 ])) &IB_QPN_MASK ); } -static inline u8 ib_bth_get_becn (struct ib_other_headers *ohdr) +static inline bool ib_bth_get_becn (struct ib_other_headers *ohdr) { -return (u8)((be32_to_cpu (ohdr->bth[1 ]) >>IB_BECN_SHIFT ) & -IB_BECN_MASK ); +return !!((ohdr->bth[1 ]) &cpu_to_be32 (IB_BECN_SMASK )); } -static inline u8 ib_bth_get_fecn (struct ib_other_headers *ohdr) +static inline bool ib_bth_get_fecn (struct ib_other_headers *ohdr) { -return (u8)((be32_to_cpu (ohdr->bth[1 ]) >>IB_FECN_SHIFT ) & -IB_FECN_MASK ); +return !!((ohdr->bth[1 ]) &cpu_to_be32 (IB_FECN_SMASK )); }static inline u8 ib_bth_get_tver (struct ib_other_headers *ohdr)
--
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 IB/hfi1: Optimize process_receive_ib()
In reply to a message not in the archiveFrom: Sebastian Sanchez <[email protected]>
The arguments for trace_hfi1_rcvhdr() get computed every time in the hot path regardless of the whether the trace is on or off. This is seen to be costly with a profile. The handling of fault inject isolates the verbs device for all packets regardless of the presence of a RHF_DC_ERR error.
Fix the first by computing trace_hfi1_rcvhdr() arguments within the trace itself, so that when the trace is off, the argument data isn't computed. Fix the second by moving the error check to handle_eflags() when an RHF error occurs and by testing for RHF_DC_ERR before executing the reset of handle_eflags().
--- drivers/infiniband/hw/hfi1/driver.c | 21 +++++++-------------- drivers/infiniband/hw/hfi1/trace_rx.h | 28 ++++++++++------------------ 2 files changed, 17 insertions(+), 32 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +7 -14
@@ -256,7 +256,12 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,u32 mlid_base;struct hfi1_ibport *ibp =rcd_to_iport (rcd);struct hfi1_devdata *dd = ppd->dd; -struct rvt_dev_info *rdi = &dd->verbs_dev.rdi; +struct hfi1_ibdev *verbs_dev = &dd->verbs_dev; +struct rvt_dev_info *rdi = &verbs_dev->rdi; + +if ((packet->rhf &RHF_DC_ERR ) && +hfi1_dbg_fault_suppress_err (verbs_dev)) +return ;if (packet->rhf & (RHF_VCRC_ERR |RHF_ICRC_ERR ))return ;
@@ -1554,19 +1559,7 @@ int process_receive_ib(struct hfi1_packet *packet)if (hfi1_setup_9B_packet (packet))return RHF_RCV_CONTINUE ; -trace_hfi1_rcvhdr (packet->rcd->ppd->dd, - packet->rcd->ctxt, -rhf_err_flags (packet->rhf), -RHF_RCV_TYPE_IB , - packet->hlen, - packet->tlen, - packet->updegr, -rhf_egr_index (packet->rhf)); - -if (unlikely ( - (hfi1_dbg_fault_suppress_err (&packet->rcd->dd->verbs_dev) && - (packet->rhf &RHF_DC_ERR )))) -return RHF_RCV_CONTINUE ; +trace_hfi1_rcvhdr (packet,RHF_RCV_TYPE_IB );if (unlikely (rhf_err_flags (packet->rhf))) {handle_eflags (packet);
drivers/infiniband/hw/hfi1/trace_rx.h +10 -18
@@ -63,17 +63,9 @@#define TRACE_SYSTEM hfi1_rx TRACE_EVENT(hfi1_rcvhdr, - TP_PROTO(struct hfi1_devdata *dd, - u32 ctxt, - u64 eflags, - u32 etype, - u32 hlen, - u32 tlen, - u32 updegr, - u32 etail - ), - TP_ARGS(dd, ctxt, eflags, etype, hlen, tlen, updegr, etail), - TP_STRUCT__entry(DD_DEV_ENTRY(dd) + TP_PROTO(struct hfi1_packet *packet, u32 etype), + TP_ARGS(packet, etype), + TP_STRUCT__entry(DD_DEV_ENTRY(packet->rcd->dd) __field(u64, eflags) __field(u32, ctxt) __field(u32, etype)
@@ -82,14 +74,14 @@ __field(u32, updegr)__field (u32, etail) ), - TP_fast_assign(DD_DEV_ASSIGN(dd); - __entry->eflags = eflags; - __entry->ctxt = ctxt; + TP_fast_assign(DD_DEV_ASSIGN(packet->rcd->dd); + __entry->eflags =rhf_err_flags (packet->rhf); + __entry->ctxt = packet->rcd->ctxt; __entry->etype = etype; - __entry->hlen = hlen; - __entry->tlen = tlen; - __entry->updegr = updegr; - __entry->etail = etail; + __entry->hlen = packet->hlen; + __entry->tlen = packet->tlen; + __entry->updegr = packet->updegr; + __entry->etail =rhf_egr_index (packet->rhf); ), TP_printk( "[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d",
--
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 IB/hfi1: Re-order IRQ cleanup to address driver cleanup race
In reply to a message not in the archiveFrom: Michael J. Ruhl <[email protected]>
The pci_request_irq() interfaces always adds the IRQF_SHARED bit to all IRQ requests.
When the kernel is built with CONFIG_DEBUG_SHIRQ config flag, if the IRQF_SHARED bit is set, a call to the IRQ handler is made from the __free_irq() function. This is testing a race condition between the IRQ cleanup and an IRQ racing the cleanup. The HFI driver should be able to handle this race, but does not.
This race can cause traces that start with this footprint:
BUG: unable to handle kernel NULL pointer dereference at (null) Call Trace: <hfi1 irq handler> ... __free_irq+0x1b3/0x2d0 free_irq+0x35/0x70 pci_free_irq+0x1c/0x30 clean_up_interrupts+0x53/0xf0 [hfi1] hfi1_start_cleanup+0x122/0x190 [hfi1] postinit_cleanup+0x1d/0x280 [hfi1] remove_one+0x233/0x250 [hfi1] pci_device_remove+0x39/0xc0
Export IRQ cleanup function so it can be called from other modules.
Using the exported cleanup function:
Re-order the driver cleanup code to clean up IRQ resources before other resources, eliminating the race.
Re-order error path for init so that the race does not occur.
Reduce severity on spurious error message for SDMA IRQs to info.
--- drivers/infiniband/hw/hfi1/chip.c | 18 ++++++++++++------ drivers/infiniband/hw/hfi1/hfi.h | 1 + drivers/infiniband/hw/hfi1/init.c | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +12 -6
@@ -8319,8 +8319,8 @@ static irqreturn_t sdma_interrupt(int irq, void *data)/* handle the interrupt(s) */ sdma_engine_interrupt (sde, status); }else { -dd_dev_err_ratelimited (dd,"SDMA engine %u interrupt, but no status bits set\n" , - sde->this_idx); +dd_dev_info_ratelimited (dd,"SDMA engine %u interrupt, but no status bits set\n" , + sde->this_idx); }return IRQ_HANDLED ; }
@@ -13031,7 +13031,14 @@ static void disable_intx(struct pci_dev *pdev)pci_intx (pdev,0 ); } -static void clean_up_interrupts (struct hfi1_devdata *dd) +/** +* hfi1_clean_up_interrupts() - Free all IRQ resources +* @dd: valid device data data structure +* +* Free the MSI or INTx IRQs and assoicated PCI resources, +* if they have been allocated. +*/ +void hfi1_clean_up_interrupts (struct hfi1_devdata *dd) {int i;
@@ -13392,7 +13399,7 @@ static int set_up_interrupts(struct hfi1_devdata *dd)return 0 ; fail: -clean_up_interrupts (dd); +hfi1_clean_up_interrupts (dd);return ret; }
@@ -14819,7 +14826,6 @@ void hfi1_start_cleanup(struct hfi1_devdata *dd)aspm_exit (dd);free_cntrs (dd);free_rcverr (dd); -clean_up_interrupts (dd);finish_chip_resources (dd); }
@@ -15275,7 +15281,7 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev, bail_free_cntrs:free_cntrs (dd); bail_clear_intr: -clean_up_interrupts (dd); +hfi1_clean_up_interrupts (dd); bail_cleanup:hfi1_pcie_ddcleanup (dd); bail_free:
drivers/infiniband/hw/hfi1/hfi.h +1 -0
@@ -1960,6 +1960,7 @@ int hfi1_create_port_files(struct ib_device *ibdev, u8 port_num,int qsfp_dump (struct hfi1_pportdata *ppd,char *buf,int len);int hfi1_pcie_init (struct pci_dev *pdev,const struct pci_device_id *ent); +void hfi1_clean_up_interrupts (struct hfi1_devdata *dd);void hfi1_pcie_cleanup (struct pci_dev *pdev);int hfi1_pcie_ddinit (struct hfi1_devdata *dd,struct pci_dev *pdev);void hfi1_pcie_ddcleanup (struct hfi1_devdata *);
drivers/infiniband/hw/hfi1/init.c +3 -1
@@ -1067,8 +1067,9 @@ static void shutdown_device(struct hfi1_devdata *dd) } dd->flags &= ~HFI1_INITTED ; -/* mask interrupts, but not errors */ +/* mask and clean up interrupts, but not errors */ set_intr_state (dd,0 ); +hfi1_clean_up_interrupts (dd);for (pidx =0 ; pidx < dd->num_pports; ++pidx) { ppd = dd->pport + pidx;
@@ -1714,6 +1715,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)dd_dev_err (dd,"Failed to create /dev devices: %d\n" , -j);if (initfail || ret) { +hfi1_clean_up_interrupts (dd);stop_timers (dd);flush_workqueue (ib_wq);for (pidx =0 ; pidx < dd->num_pports; ++pidx) {
--
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 IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
iWarp devices do not support the creation of address handles so return AH_ATTR_TYPE_UNDEFINED for all iWarp devices.
While we are here reduce the size of port_num to u8 and add a comment.
--- include/rdma/ib_verbs.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
include/rdma/ib_verbs.h +11 -4
@@ -881,6 +881,7 @@ enum rdma_ah_attr_type {RDMA_AH_ATTR_TYPE_IB ,RDMA_AH_ATTR_TYPE_ROCE ,RDMA_AH_ATTR_TYPE_OPA , + RDMA_AH_ATTR_TYPE_UNDEFINED, }; struct ib_ah_attr {
@@ -3789,13 +3790,19 @@ static inline void rdma_ah_set_grh(struct rdma_ah_attr *attr, grh->traffic_class = traffic_class; } -/*Get AH type */ +/** +* rdma_ah_find_type - Return address handle type. +* +* @dev: Device to be checked +* @port_num: Port number +*/ static inline enum rdma_ah_attr_type rdma_ah_find_type (struct ib_device *dev, -u32 port_num) +u8 port_num) { -if ((rdma_protocol_roce (dev, port_num)) || - (rdma_protocol_iwarp (dev, port_num))) +if (rdma_protocol_roce (dev, port_num))return RDMA_AH_ATTR_TYPE_ROCE ; +else if (rdma_protocol_iwarp (dev, port_num)) +return RDMA_AH_ATTR_TYPE_UNDEFINED ;else if ((rdma_protocol_ib (dev, port_num)) && (rdma_cap_opa_ah (dev, port_num)))return RDMA_AH_ATTR_TYPE_OPA ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180126143315.6868.67354.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
Re: [PATCH for-next 15/16] IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
Quoted 8 lines · Dennis Dalessandro
From: Don Hiatt <[email protected]>
iWarp devices do not support the creation of address handles so return
AH_ATTR_TYPE_UNDEFINEDfor all iWarp devices.While we are here reduce the size of
port_numto u8 and add a comment.
Quoted 8 lines
Fixes 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")CC Sean Hefty <[email protected]>Reviewed-by Ira Weiny <[email protected]>Signed-off-by Don Hiatt <[email protected]>Signed-off-by Dennis Dalessandro <[email protected]>include/rdma/ib_verbs.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
What tree are you sending these patches again? This won't apply.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180126154540.GA23869-uk2M96/[email protected]
Re: [PATCH for-next 15/16] IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
Quoted 18 lines · Jason Gunthorpe
Quoted 8 lines · Dennis Dalessandro
From: Don Hiatt <[email protected]>
iWarp devices do not support the creation of address handles so return
AH_ATTR_TYPE_UNDEFINEDfor all iWarp devices.While we are here reduce the size of
port_numto u8 and add a comment.Quoted 8 lines
Fixes 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")CC Sean Hefty <[email protected]>Reviewed-by Ira Weiny <[email protected]>Signed-off-by Don Hiatt <[email protected]>Signed-off-by Dennis Dalessandro <[email protected]>include/rdma/ib_verbs.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
Quoted 1 line
What tree are you sending these patches again? This won't apply.
Ugh, I thought I was up to date. Guess not. Let me rebase and respin. Looks like you had a comment on one of the other patches so I'll wait for Alex to address that and re-send.
-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
A message that is not in the archive (sent off-list or not yet received): ce815670-cf1b-5199-9a52-2779cb8f8c75-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
RE: [PATCH for-next 15/16] IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogRGVubmlzIERhbGVzc2Fu ZHJvIFttYWlsdG86ZGVubmlzLmRhbGVzc2FuZHJvQGludGVsLmNvbV0NCj4gU2VudDogRnJpZGF5 LCBKYW51YXJ5IDI2LCAyMDE4IDk6NTkgQU0NCj4gVG86IEphc29uIEd1bnRob3JwZSA8amdnQHpp ZXBlLmNhPg0KPiBDYzogZGxlZGZvcmRAcmVkaGF0LmNvbTsgbGludXgtcmRtYUB2Z2VyLmtlcm5l bC5vcmc7IERvbiBIaWF0dA0KPiA8ZG9uLmhpYXR0QGludGVsLmNvbT47IFNlYW4gSGVmdHkgPHNl YW4uaGVmdHlAaW50ZWwuY29tPjsgSXJhIFdlaW55DQo+IDxpcmEud2VpbnlAaW50ZWwuY29tPjsg UGFyYXYgUGFuZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0gg Zm9yLW5leHQgMTUvMTZdIElCL2NvcmU6IE1hcCBpV2FycCBBSCB0eXBlIHRvIHVuZGVmaW5lZCBp bg0KPiByZG1hX2FoX2ZpbmRfdHlwZQ0KPiANCj4gT24gMS8yNi8yMDE4IDEwOjQ1IEFNLCBKYXNv biBHdW50aG9ycGUgd3JvdGU6DQo+ID4gT24gRnJpLCBKYW4gMjYsIDIwMTggYXQgMDY6MzM6MThB TSAtMDgwMCwgRGVubmlzIERhbGVzc2FuZHJvIHdyb3RlOg0KPiA+PiBGcm9tOiBEb24gSGlhdHQg PGRvbi5oaWF0dEBpbnRlbC5jb20+DQo+ID4+DQo+ID4+IGlXYXJwIGRldmljZXMgZG8gbm90IHN1 cHBvcnQgdGhlIGNyZWF0aW9uIG9mIGFkZHJlc3MgaGFuZGxlcyBzbw0KPiA+PiByZXR1cm4gQUhf QVRUUl9UWVBFX1VOREVGSU5FRCBmb3IgYWxsIGlXYXJwIGRldmljZXMuDQo+ID4+DQo+ID4+IFdo aWxlIHdlIGFyZSBoZXJlIHJlZHVjZSB0aGUgc2l6ZSBvZiBwb3J0X251bSB0byB1OCBhbmQgYWRk IGENCj4gPj4gY29tbWVudC4NCj4gPj4NCj4gPj4gRml4ZXM6IDQ0YzU4NDg3ZDUxYSAoIklCL2Nv cmU6IERlZmluZSAnaWInIGFuZCAncm9jZScgcmRtYV9haF9hdHRyDQo+ID4+IHR5cGVzIikNCj4g Pj4gUmVwb3J0ZWQtYnk6IFBhcmF2IFBhbmRpdCA8cGFyYXZAbWVsbGFub3guY29tPg0KPiA+PiBD QzogU2VhbiBIZWZ0eSA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+DQo+ID4+IFJldmlld2VkLWJ5OiBJ cmEgV2VpbnkgPGlyYS53ZWlueUBpbnRlbC5jb20+DQo+ID4+IFNpZ25lZC1vZmYtYnk6IERvbiBI aWF0dCA8ZG9uLmhpYXR0QGludGVsLmNvbT4NCj4gPj4gU2lnbmVkLW9mZi1ieTogRGVubmlzIERh bGVzc2FuZHJvIDxkZW5uaXMuZGFsZXNzYW5kcm9AaW50ZWwuY29tPg0KPiA+PiAgIGluY2x1ZGUv cmRtYS9pYl92ZXJicy5oIHwgICAxNSArKysrKysrKysrKy0tLS0NCj4gPj4gICAxIGZpbGVzIGNo YW5nZWQsIDExIGluc2VydGlvbnMoKyksIDQgZGVsZXRpb25zKC0pDQo+ID4NCj4gPiBXaGF0IHRy ZWUgYXJlIHlvdSBzZW5kaW5nIHRoZXNlIHBhdGNoZXMgYWdhaW4/IFRoaXMgd29uJ3QgYXBwbHku DQo+IA0KPiBVZ2gsIEkgdGhvdWdodCBJIHdhcyB1cCB0byBkYXRlLiBHdWVzcyBub3QuIExldCBt ZSByZWJhc2UgYW5kIHJlc3Bpbi4NCj4gTG9va3MgbGlrZSB5b3UgaGFkIGEgY29tbWVudCBvbiBv bmUgb2YgdGhlIG90aGVyIHBhdGNoZXMgc28gSSdsbCB3YWl0IGZvciBBbGV4IHRvDQo+IGFkZHJl c3MgdGhhdCBhbmQgcmUtc2VuZC4NCj4gDQpBbHNvIGNhbiB3ZSBoYXZlIFVOREVGSU5FRCBBSCBl bnVtIGFzIDAgcmF0aGVyIHRoYW4gMz8NClRoaXMgd2lsbCBhbGxvdyB0byBjYXRjaCBlcnJvcnMg aW4gdGhlIGNvZGUgdGhhdCB3aWxsIGRlY29kZSAwIGluaXRpYWxpemVkIGZpZWxkIGFzIElCPw0K VGhpcyBhbHNvIGVuc3VyZXMgdGhhdCByaWdodCBBSCB0eXBlIGlzIGluaXRpYWxpemVkIHdoZXJl dmVyIG5lZWRlZC4NCg0KPiAtRGVubnkNCg==
--
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
Shiraz Saleem
Reviewed-byRe: [PATCH for-next 15/16] IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
In reply to a message not in the archiveQuoted 8 lines · Dennis Dalessandro
From: Don Hiatt <[email protected]>
iWarp devices do not support the creation of address handles so return
AH_ATTR_TYPE_UNDEFINEDfor all iWarp devices.While we are here reduce the size of
port_numto u8 and add a comment.
Quoted 7 lines
Fixes 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")CC Sean Hefty <[email protected]>Reviewed-by Ira Weiny <[email protected]>Signed-off-by Don Hiatt <[email protected]>Signed-off-by Dennis Dalessandro <[email protected]>---
--
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 IB/ipoib: Fix for potential no-carrier state
In reply to a message not in the archiveFrom: Alex Estrin <[email protected]>
On reboot SM can program port pkey table before ipoib registered its event handler, which could result in missing pkey event and leave root interface with initial pkey value from index 0.
Since OPA port starts with invalid pkey in index 0, root interface will fail to initialize and stay down with no-carrier flag.
For IB ipoib interface may end up with pkey different from value opensm put in pkey table idx 0, resulting in connectivity issues (different mcast groups, for example).
Close the window by calling event handler after registration to make sure ipoib pkey is in sync with port pkey table.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +3 -0
@@ -2306,6 +2306,9 @@ void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca) priv->ca, ipoib_event);ib_register_event_handler (&priv->event_handler); +/* call event handler to ensure pkey in sync */ +queue_work (ipoib_workqueue, &priv->flush_heavy); + result =register_netdev (priv->dev);if (result) { pr_warn("%s: couldn't register ipoib port %d; error %d\n",
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180126143323.6868.89162.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
Re: [PATCH for-next 16/16] IB/ipoib: Fix for potential no-carrier state
Quoted 29 lines · Dennis Dalessandro
From: Alex Estrin <[email protected]>
On reboot SM can program port pkey table before ipoib registered its event handler, which could result in missing pkey event and leave root interface with initial pkey value from index 0.
Since OPA port starts with invalid pkey in index 0, root interface will fail to initialize and stay down with no-carrier flag.
For IB ipoib interface may end up with pkey different from value opensm put in pkey table idx 0, resulting in connectivity issues (different mcast groups, for example).
Close the window by calling event handler after registration to make sure ipoib pkey is in sync with port pkey table.
Reviewed-by Mike Marciniszyn <[email protected]>Reviewed-by Ira Weiny <[email protected]>Signed-off-by Alex Estrin <[email protected]>Signed-off-by Dennis Dalessandro <[email protected]>--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)drivers/infiniband/ulp/ipoib/ipoib_main.c +0
-0
drivers/infiniband/ulp/ipoib/ipoib_main.c void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca) · line 2311
Quoted 6 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +3
-0@@ -2306,6 +2306,9 @@ void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca) priv->ca, ipoib_event);ib_register_event_handler (&priv->event_handler); +/* call event handler to ensure pkey in sync */ +queue_work (ipoib_workqueue, &priv->flush_heavy); +
This seems like a bit of a sledgehammer to the issue. Looking through ipoib_add_port(), the real race is that we have to call ib_query_pkey() early in the init sequence as some of the later steps need it to be set (ipoib_dev_init() must have it already set for one), but since we don't setup our event handler until after we've finished setting up the device, there is that window from our first ib_query_pkey call until we complete the ib_register_event_handler() call for the pkey to change. Instead of throwing the flush regardless, it might be nicer to do:
{
u16 new_pkey;
ib_query_pkey(hca, port, 0, &new_pkey);
if (priv->pkey != (new_pkey | 0x8000))
/* The pkey changed between when we
* read it and now, flush the device
*/
queue_work(ipoib_workqueue, &priv->flush_heavy);
}Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +0
-0result =register_netdev (priv->dev);if (result) { pr_warn("%s: couldn't register ipoib port %d; error %d\n",
Signature · 3 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
A message that is not in the archive (sent off-list or not yet received): 1516986011.27592.207.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Re: [PATCH for-next 16/16] IB/ipoib: Fix for potential no-carrier state
Quoted 3 lines · Doug Ledford
device, there is that window from our first
ib_query_pkeycall until we complete theib_register_event_handler()call for the pkey to change. Instead of throwing the flush regardless, it might be nicer to do:
Can we move the ib_register_event_handler sooner?
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20180126170610.GD23869-uk2M96/[email protected]
Re: [PATCH for-next 16/16] IB/ipoib: Fix for potential no-carrier state
Quoted 7 lines · Jason Gunthorpe
Quoted 3 lines · Doug Ledford
device, there is that window from our first
ib_query_pkeycall until we complete theib_register_event_handler()call for the pkey to change. Instead of throwing the flush regardless, it might be nicer to do:Can we move the
ib_register_event_handlersooner?
I didn't do a full audit, but I'm not sure it's safe to, simply because we haven't fully completed our device setup and if our event handler is live, we can get event triggered activities that might expect everything to be done. It would take a complete audit to know for sure.
Signature · 3 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
A message that is not in the archive (sent off-list or not yet received): 1516986596.27592.209.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
RE: [PATCH for-next 16/16] IB/ipoib: Fix for potential no-carrier state
DQoNCj4gT24gRnJpLCAyMDE4LTAxLTI2IGF0IDEwOjA2IC0wNzAwLCBKYXNvbiBHdW50aG9ycGUg d3JvdGU6DQo+ID4gT24gRnJpLCBKYW4gMjYsIDIwMTggYXQgMTI6MDA6MTFQTSAtMDUwMCwgRG91 ZyBMZWRmb3JkIHdyb3RlOg0KPiA+DQo+ID4gPiBkZXZpY2UsIHRoZXJlIGlzIHRoYXQgd2luZG93 IGZyb20gb3VyIGZpcnN0IGliX3F1ZXJ5X3BrZXkgY2FsbCB1bnRpbCB3ZQ0KPiA+ID4gY29tcGxl dGUgdGhlIGliX3JlZ2lzdGVyX2V2ZW50X2hhbmRsZXIoKSBjYWxsIGZvciB0aGUgcGtleSB0byBj aGFuZ2UuDQo+ID4gPiBJbnN0ZWFkIG9mIHRocm93aW5nIHRoZSBmbHVzaCByZWdhcmRsZXNzLCBp dCBtaWdodCBiZSBuaWNlciB0byBkbzoNCj4gPg0KPiA+IENhbiB3ZSBtb3ZlIHRoZSBpYl9yZWdp c3Rlcl9ldmVudF9oYW5kbGVyIHNvb25lcj8NCkhpIEphc29uLA0KSSBoYXZlIGxvb2tlZCBhdCB0 aGlzIHZhcmlhbnQsIGFuZCByZWplY3RlZCB0aGlzIGlkZWEsIGFzIGl0IHdvdWxkIHJlcXVpcmUN CmEgcXVpdGUgc2VyaW91cyBpbml0aWFsaXphdGlvbiByZXdvcmsuIFNlZW0gcmlza3kgYW5kIHVu bmVjZXNzYXJ5Lg0KQmVzaWRlcyBpdCB3b24ndCBjbG9zZSB0aGUgd2luZG93IGNvbXBsZXRlbHku DQotQWxleC4NCiANCj4gSSBkaWRuJ3QgZG8gYSBmdWxsIGF1ZGl0LCBidXQgSSdtIG5vdCBzdXJl IGl0J3Mgc2FmZSB0bywgc2ltcGx5IGJlY2F1c2UNCj4gd2UgaGF2ZW4ndCBmdWxseSBjb21wbGV0 ZWQgb3VyIGRldmljZSBzZXR1cCBhbmQgaWYgb3VyIGV2ZW50IGhhbmRsZXIgaXMNCj4gbGl2ZSwg d2UgY2FuIGdldCBldmVudCB0cmlnZ2VyZWQgYWN0aXZpdGllcyB0aGF0IG1pZ2h0IGV4cGVjdCBl dmVyeXRoaW5nDQo+IHRvIGJlIGRvbmUuICBJdCB3b3VsZCB0YWtlIGEgY29tcGxldGUgYXVkaXQg dG8ga25vdyBmb3Igc3VyZS4NCj4gDQo+IC0tDQo+IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVk aGF0LmNvbT4NCj4gICAgIEdQRyBLZXlJRDogQjgyNkEzMzMwRTU3MkZERA0KPiAgICAgS2V5IGZp bmdlcnByaW50ID0gQUU2QiAxQkRBIDEyMkIgMjNCNCAyNjVCICAxMjc0IEI4MjYgQTMzMyAwRTU3 IDJGREQNCg==
--
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
RE: [PATCH for-next 16/16] IB/ipoib: Fix for potential no-carrier state
In reply to a message not in the archivePiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBEb3VnIExlZGZvcmQgW21haWx0 bzpkbGVkZm9yZEByZWRoYXQuY29tXQ0KPiBTZW50OiBGcmlkYXksIEphbnVhcnkgMjYsIDIwMTgg MTI6MDAgUE0NCj4gVG86IERhbGVzc2FuZHJvLCBEZW5uaXMgPGRlbm5pcy5kYWxlc3NhbmRyb0Bp bnRlbC5jb20+OyBqZ2dAemllcGUuY2ENCj4gQ2M6IGxpbnV4LXJkbWFAdmdlci5rZXJuZWwub3Jn OyBNYXJjaW5pc3p5biwgTWlrZSA8bWlrZS5tYXJjaW5pc3p5bkBpbnRlbC5jb20+Ow0KPiBXZWlu eSwgSXJhIDxpcmEud2VpbnlAaW50ZWwuY29tPjsgRXN0cmluLCBBbGV4IDxhbGV4LmVzdHJpbkBp bnRlbC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggZm9yLW5leHQgMTYvMTZdIElCL2lwb2li OiBGaXggZm9yIHBvdGVudGlhbCBuby1jYXJyaWVyIHN0YXRlDQo+IA0KPiBPbiBGcmksIDIwMTgt MDEtMjYgYXQgMDY6MzMgLTA4MDAsIERlbm5pcyBEYWxlc3NhbmRybyB3cm90ZToNCj4gPiBGcm9t OiBBbGV4IEVzdHJpbiA8YWxleC5lc3RyaW5AaW50ZWwuY29tPg0KPiA+DQo+ID4gT24gcmVib290 IFNNIGNhbiBwcm9ncmFtIHBvcnQgcGtleSB0YWJsZSBiZWZvcmUgaXBvaWIgcmVnaXN0ZXJlZCBp dHMNCj4gPiBldmVudCBoYW5kbGVyLCB3aGljaCBjb3VsZCByZXN1bHQgaW4gbWlzc2luZyBwa2V5 IGV2ZW50IGFuZCBsZWF2ZSByb290DQo+ID4gaW50ZXJmYWNlIHdpdGggaW5pdGlhbCBwa2V5IHZh bHVlIGZyb20gaW5kZXggMC4NCj4gPg0KPiA+IFNpbmNlIE9QQSBwb3J0IHN0YXJ0cyB3aXRoIGlu dmFsaWQgcGtleSBpbiBpbmRleCAwLCByb290IGludGVyZmFjZSB3aWxsDQo+ID4gZmFpbCB0byBp bml0aWFsaXplIGFuZCBzdGF5IGRvd24gd2l0aCBuby1jYXJyaWVyIGZsYWcuDQo+ID4NCj4gPiBG b3IgSUIgaXBvaWIgaW50ZXJmYWNlIG1heSBlbmQgdXAgd2l0aCBwa2V5IGRpZmZlcmVudCBmcm9t IHZhbHVlDQo+ID4gb3BlbnNtIHB1dCBpbiBwa2V5IHRhYmxlIGlkeCAwLCByZXN1bHRpbmcgaW4g Y29ubmVjdGl2aXR5IGlzc3Vlcw0KPiA+IChkaWZmZXJlbnQgbWNhc3QgZ3JvdXBzLCBmb3IgZXhh bXBsZSkuDQo+ID4NCj4gPiBDbG9zZSB0aGUgd2luZG93IGJ5IGNhbGxpbmcgZXZlbnQgaGFuZGxl ciBhZnRlciByZWdpc3RyYXRpb24NCj4gPiB0byBtYWtlIHN1cmUgaXBvaWIgcGtleSBpcyBpbiBz eW5jIHdpdGggcG9ydCBwa2V5IHRhYmxlLg0KPiA+DQo+ID4gUmV2aWV3ZWQtYnk6IE1pa2UgTWFy Y2luaXN6eW4gPG1pa2UubWFyY2luaXN6eW5AaW50ZWwuY29tPg0KPiA+IFJldmlld2VkLWJ5OiBJ cmEgV2VpbnkgPGlyYS53ZWlueUBpbnRlbC5jb20+DQo+ID4gU2lnbmVkLW9mZi1ieTogQWxleCBF c3RyaW4gPGFsZXguZXN0cmluQGludGVsLmNvbT4NCj4gPiBTaWduZWQtb2ZmLWJ5OiBEZW5uaXMg RGFsZXNzYW5kcm8gPGRlbm5pcy5kYWxlc3NhbmRyb0BpbnRlbC5jb20+DQo+ID4gLS0tDQo+ID4g IGRyaXZlcnMvaW5maW5pYmFuZC91bHAvaXBvaWIvaXBvaWJfbWFpbi5jIHwgICAgMyArKysNCj4g PiAgMSBmaWxlcyBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDAgZGVsZXRpb25zKC0pDQo+ID4N Cj4gPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9pbmZpbmliYW5kL3VscC9pcG9pYi9pcG9pYl9tYWlu LmMNCj4gYi9kcml2ZXJzL2luZmluaWJhbmQvdWxwL2lwb2liL2lwb2liX21haW4uYw0KPiA+IGlu ZGV4IDU5MzBjN2QuLjE2MWJhOGMgMTAwNjQ0DQo+ID4gLS0tIGEvZHJpdmVycy9pbmZpbmliYW5k L3VscC9pcG9pYi9pcG9pYl9tYWluLmMNCj4gPiArKysgYi9kcml2ZXJzL2luZmluaWJhbmQvdWxw L2lwb2liL2lwb2liX21haW4uYw0KPiA+IEBAIC0yMzA2LDYgKzIzMDYsOSBAQCB2b2lkIGlwb2li X3NldF9kZXZfZmVhdHVyZXMoc3RydWN0IGlwb2liX2Rldl9wcml2DQo+ICpwcml2LCBzdHJ1Y3Qg aWJfZGV2aWNlICpoY2EpDQo+ID4gIAkJCSAgICAgIHByaXYtPmNhLCBpcG9pYl9ldmVudCk7DQo+ ID4gIAlpYl9yZWdpc3Rlcl9ldmVudF9oYW5kbGVyKCZwcml2LT5ldmVudF9oYW5kbGVyKTsNCj4g Pg0KPiA+ICsJLyogY2FsbCBldmVudCBoYW5kbGVyIHRvIGVuc3VyZSBwa2V5IGluIHN5bmMgKi8N Cj4gPiArCXF1ZXVlX3dvcmsoaXBvaWJfd29ya3F1ZXVlLCAmcHJpdi0+Zmx1c2hfaGVhdnkpOw0K PiA+ICsNCj4gDQo+IFRoaXMgc2VlbXMgbGlrZSBhIGJpdCBvZiBhIHNsZWRnZWhhbW1lciB0byB0 aGUgaXNzdWUuICBMb29raW5nIHRocm91Z2gNCj4gaXBvaWJfYWRkX3BvcnQoKSwgdGhlIHJlYWwg cmFjZSBpcyB0aGF0IHdlIGhhdmUgdG8gY2FsbCBpYl9xdWVyeV9wa2V5KCkNCj4gZWFybHkgaW4g dGhlIGluaXQgc2VxdWVuY2UgYXMgc29tZSBvZiB0aGUgbGF0ZXIgc3RlcHMgbmVlZCBpdCB0byBi ZSBzZXQNCj4gKGlwb2liX2Rldl9pbml0KCkgbXVzdCBoYXZlIGl0IGFscmVhZHkgc2V0IGZvciBv bmUpLCBidXQgc2luY2Ugd2UgZG9uJ3QNCj4gc2V0dXAgb3VyIGV2ZW50IGhhbmRsZXIgdW50aWwg YWZ0ZXIgd2UndmUgZmluaXNoZWQgc2V0dGluZyB1cCB0aGUNCj4gZGV2aWNlLCB0aGVyZSBpcyB0 aGF0IHdpbmRvdyBmcm9tIG91ciBmaXJzdCBpYl9xdWVyeV9wa2V5IGNhbGwgdW50aWwgd2UNCj4g Y29tcGxldGUgdGhlIGliX3JlZ2lzdGVyX2V2ZW50X2hhbmRsZXIoKSBjYWxsIGZvciB0aGUgcGtl eSB0byBjaGFuZ2UuDQo+IEluc3RlYWQgb2YgdGhyb3dpbmcgdGhlIGZsdXNoIHJlZ2FyZGxlc3Ms IGl0IG1pZ2h0IGJlIG5pY2VyIHRvIGRvOg0KPiANCj4gCXsNCj4gCQl1MTYgbmV3X3BrZXk7DQo+ IA0KPiAJCWliX3F1ZXJ5X3BrZXkoaGNhLCBwb3J0LCAwLCAmbmV3X3BrZXkpOw0KPiAJCWlmIChw cml2LT5wa2V5ICE9IChuZXdfcGtleSB8IDB4ODAwMCkpDQo+IAkJCS8qIFRoZSBwa2V5IGNoYW5n ZWQgYmV0d2VlbiB3aGVuIHdlDQo+IAkJCSAqIHJlYWQgaXQgYW5kIG5vdywgZmx1c2ggdGhlIGRl dmljZQ0KPiAJCQkgKi8NCj4gCQkJcXVldWVfd29yayhpcG9pYl93b3JrcXVldWUsICZwcml2LT5m bHVzaF9oZWF2eSk7DQo+IAl9DQoNCkhpIERvdWcsDQpUaGUgcmVhc29uIEkgZGlkIG5vdCBnbyB0 aGlzIHdheSBpcyB0aGF0IGF0IHRoaXMgZWFybHkgcG9pbnQgb2YgaW5pdGlhbGl6YXRpb24gDQpw a2V5IGhhbmRsZXIgd2lsbCBub3Qgb3BlcmF0ZSBhcyBhICJzbGVkZ2VoYW1tZXIiIHRvIGZsdXNo IGFsbCBjYWNoZWQgcmVjb3JkcywgDQppdCB3aWxsICBxdWVyeSBwa2V5LCB1cGRhdGUgaWYgY2hh bmdlZCwgdGhlbiBleGl0IGVhcmx5Lg0KSW4gYW55IGNhc2Ugd2Ugd2lsbCBxdWVyeSBwa2V5IG9u bHkgb25jZSwgbm90IHR3aWNlIGFzIG1pZ2h0IGJlIGluIHlvdXIgY2FzZS4NCg0KVGhhbmtzLA0K QWxleC4NCiANCj4gDQo+ID4gIAlyZXN1bHQgPSByZWdpc3Rlcl9uZXRkZXYocHJpdi0+ZGV2KTsN Cj4gPiAgCWlmIChyZXN1bHQpIHsNCj4gPiAgCQlwcl93YXJuKCIlczogY291bGRuJ3QgcmVnaXN0 ZXIgaXBvaWIgcG9ydCAlZDsgZXJyb3IgJWRcbiIsDQo+ID4NCj4gDQo+IC0tDQo+IERvdWcgTGVk Zm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT4NCj4gICAgIEdQRyBLZXlJRDogQjgyNkEzMzMwRTU3 MkZERA0KPiAgICAgS2V5IGZpbmdlcnByaW50ID0gQUU2QiAxQkRBIDEyMkIgMjNCNCAyNjVCICAx Mjc0IEI4MjYgQTMzMyAwRTU3IDJGREQNCg==
--
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