IB/hfi1: Fixes for 4.7 rc-6
Subsystems (3)
cover IB/hfi1: Fixes for 4.7 rc-6
Doug,
Here are two more patches for the 4.7 RC if possible. One Mike has marked as stable.
These apply on the RC-5 tree and should apply to your trees without any issue.
Patches can also be viewed in my repo at:
https://github.com/ddalessa/kernel/tree/for-4.7
---
Mike Marciniszyn (1):
IB/hfi1: Correct issues with sc5 computation
Tadeusz Struk (1):
IB/hfi1: Fix sleep inside atomic issue in init_asic_data
drivers/infiniband/hw/hfi1/chip.c | 21 ++++++++++++++------- drivers/infiniband/hw/hfi1/ud.c | 23 +++-------------------- 2 files changed, 17 insertions(+), 27 deletions(-)
--
-Denny
PATCH 1/2 IB/hfi1: Correct issues with sc5 computation
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
There are several computatations of the sc in the
ud receive routine.
Besides the code duplication, all are wrong when the
sc is greater than 15. In that case the code incorrectly
or's a 1 into the computed sc instead of 1 shifted left by 4.
Fix precomputed sc5 by using an already implemented routine hdr2sc() and deleting flawed duplicated code.
--- drivers/infiniband/hw/hfi1/ud.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-)
drivers/infiniband/hw/hfi1/ud.c +3 -20
@@ -678,8 +678,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)u32 tlen = packet->tlen;struct rvt_qp *qp = packet->qp;bool has_grh = rcv_flags &HFI1_HAS_GRH ; -bool sc4_bit =has_sc4_bit (packet); -u8 sc; +u8 sc5 =hdr2sc ((struct hfi1_message_header *)hdr, packet->rhf);u32 bth1;int is_mcast;struct ib_grh *grh =NULL ;
@@ -697,10 +696,8 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)*/ struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);u32 lqpn =be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ; -u8 sl, sc5; +u8 sl; - sc5 = (be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ; - sc5 |= sc4_bit; sl = ibp->sc_to_sl[sc5];process_becn (ppd, sl,0 , lqpn,0 ,IB_CC_SVCTYPE_UD );
@@ -717,10 +714,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)if (!is_mcast && (opcode !=IB_OPCODE_CNP ) && bth1 &HFI1_FECN_SMASK ) {u16 slid =be16_to_cpu (hdr->lrh[3 ]); -u8 sc5; - - sc5 = (be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ; - sc5 |= sc4_bit;return_cnp (ibp, qp, src_qp, pkey, dlid, slid, sc5, grh); }
@@ -745,10 +738,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)if (qp->ibqp.qp_num >1 ) {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);u16 slid; -u8 sc5; - - sc5 = (be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ; - sc5 |= sc4_bit; slid =be16_to_cpu (hdr->lrh[3 ]);if (unlikely (rcv_pkey_check (ppd, pkey, sc5, slid))) {
@@ -790,10 +779,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)/* Received on QP0, and so by definition, this is an SMP */ struct opa_smp *smp = (struct opa_smp *)data;u16 slid =be16_to_cpu (hdr->lrh[3 ]); -u8 sc5; - - sc5 = (be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ; - sc5 |= sc4_bit;if (opa_smp_check (ibp, pkey, sc5, qp, slid, smp)) goto drop;
@@ -890,9 +875,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) } wc.slid =be16_to_cpu (hdr->lrh[3 ]); - sc = (be16_to_cpu (hdr->lrh[0 ]) >>12 ) &0xf ; - sc |= sc4_bit; - wc.sl = ibp->sc_to_sl[sc]; + wc.sl = ibp->sc_to_sl[sc5];/* * Save the LMC lower bits if the destination LID is a unicast LID.
--
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/2 IB/hfi1: Fix sleep inside atomic issue in init_asic_data
In reply to a message not in the archiveFrom: Tadeusz Struk <[email protected]>
The critical section should protect only the list traversal and dd->asic_data modification, not the memory allocation. The fix pulls the allocation out of the critical section.
--- drivers/infiniband/hw/hfi1/chip.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +14 -7
@@ -14113,8 +14113,14 @@ static int init_asic_data(struct hfi1_devdata *dd) {unsigned long flags;struct hfi1_devdata *tmp, *peer =NULL ; +struct hfi1_asic_data *asic_data;int ret =0 ; +/* pre-allocate the asic structure in case we are the first device */ + asic_data =kzalloc (sizeof (*dd->asic_data),GFP_KERNEL ); +if (!asic_data) +return -ENOMEM ; +spin_lock_irqsave (&hfi1_devs_lock, flags);/* Find our peer device */ list_for_each_entry (tmp, &hfi1_dev_list, list) {
@@ -14126,19 +14132,20 @@ static int init_asic_data(struct hfi1_devdata *dd) }if (peer) { +/* use already allocated structure */ dd->asic_data = peer->asic_data; +kfree (asic_data); }else { - dd->asic_data =kzalloc (sizeof (*dd->asic_data),GFP_KERNEL ); -if (!dd->asic_data) { - ret = -ENOMEM ; - goto done; - } + dd->asic_data = asic_data;mutex_init (&dd->asic_data->asic_resource_mutex); } dd->asic_data->dds[dd->hfi1_id] = dd;/* self back-pointer */ - -done:spin_unlock_irqrestore (&hfi1_devs_lock, flags); + +/* first one through - set up i2c devices */ +if (!peer) + ret =set_up_i2c (dd, dd->asic_data); +return ret; }
--
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 2/2] IB/hfi1: Fix sleep inside atomic issue in init_asic_data
In reply to a message not in the archiveICAgICBUaGFua3MgZm9yIGdldHRpbmcgdGhpcyBpc3N1ZSBmaXhlZC4gIE9uZSBjb21tZW50IGJl bG93Lg0KDQpPbiA3LzEvMTYsIDM6NTcgUE0sICJsaW51eC1yZG1hLW93bmVyQHZnZXIua2VybmVs Lm9yZyBvbiBiZWhhbGYgb2YgRGV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w Pw0KDQogICAgIEppbQ0KDQo+Kw0KPiAJcmV0dXJuIHJldDsNCj4gfQ0KPiANCj4NCj4tLQ0KPlRv IHVuc3Vic2NyaWJlIGZyb20gdGhpcyBsaXN0OiBzZW5kIHRoZSBsaW5lICJ1bnN1YnNjcmliZSBs aW51eC1yZG1hIiBpbg0KPnRoZSBib2R5IG9mIGEgbWVzc2FnZSB0byBtYWpvcmRvbW9Admdlci5r ZXJuZWwub3JnDQo+TW9yZSBtYWpvcmRvbW8gaW5mbyBhdCAgaHR0cDovL3ZnZXIua2VybmVsLm9y Zy9tYWpvcmRvbW8taW5mby5odG1sDQo+DQoNCg0K
--
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
Quoted 19 lines · Dennis Dalessandro
Doug,
Here are two more patches for the 4.7 RC if possible. One Mike has marked as stable.
These apply on the RC-5 tree and should apply to your trees without any issue.
Patches can also be viewed in my repo at:
https://github.com/ddalessa/kernel/tree/for-4.7---
Mike Marciniszyn (1):
IB/hfi1: Correct issues with sc5 computationTadeusz Struk (1):
IB/hfi1: Fix sleep inside atomic issue ininit_asic_data
Quoted 7 lines
drivers/infiniband/hw/hfi1/chip.c | 21 ++++++++++++++------- drivers/infiniband/hw/hfi1/ud.c | 23 +++-------------------- 2 files changed, 17 insertions(+), 27 deletions(-)--
-Denny
I applied the 1/2 patch from this series, and the v3, 2/2 patch from Mike.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD