All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] tcp: disallow cwnd undo when switching congestion control
@ 2017-05-31 18:21 Yuchung Cheng
  2017-05-31 18:47 ` Stephen Hemminger
  2017-06-02 18:18 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Yuchung Cheng @ 2017-05-31 18:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, ncardwell, edumazet, soheil, Yuchung Cheng

When the sender switches its congestion control during loss
recovery, if the recovery is spurious then it may incorrectly
revert cwnd and ssthresh to the older values set by a previous
congestion control. Consider a congestion control (like BBR)
that does not use ssthresh and keeps it infinite: the connection
may incorrectly revert cwnd to an infinite value when switching
from BBR to another congestion control.

This patch fixes it by disallowing such cwnd undo operation
upon switching congestion control.  Note that undo_marker
is not reset s.t. the packets that were incorrectly marked
lost would be corrected. We only avoid undoing the cwnd in
tcp_undo_cwnd_reduction().

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_cong.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 6e3c512054a6..324c9bcc5456 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -180,6 +180,7 @@ void tcp_init_congestion_control(struct sock *sk)
 {
 	const struct inet_connection_sock *icsk = inet_csk(sk);
 
+	tcp_sk(sk)->prior_ssthresh = 0;
 	if (icsk->icsk_ca_ops->init)
 		icsk->icsk_ca_ops->init(sk);
 	if (tcp_ca_needs_ecn(sk))
-- 
2.13.0.219.gdb65acc882-goog

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

* Re: [PATCH net] tcp: disallow cwnd undo when switching congestion control
  2017-05-31 18:21 [PATCH net] tcp: disallow cwnd undo when switching congestion control Yuchung Cheng
@ 2017-05-31 18:47 ` Stephen Hemminger
  2017-05-31 19:47   ` Yuchung Cheng
  2017-06-02 18:18 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2017-05-31 18:47 UTC (permalink / raw)
  To: Yuchung Cheng; +Cc: davem, netdev, ncardwell, edumazet, soheil

On Wed, 31 May 2017 11:21:27 -0700
Yuchung Cheng <ycheng@google.com> wrote:

> When the sender switches its congestion control during loss
> recovery, if the recovery is spurious then it may incorrectly
> revert cwnd and ssthresh to the older values set by a previous
> congestion control. Consider a congestion control (like BBR)
> that does not use ssthresh and keeps it infinite: the connection
> may incorrectly revert cwnd to an infinite value when switching
> from BBR to another congestion control.
> 
> This patch fixes it by disallowing such cwnd undo operation
> upon switching congestion control.  Note that undo_marker
> is not reset s.t. the packets that were incorrectly marked
> lost would be corrected. We only avoid undoing the cwnd in
> tcp_undo_cwnd_reduction().
> 
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

That looks correct. Are there other values of congestion state
that should be reset?

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

* Re: [PATCH net] tcp: disallow cwnd undo when switching congestion control
  2017-05-31 18:47 ` Stephen Hemminger
@ 2017-05-31 19:47   ` Yuchung Cheng
  0 siblings, 0 replies; 4+ messages in thread
From: Yuchung Cheng @ 2017-05-31 19:47 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: David Miller, netdev, Neal Cardwell, Eric Dumazet, Soheil Hassas Yeganeh

On Wed, May 31, 2017 at 11:47 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Wed, 31 May 2017 11:21:27 -0700
> Yuchung Cheng <ycheng@google.com> wrote:
>
> > When the sender switches its congestion control during loss
> > recovery, if the recovery is spurious then it may incorrectly
> > revert cwnd and ssthresh to the older values set by a previous
> > congestion control. Consider a congestion control (like BBR)
> > that does not use ssthresh and keeps it infinite: the connection
> > may incorrectly revert cwnd to an infinite value when switching
> > from BBR to another congestion control.
> >
> > This patch fixes it by disallowing such cwnd undo operation
> > upon switching congestion control.  Note that undo_marker
> > is not reset s.t. the packets that were incorrectly marked
> > lost would be corrected. We only avoid undoing the cwnd in
> > tcp_undo_cwnd_reduction().
> >
> > Signed-off-by: Yuchung Cheng <ycheng@google.com>
> > Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> > Signed-off-by: Neal Cardwell <ncardwell@google.com>
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> That looks correct. Are there other values of congestion state
> that should be reset?
>
Nothing in particular comes up. We found this bug by internally
checking insane cwnd values on Google hosts. We might find more :-)

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

* Re: [PATCH net] tcp: disallow cwnd undo when switching congestion control
  2017-05-31 18:21 [PATCH net] tcp: disallow cwnd undo when switching congestion control Yuchung Cheng
  2017-05-31 18:47 ` Stephen Hemminger
@ 2017-06-02 18:18 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-06-02 18:18 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, ncardwell, edumazet, soheil

From: Yuchung Cheng <ycheng@google.com>
Date: Wed, 31 May 2017 11:21:27 -0700

> When the sender switches its congestion control during loss
> recovery, if the recovery is spurious then it may incorrectly
> revert cwnd and ssthresh to the older values set by a previous
> congestion control. Consider a congestion control (like BBR)
> that does not use ssthresh and keeps it infinite: the connection
> may incorrectly revert cwnd to an infinite value when switching
> from BBR to another congestion control.
> 
> This patch fixes it by disallowing such cwnd undo operation
> upon switching congestion control.  Note that undo_marker
> is not reset s.t. the packets that were incorrectly marked
> lost would be corrected. We only avoid undoing the cwnd in
> tcp_undo_cwnd_reduction().
> 
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks!

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

end of thread, other threads:[~2017-06-02 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 18:21 [PATCH net] tcp: disallow cwnd undo when switching congestion control Yuchung Cheng
2017-05-31 18:47 ` Stephen Hemminger
2017-05-31 19:47   ` Yuchung Cheng
2017-06-02 18:18 ` David Miller

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.