All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Rausch <gerd.rausch@oracle.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <alexander.levin@microsoft.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org
Subject: [PATCH 2.6.26-4.14] IB/ipoib: Arm "send_cq" to process completions in due time
Date: Fri, 12 Jun 2020 12:41:16 -0700	[thread overview]
Message-ID: <322533b0-17de-b6b2-7da4-f99c7dfce3a8@oracle.com> (raw)

This issue appears to only exist in Linux versions
2.6.26 through 4.14 inclusively:

With the introduction of commit
f56bcd8013566 ("IPoIB: Use separate CQ for UD send completions")

work completions are only processed once there are
more than 17 outstanding TX work requests.

Unfortunately, that also delays the processing of the
completion handler and holds on to references
held by the "skb" since "dev_kfree_skb_any"
won't be called for a very long time.

E.g. we've observed "nf_conntrack_cleanup_net_list" spin
     around for hours until "net->ct.count" goes down to zero
     on a sufficiently idle interface.

This fix arms the TX CQ after those "poll_tx" loops,
in order for "ipoib_send_comp_handler" to do its thing:

While it's obvious that processing completions one-by-one
is more costly than doing so in bulk,
holding on to "skb" resources for a potentially unlimited
amount of time appears to be a less favorable trade-off.

This issue appears to no longer exist in Linux-4.15
and younger, because the following commit does
call "ib_req_notify_cq" on "send_cq":
8966e28d2e40c ("IB/ipoib: Use NAPI in UD/TX flows")

Fixes: f56bcd8013566 ("IPoIB: Use separate CQ for UD send completions")

Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 18f732aa15101..b26b31b9e455e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -491,8 +491,13 @@ static void drain_tx_cq(struct net_device *dev)
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 
 	netif_tx_lock(dev);
-	while (poll_tx(priv))
-		; /* nothing */
+
+	do {
+		while (poll_tx(priv))
+			; /* nothing */
+	} while (ib_req_notify_cq(priv->send_cq,
+				  IB_CQ_NEXT_COMP |
+				  IB_CQ_REPORT_MISSED_EVENTS) > 0);
 
 	if (netif_queue_stopped(dev))
 		mod_timer(&priv->poll_timer, jiffies + 1);
@@ -628,9 +633,14 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
 		++priv->tx_head;
 	}
 
-	if (unlikely(priv->tx_outstanding > MAX_SEND_CQE))
-		while (poll_tx(priv))
-			; /* nothing */
+	if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) {
+		do {
+			while (poll_tx(priv))
+				; /* nothing */
+		} while (ib_req_notify_cq(priv->send_cq,
+					  IB_CQ_NEXT_COMP |
+					  IB_CQ_REPORT_MISSED_EVENTS) > 0);
+	}
 }
 
 static void __ipoib_reap_ah(struct net_device *dev)
-- 
2.24.1


             reply	other threads:[~2020-06-12 19:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 19:41 Gerd Rausch [this message]
2020-06-12 19:55 ` [PATCH 2.6.26-4.14] IB/ipoib: Arm "send_cq" to process completions in due time Jason Gunthorpe
2020-06-12 20:44   ` Gerd Rausch
2020-06-16 12:08     ` Greg Kroah-Hartman
2020-06-16 16:35       ` Gerd Rausch
2020-06-17  5:03         ` Leon Romanovsky
2020-07-13 14:53           ` Greg Kroah-Hartman
2020-07-14  7:02             ` Leon Romanovsky

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=322533b0-17de-b6b2-7da4-f99c7dfce3a8@oracle.com \
    --to=gerd.rausch@oracle.com \
    --cc=alexander.levin@microsoft.com \
    --cc=dledford@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hal.rosenstock@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.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.