netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
To: Cedric Le Goater <clg@fr.ibm.com>, David Miller <davem@davemloft.net>
Cc: Netdev <netdev@vger.kernel.org>
Subject: [PATCH net-2.6.24] [TCP]: Fix fastpath_cnt_hint when GSO skb is partially ACKed
Date: Thu, 4 Oct 2007 23:20:34 +0300 (EEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710041911400.17326@kivilampi-30.cs.helsinki.fi> (raw)
In-Reply-To: <4704FE75.2030104@fr.ibm.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2784 bytes --]

On Thu, 4 Oct 2007, Cedric Le Goater wrote:

> so here are the results on a net-2.6.24 kernel. 
> 
> I've put the patchset here to make sure it's correct: 
> 
> 	http://legoater.free.fr/patches/2.6.23/net-2.6.24.git-tcp_fastretrans/
> 
> and plenty of logs :
> 
> 	http://legoater.free.fr/patches/2.6.23/net-2.6.24.git-tcp_fastretrans.messages

Thanks a lot, the bug itself seems to occur far more common than I 
thought... It just very rarely manifests in significant behavior (requires 
non-trivial ACK/SACK pattern to occur). This same bug is present in the 
soon to be released 2.6.23 and in stable too though it's nearly impossible 
to ever see that by human eye and there's a silent fackets_out "fix up" in 
place due to known (and intentional) fackets_out inaccuracy (and nobody is 
really looking that large number of TCP traces)...

The fix below, you can test it with the debug patch quite easily, all 
those messages should of course vanish :-). In case you want to 
test, please mix those three patches (fixes a real bug too), this one and 
the debug patch together...

Dave should apply both the three patch series fix and this one as well to 
net-2.6.24 (Dave, in case you want me to resubmit, just ask... :-)). I'll 
send one against .23-rc9 soon after this (sadly enough, it will cause a 
conflict...).

-- 
 i.


[PATCH net-2.6.24] [TCP]: Fix fastpath_cnt_hint when GSO skb is partially ACKed

I used to be under impression that all hints are cleared in
clean_rtx_queue whenever cumulative ACKs occur. Yet, when only
GSO skb was partially ACKed, no hints were reset, therefore
fastpath_cnt_hint must be tweaked too or else it can corrupt
fackets_out. In case there was also a skb that got fully ACKed,
the fastpath_skb_hint is set to NULL which causes a recount for 
fastpath_cnt_hint (the old value won't be accessed anymore),
thus it can safely be decremented without additional checking.

Reported by Cedric Le Goater <clg@fr.ibm.com>, two other bugs
have been already found and patched due to that report, and
third one (unrelated to this fix) is under evaluation
currently :-)...

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/tcp_input.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 87c9ef5..4268cd1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2674,6 +2674,9 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
 		tcp_rearm_rto(sk);
 
 		tp->fackets_out -= min(pkts_acked, tp->fackets_out);
+		/* hint's skb might be NULL but we don't need to care */
+		tp->fastpath_cnt_hint -= min_t(u32, pkts_acked,
+					       tp->fastpath_cnt_hint);
 		if (tcp_is_reno(tp))
 			tcp_remove_reno_sacks(sk, pkts_acked);
 
-- 
1.5.0.6

  reply	other threads:[~2007-10-04 20:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03 11:00 [PATCH net-2.6.24 0/3]: More TCP fixes Ilpo Järvinen
2007-10-03 11:00 ` [PATCH 1/3] [TCP]: Fix two off-by-one errors in fackets_out adjusting logic Ilpo Järvinen
2007-10-03 11:00   ` [PATCH 2/3] [TCP]: Comment fastpath_cnt_hint off-by-one trap Ilpo Järvinen
2007-10-03 11:00     ` [PATCH 3/3] [TCP]: "Annotate" another fackets_out state reset Ilpo Järvinen
2007-10-08  6:38       ` David Miller
2007-10-08  6:37     ` [PATCH 2/3] [TCP]: Comment fastpath_cnt_hint off-by-one trap David Miller
2007-10-08  6:36   ` [PATCH 1/3] [TCP]: Fix two off-by-one errors in fackets_out adjusting logic David Miller
2007-10-03 11:58 ` [PATCH net-2.6.24 0/3]: More TCP fixes Cedric Le Goater
2007-10-03 12:34   ` Ilpo Järvinen
2007-10-03 12:48     ` Cedric Le Goater
2007-10-03 13:19       ` Ilpo Järvinen
2007-10-03 14:05         ` Cedric Le Goater
2007-10-03 14:22           ` Ilpo Järvinen
2007-10-03 14:58             ` Cedric Le Goater
2007-10-03 14:59               ` Cedric Le Goater
2007-10-03 15:12               ` Cedric Le Goater
2007-10-04 10:13                 ` Ilpo Järvinen
2007-10-04 14:53                   ` Cedric Le Goater
2007-10-04 20:20                     ` Ilpo Järvinen [this message]
2007-10-08  6:39                       ` [PATCH net-2.6.24] [TCP]: Fix fastpath_cnt_hint when GSO skb is partially ACKed David Miller

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=Pine.LNX.4.64.0710041911400.17326@kivilampi-30.cs.helsinki.fi \
    --to=ilpo.jarvinen@helsinki.fi \
    --cc=clg@fr.ibm.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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).