stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9
@ 2016-09-25 14:40 Dennis Dalessandro
  2016-09-25 14:41 ` [PATCH 08/13] IB/hfi1: Fix defered ack race with qp destroy Dennis Dalessandro
  2016-10-02 13:29 ` [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9 Doug Ledford
  0 siblings, 2 replies; 3+ messages in thread
From: Dennis Dalessandro @ 2016-09-25 14:40 UTC (permalink / raw)
  To: dledford
  Cc: Mike Marciniszyn, Dean Luick, Jakub Pawlak, linux-rdma, Ira Weiny,
	stable, Harish Chegondi, Sebastian Sanchez, Jianxin Xiong

Here is the next round of fixes and clean ups for hfi1/qib for 4.9. Mostly minor
fixes but there is a fix for stable in here. It is marked to Cc the stable list
in the commit message so no special handling should be needed on your part.

Patches should apply on your GitHub hfi1 branch and are availabe in my GitRepo as
well:
https://github.com/ddalessa/kernel/tree/for-4.9

---

Dean Luick (2):
      IB/hfi1: Extend i2c timeout
      IB/hfi1: Act on external device timeout

Dennis Dalessandro (3):
      IB/qib: Remove qpt_mask global
      IB/hfi1: Cleanup tasklet refs in comments
      IB/hfi1: Remove unused variable from devdata

Harish Chegondi (1):
      IB/hfi1: Adjust hardware buffering parameter

Jakub Pawlak (1):
      IB/hfi1: Fix resource release in context allocation

Jianxin Xiong (1):
      IB/hfi1: Increase default settings of max_cqes and max_qps

Mike Marciniszyn (2):
      IB/hfi1: Consolidate pio control masks into single definition
      IB/hfi1: Fix defered ack race with qp destroy

Sebastian Sanchez (3):
      IB/hfi1: Remove filtering of Set(PkeyTable) in HFI SMA
      IB/hfi1: Do not read more than a SGE length
      IB/hfi1: Combine shift copy and byte copy for SGE reads


 drivers/infiniband/hw/hfi1/chip.c     |    8 +
 drivers/infiniband/hw/hfi1/chip.h     |    6 +
 drivers/infiniband/hw/hfi1/file_ops.c |   17 ++
 drivers/infiniband/hw/hfi1/hfi.h      |    2 
 drivers/infiniband/hw/hfi1/init.c     |    1 
 drivers/infiniband/hw/hfi1/mad.c      |    6 -
 drivers/infiniband/hw/hfi1/pio_copy.c |  246 ++++++++-------------------------
 drivers/infiniband/hw/hfi1/qsfp.c     |    2 
 drivers/infiniband/hw/hfi1/rc.c       |   33 ++--
 drivers/infiniband/hw/hfi1/ruc.c      |    6 -
 drivers/infiniband/hw/hfi1/uc.c       |    9 -
 drivers/infiniband/hw/hfi1/verbs.c    |   40 ++++-
 drivers/infiniband/hw/hfi1/verbs.h    |    3 
 drivers/infiniband/hw/qib/qib.h       |    1 
 drivers/infiniband/hw/qib/qib_qp.c    |   13 --
 drivers/infiniband/hw/qib/qib_verbs.c |    2 
 16 files changed, 136 insertions(+), 259 deletions(-)

--
-Denny

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 08/13] IB/hfi1: Fix defered ack race with qp destroy
  2016-09-25 14:40 [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9 Dennis Dalessandro
@ 2016-09-25 14:41 ` Dennis Dalessandro
  2016-10-02 13:29 ` [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9 Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Dennis Dalessandro @ 2016-09-25 14:41 UTC (permalink / raw)
  To: dledford; +Cc: linux-rdma, Mike Marciniszyn, stable

From: Mike Marciniszyn <mike.marciniszyn@intel.com>

There is a a bug in defered ack stuff that causes a race with the
destroy of a QP.

A packet causes a defered ack to be pended by putting the QP
into an rcd queue.

A return from the driver interrupt processing will process that rcd
queue of QPs and attempt to do a direct send of the ack.   At this
point no locks are held and the above QP could now be put in the reset
state in the qp destroy logic.   A refcount protects the QP while it
is in the rcd queue so it isn't going anywhere yet.

If the direct send fails to allocate a pio buffer,
hfi1_schedule_send() is called to trigger sending an ack from the
send engine. There is no state test in that code path.

The refcount is then dropped from the driver.c caller
potentially allowing the qp destroy to continue from its
refcount wait in parallel with the workqueue scheduling of the qp.

Cc: stable@vger.kernel.org
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/rc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index d32f0c8..e9623d0 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -926,8 +926,10 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,
 	return;
 
 queue_ack:
-	this_cpu_inc(*ibp->rvp.rc_qacks);
 	spin_lock_irqsave(&qp->s_lock, flags);
+	if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK))
+		goto unlock;
+	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;
 	qp->s_ack_psn = qp->r_ack_psn;
@@ -936,6 +938,7 @@ queue_ack:
 
 	/* Schedule the send tasklet. */
 	hfi1_schedule_send(qp);
+unlock:
 	spin_unlock_irqrestore(&qp->s_lock, flags);
 }
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9
  2016-09-25 14:40 [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9 Dennis Dalessandro
  2016-09-25 14:41 ` [PATCH 08/13] IB/hfi1: Fix defered ack race with qp destroy Dennis Dalessandro
@ 2016-10-02 13:29 ` Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2016-10-02 13:29 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: Mike Marciniszyn, Dean Luick, Jakub Pawlak, linux-rdma, Ira Weiny,
	stable, Harish Chegondi, Sebastian Sanchez, Jianxin Xiong


[-- Attachment #1.1: Type: text/plain, Size: 1468 bytes --]

On 9/25/2016 10:40 AM, Dennis Dalessandro wrote:
> Here is the next round of fixes and clean ups for hfi1/qib for 4.9. Mostly minor
> fixes but there is a fix for stable in here. It is marked to Cc the stable list
> in the commit message so no special handling should be needed on your part.
> 
> Patches should apply on your GitHub hfi1 branch and are availabe in my GitRepo as
> well:
> https://github.com/ddalessa/kernel/tree/for-4.9
> 
> ---
> 
> Dean Luick (2):
>       IB/hfi1: Extend i2c timeout
>       IB/hfi1: Act on external device timeout
> 
> Dennis Dalessandro (3):
>       IB/qib: Remove qpt_mask global
>       IB/hfi1: Cleanup tasklet refs in comments
>       IB/hfi1: Remove unused variable from devdata
> 
> Harish Chegondi (1):
>       IB/hfi1: Adjust hardware buffering parameter
> 
> Jakub Pawlak (1):
>       IB/hfi1: Fix resource release in context allocation
> 
> Jianxin Xiong (1):
>       IB/hfi1: Increase default settings of max_cqes and max_qps
> 
> Mike Marciniszyn (2):
>       IB/hfi1: Consolidate pio control masks into single definition
>       IB/hfi1: Fix defered ack race with qp destroy
> 
> Sebastian Sanchez (3):
>       IB/hfi1: Remove filtering of Set(PkeyTable) in HFI SMA
>       IB/hfi1: Do not read more than a SGE length
>       IB/hfi1: Combine shift copy and byte copy for SGE reads

Thanks, series applied.

-- 
Doug Ledford <dledford@redhat.com>
    GPG Key ID: 0E572FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-02 13:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-25 14:40 [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9 Dennis Dalessandro
2016-09-25 14:41 ` [PATCH 08/13] IB/hfi1: Fix defered ack race with qp destroy Dennis Dalessandro
2016-10-02 13:29 ` [PATCH 00/13] IB/hfi1,qib: Round 2 of hfi1/qib fixes for 4.9 Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).