All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Potnuri Bharat Teja <bharat@chelsio.com>,
	Steve Wise <swise@opengridcomputing.com>,
	Doug Ledford <dledford@redhat.com>
Subject: [PATCH 4.16 29/52] iw_cxgb4: Atomically flush per QP HW CQEs
Date: Tue,  8 May 2018 10:10:27 +0200	[thread overview]
Message-ID: <20180508073932.083988972@linuxfoundation.org> (raw)
In-Reply-To: <20180508073928.058320984@linuxfoundation.org>

4.16-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bharat Potnuri <bharat@chelsio.com>

commit 2df19e19ae90d94fd8724083f161f368a2797537 upstream.

When a CQ is shared by multiple QPs, c4iw_flush_hw_cq() needs to acquire
corresponding QP lock before moving the CQEs into its corresponding SW
queue and accessing the SQ contents for completing a WR.
Ignore CQEs if corresponding QP is already flushed.

Cc: stable@vger.kernel.org
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/cxgb4/cq.c       |   11 ++++++++++-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h |    2 +-
 drivers/infiniband/hw/cxgb4/qp.c       |    4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -315,7 +315,7 @@ static void advance_oldest_read(struct t
  * Deal with out-of-order and/or completions that complete
  * prior unsignalled WRs.
  */
-void c4iw_flush_hw_cq(struct c4iw_cq *chp)
+void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp)
 {
 	struct t4_cqe *hw_cqe, *swcqe, read_cqe;
 	struct c4iw_qp *qhp;
@@ -339,6 +339,13 @@ void c4iw_flush_hw_cq(struct c4iw_cq *ch
 		if (qhp == NULL)
 			goto next_cqe;
 
+		if (flush_qhp != qhp) {
+			spin_lock(&qhp->lock);
+
+			if (qhp->wq.flushed == 1)
+				goto next_cqe;
+		}
+
 		if (CQE_OPCODE(hw_cqe) == FW_RI_TERMINATE)
 			goto next_cqe;
 
@@ -390,6 +397,8 @@ void c4iw_flush_hw_cq(struct c4iw_cq *ch
 next_cqe:
 		t4_hwcq_consume(&chp->cq);
 		ret = t4_next_hw_cqe(&chp->cq, &hw_cqe);
+		if (qhp && flush_qhp != qhp)
+			spin_unlock(&qhp->lock);
 	}
 }
 
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -1053,7 +1053,7 @@ u32 c4iw_pblpool_alloc(struct c4iw_rdev
 void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size);
 u32 c4iw_ocqp_pool_alloc(struct c4iw_rdev *rdev, int size);
 void c4iw_ocqp_pool_free(struct c4iw_rdev *rdev, u32 addr, int size);
-void c4iw_flush_hw_cq(struct c4iw_cq *chp);
+void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp);
 void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count);
 int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp);
 int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count);
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1343,12 +1343,12 @@ static void __flush_qp(struct c4iw_qp *q
 	qhp->wq.flushed = 1;
 	t4_set_wq_in_error(&qhp->wq);
 
-	c4iw_flush_hw_cq(rchp);
+	c4iw_flush_hw_cq(rchp, qhp);
 	c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
 	rq_flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
 
 	if (schp != rchp)
-		c4iw_flush_hw_cq(schp);
+		c4iw_flush_hw_cq(schp, qhp);
 	sq_flushed = c4iw_flush_sq(qhp);
 
 	spin_unlock(&qhp->lock);

  parent reply	other threads:[~2018-05-08  8:10 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08  8:09 [PATCH 4.16 00/52] 4.16.8-stable review Greg Kroah-Hartman
2018-05-08  8:09 ` [PATCH 4.16 01/52] ACPI / button: make module loadable when booted in non-ACPI mode Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 02/52] arm64: Add work around for Arm Cortex-A55 Erratum 1024718 Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 03/52] ALSA: hda - Fix incorrect usage of IS_REACHABLE() Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 04/52] ALSA: pcm: Check PCM state at xfern compat ioctl Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 05/52] ALSA: seq: Fix races at MIDI encoding in snd_virmidi_output_trigger() Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 06/52] ALSA: dice: fix kernel NULL pointer dereference due to invalid calculation for array index Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 07/52] ALSA: aloop: Mark paused device as inactive Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 08/52] ALSA: aloop: Add missing cable lock to ctl API callbacks Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 09/52] errseq: Always report a writeback error once Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 10/52] tracepoint: Do not warn on ENOMEM Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 11/52] scsi: target: Fix fortify_panic kernel exception Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 12/52] Input: leds - fix out of bound access Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 13/52] Input: atmel_mxt_ts - add touchpad button mapping for Samsung Chromebook Pro Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 14/52] swiotlb: fix inversed DMA_ATTR_NO_WARN test Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 15/52] rtlwifi: cleanup 8723be ant_sel definition Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 16/52] xfs: prevent creating negative-sized file via INSERT_RANGE Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 17/52] tools: power/acpi, revert to LD = gcc Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 18/52] RDMA/cxgb4: release hw resources on device removal Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 19/52] RDMA/ucma: Allow resolving address w/o specifying source address Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 20/52] RDMA/mlx5: Fix multiple NULL-ptr deref errors in rereg_mr flow Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 21/52] RDMA/mlx4: Add missed RSS hash inner header flag Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 22/52] RDMA/mlx5: Protect from shift operand overflow Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 23/52] NET: usb: qmi_wwan: add support for ublox R410M PID 0x90b2 Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 24/52] IB/mlx5: Use unlimited rate when static rate is not supported Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 25/52] infiniband: mlx5: fix build errors when INFINIBAND_USER_ACCESS=m Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 26/52] IB/hfi1: Fix handling of FECN marked multicast packet Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 27/52] IB/hfi1: Fix loss of BECN with AHG Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 28/52] IB/hfi1: Fix NULL pointer dereference when invalid num_vls is used Greg Kroah-Hartman
2018-05-08  8:10 ` Greg Kroah-Hartman [this message]
2018-05-08  8:10 ` [PATCH 4.16 30/52] btrfs: Take trans lock before access running trans in check_delayed_ref Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 31/52] drm/vc4: Make sure vc4_bo_{inc,dec}_usecnt() calls are balanced Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 32/52] drm/vmwgfx: Fix a buffer object leak Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 33/52] drm/bridge: vga-dac: Fix edid memory leak Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 34/52] test_firmware: fix setting old custom fw path back on exit, second try Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 35/52] xhci: Fix use-after-free in xhci_free_virt_device Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 36/52] USB: serial: visor: handle potential invalid device configuration Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 37/52] usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeue Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 38/52] USB: Accept bulk endpoints with 1024-byte maxpacket Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 39/52] USB: serial: option: reimplement interface masking Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 40/52] USB: serial: option: adding support for ublox R410M Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 41/52] usb: musb: host: fix potential NULL pointer dereference Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 42/52] usb: musb: trace: fix NULL pointer dereference in musb_g_tx() Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 43/52] platform/x86: asus-wireless: Fix NULL pointer dereference Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 44/52] platform/x86: Kconfig: Fix dell-laptop dependency chain Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 45/52] KVM: x86: remove APIC Timer periodic/oneshot spikes Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 46/52] x86/tsc: Always unregister clocksource_tsc_early Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 47/52] x86/tsc: Fix mark_tsc_unstable() Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 48/52] irqchip/qcom: Fix check for spurious interrupts Greg Kroah-Hartman
2018-05-08  8:10   ` Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 49/52] clocksource: Allow clocksource_mark_unstable() on unregistered clocksources Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 50/52] clocksource: Initialize cs->wd_list Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 51/52] clocksource: Consistent de-rate when marking unstable Greg Kroah-Hartman
2018-05-08  8:10 ` [PATCH 4.16 52/52] tracing: Fix bad use of igrab in trace_uprobe.c Greg Kroah-Hartman
2018-05-08 15:45 ` [PATCH 4.16 00/52] 4.16.8-stable review kernelci.org bot
2018-05-08 16:22 ` Guenter Roeck
2018-05-08 17:52   ` Greg Kroah-Hartman
2018-05-08 17:56 ` Naresh Kamboju
2018-05-08 18:48   ` Greg Kroah-Hartman
2018-05-08 23:53 ` Shuah Khan
2018-05-09  7:32   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180508073932.083988972@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bharat@chelsio.com \
    --cc=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=swise@opengridcomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.