stable.vger.kernel.org archive mirror
 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,
	Maggie Mae Roxas <maggie.mae.roxas@gmail.com>,
	Willy Tarreau <w@1wt.eu>, "David S. Miller" <davem@davemloft.net>
Subject: [PATCH 3.18 05/19] net: mvneta: fix Tx interrupt delay
Date: Sun, 14 Dec 2014 12:21:16 -0800	[thread overview]
Message-ID: <20141214201823.697566508@linuxfoundation.org> (raw)
In-Reply-To: <20141214201823.543296369@linuxfoundation.org>

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

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

From: willy tarreau <w@1wt.eu>

[ Upstream commit aebea2ba0f7495e1a1c9ea5e753d146cb2f6b845 ]

The mvneta driver sets the amount of Tx coalesce packets to 16 by
default. Normally that does not cause any trouble since the driver
uses a much larger Tx ring size (532 packets). But some sockets
might run with very small buffers, much smaller than the equivalent
of 16 packets. This is what ping is doing for example, by setting
SNDBUF to 324 bytes rounded up to 2kB by the kernel.

The problem is that there is no documented method to force a specific
packet to emit an interrupt (eg: the last of the ring) nor is it
possible to make the NIC emit an interrupt after a given delay.

In this case, it causes trouble, because when ping sends packets over
its raw socket, the few first packets leave the system, and the first
15 packets will be emitted without an IRQ being generated, so without
the skbs being freed. And since the socket's buffer is small, there's
no way to reach that amount of packets, and the ping ends up with
"send: no buffer available" after sending 6 packets. Running with 3
instances of ping in parallel is enough to hide the problem, because
with 6 packets per instance, that's 18 packets total, which is enough
to grant a Tx interrupt before all are sent.

The original driver in the LSP kernel worked around this design flaw
by using a software timer to clean up the Tx descriptors. This timer
was slow and caused terrible network performance on some Tx-bound
workloads (such as routing) but was enough to make tools like ping
work correctly.

Instead here, we simply set the packet counts before interrupt to 1.
This ensures that each packet sent will produce an interrupt. NAPI
takes care of coalescing interrupts since the interrupt is disabled
once generated.

No measurable performance impact nor CPU usage were observed on small
nor large packets, including when saturating the link on Tx, and this
fixes tools like ping which rely on too small a send buffer. If one
wants to increase this value for certain workloads where it is safe
to do so, "ethtool -C $dev tx-frames" will override this default
setting.

This fix needs to be applied to stable kernels starting with 3.10.

Tested-By: Maggie Mae Roxas <maggie.mae.roxas@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/marvell/mvneta.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -216,7 +216,7 @@
 /* Various constants */
 
 /* Coalescing */
-#define MVNETA_TXDONE_COAL_PKTS		16
+#define MVNETA_TXDONE_COAL_PKTS		1
 #define MVNETA_RX_COAL_PKTS		32
 #define MVNETA_RX_COAL_USEC		100
 



  parent reply	other threads:[~2014-12-14 20:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14 20:21 [PATCH 3.18 00/19] 3.18.1-stable review Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 01/19] Fix race condition between vxlan_sock_add and vxlan_sock_release Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 02/19] gre: Set inner mac header in gro complete Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 03/19] openvswitch: Fix flow mask validation Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 04/19] mips: bpf: Fix broken BPF_MOD Greg Kroah-Hartman
2014-12-14 20:21 ` Greg Kroah-Hartman [this message]
2014-12-14 20:21 ` [PATCH 3.18 06/19] net: mvneta: fix race condition in mvneta_tx() Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 08/19] tcp: fix more NULL deref after prequeue changes Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 09/19] xen-netfront: use correct linear area after linearizing an skb Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 10/19] net: fix suspicious rcu_dereference_check in net/sched/sch_fq_codel.c Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 11/19] netlink: use jhash as hashfn for rhashtable Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 12/19] rtlwifi: rtl8192ce: Fix editing error that causes silent memory corruption Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 13/19] rtlwifi: rtl8192ce: Fix kernel crashes due to missing callback entry Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 14/19] rtlwifi: rtl8192ce: Fix missing interrupt ready flag Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 15/19] move d_rcu from overlapping d_child to overlapping d_alias Greg Kroah-Hartman
2014-12-15 15:46   ` Josh Boyer
2014-12-15 16:34     ` Greg Kroah-Hartman
2014-12-15 16:38       ` Josh Boyer
2014-12-15 21:21         ` Josh Boyer
2014-12-15 21:34           ` Al Viro
2014-12-15 21:44             ` Josh Boyer
2014-12-16 13:25               ` Josh Boyer
2014-12-15 21:33     ` Al Viro
2014-12-14 20:21 ` [PATCH 3.18 16/19] deal with deadlock in d_walk() Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 17/19] ALSA: hda - Add EAPD fixup for ASUS Z99He laptop Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 18/19] ALSA: hda - Fix built-in mic at resume on Lenovo Ideapad S210 Greg Kroah-Hartman
2014-12-14 20:21 ` [PATCH 3.18 19/19] ALSA: usb-audio: Dont resubmit pending URBs at MIDI error recovery Greg Kroah-Hartman
2014-12-15  3:33 ` [PATCH 3.18 00/19] 3.18.1-stable review Guenter Roeck
2014-12-15  4:24   ` Greg Kroah-Hartman
2014-12-16  3:08 ` Shuah Khan
2014-12-16 16:12   ` 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=20141214201823.697566508@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maggie.mae.roxas@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=w@1wt.eu \
    /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 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).