Re: [PATCH 1/1] tcp: Honor the eor bit in tcp_mtu_probe

2018-02-06 Thread kbuild test robot
Hi Ilya,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on v4.15 next-20180206]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ilya-Lesokhin/tcp-Honor-the-eor-bit-in-tcp_mtu_probe/20180207-045040
config: i386-randconfig-x007-201805 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   In file included from include/linux/tcp.h:21:0,
from include/net/tcp.h:24,
from net//ipv4/tcp_output.c:39:
   net//ipv4/tcp_output.c: In function 'tcp_write_xmit':
>> include/linux/skbuff.h:3196:12: warning: 'skb' may be used uninitialized in 
>> this function [-Wmaybe-uninitialized]
  for (tmp = skb->next;  \
   ^
   net//ipv4/tcp_output.c:2043:18: note: 'skb' was declared here
 struct sk_buff *skb, *nskb, *next;
 ^~~
--
   In file included from include/linux/tcp.h:21:0,
from include/net/tcp.h:24,
from net/ipv4/tcp_output.c:39:
   net/ipv4/tcp_output.c: In function 'tcp_write_xmit':
>> include/linux/skbuff.h:3196:12: warning: 'skb' may be used uninitialized in 
>> this function [-Wmaybe-uninitialized]
  for (tmp = skb->next;  \
   ^
   net/ipv4/tcp_output.c:2043:18: note: 'skb' was declared here
 struct sk_buff *skb, *nskb, *next;
 ^~~

vim +/skb +3196 include/linux/skbuff.h

18a4c0eab Eric Dumazet2017-10-05  3168  
^1da177e4 Linus Torvalds  2005-04-16  3169  #define skb_queue_walk(queue, skb) \
^1da177e4 Linus Torvalds  2005-04-16  3170  for (skb = 
(queue)->next;   \
a1e4891fd Linus Torvalds  2011-05-22  3171   skb != (struct 
sk_buff *)(queue);  \
^1da177e4 Linus Torvalds  2005-04-16  3172   skb = skb->next)
^1da177e4 Linus Torvalds  2005-04-16  3173  
46f8914e5 James Chapman   2007-04-30  3174  #define skb_queue_walk_safe(queue, 
skb, tmp)\
46f8914e5 James Chapman   2007-04-30  3175  for (skb = 
(queue)->next, tmp = skb->next;  \
46f8914e5 James Chapman   2007-04-30  3176   skb != (struct 
sk_buff *)(queue);  \
46f8914e5 James Chapman   2007-04-30  3177   skb = tmp, tmp = 
skb->next)
46f8914e5 James Chapman   2007-04-30  3178  
1164f52a2 David S. Miller 2008-09-23  3179  #define skb_queue_walk_from(queue, 
skb) \
a1e4891fd Linus Torvalds  2011-05-22  3180  for (; skb != (struct 
sk_buff *)(queue);\
1164f52a2 David S. Miller 2008-09-23  3181   skb = skb->next)
1164f52a2 David S. Miller 2008-09-23  3182  
18a4c0eab Eric Dumazet2017-10-05  3183  #define skb_rbtree_walk(skb, root)  
\
18a4c0eab Eric Dumazet2017-10-05  3184  for (skb = 
skb_rb_first(root); skb != NULL; \
18a4c0eab Eric Dumazet2017-10-05  3185   skb = 
skb_rb_next(skb))
18a4c0eab Eric Dumazet2017-10-05  3186  
18a4c0eab Eric Dumazet2017-10-05  3187  #define skb_rbtree_walk_from(skb)   
\
18a4c0eab Eric Dumazet2017-10-05  3188  for (; skb != NULL; 
\
18a4c0eab Eric Dumazet2017-10-05  3189   skb = 
skb_rb_next(skb))
18a4c0eab Eric Dumazet2017-10-05  3190  
18a4c0eab Eric Dumazet2017-10-05  3191  #define 
skb_rbtree_walk_from_safe(skb, tmp) \
18a4c0eab Eric Dumazet2017-10-05  3192  for (; tmp = skb ? 
skb_rb_next(skb) : NULL, (skb != NULL);  \
18a4c0eab Eric Dumazet2017-10-05  3193   skb = tmp)
18a4c0eab Eric Dumazet2017-10-05  3194  
1164f52a2 David S. Miller 2008-09-23  3195  #define 
skb_queue_walk_from_safe(queue, skb, tmp)   \
1164f52a2 David S. Miller 2008-09-23 @3196  for (tmp = skb->next;   
\
1164f52a2 David S. Miller 2008-09-23  3197   skb != (struct 
sk_buff *)(queue);  \
1164f52a2 David S. Miller 2008-09-23  3198   skb = tmp, tmp = 
skb->next)
1164f52a2 David S. Miller 2008-09-23  3199  

:: The code at line 3196 was first introduced by commit
:: 1164f52a244204830c7625b3c22812781996d7b4 net: Add skb_queue_walk_from() 
and skb_queue_walk_from_safe().

:: TO: David 

Re: [PATCH 1/1] tcp: Honor the eor bit in tcp_mtu_probe

2018-02-05 Thread Eric Dumazet
On Mon, 2018-02-05 at 07:52 -0800, Eric Dumazet wrote:
> On Mon, 2018-02-05 at 17:11 +0200, Ilya Lesokhin wrote:
> > Avoid SKB coalescing if eor bit is set in one of the relevant
> > SKBs.
> > 
> > Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
> > Signed-off-by: Ilya Lesokhin 
> > ---
> 
> Reviewed-by: Eric Dumazet 
> 
> Thanks.


I am taking this approval back.

You missed an eor propagation if it is in the last skb that is copied
to the new skb.

Something like this added to your patch :

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 
e9f985e42405a38fc95980da5debb7ac8b51fbb5..87c2ff458f7528ee3cd3e5e1154375a906c1bc67
 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2134,6 +2134,7 @@ static int tcp_mtu_probe(struct sock *sk)
    /* We've eaten all the data from this skb.
     * Throw it away. */
    TCP_SKB_CB(nskb)->tcp_flags |= 
TCP_SKB_CB(skb)->tcp_flags;
+   TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor;
    tcp_unlink_write_queue(skb, sk);
    sk_wmem_free_skb(sk, skb);
    } else {


Re: [PATCH 1/1] tcp: Honor the eor bit in tcp_mtu_probe

2018-02-05 Thread Eric Dumazet
On Mon, 2018-02-05 at 17:11 +0200, Ilya Lesokhin wrote:
> Avoid SKB coalescing if eor bit is set in one of the relevant
> SKBs.
> 
> Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
> Signed-off-by: Ilya Lesokhin 
> ---

Reviewed-by: Eric Dumazet 

Thanks.



[PATCH 1/1] tcp: Honor the eor bit in tcp_mtu_probe

2018-02-05 Thread Ilya Lesokhin
Avoid SKB coalescing if eor bit is set in one of the relevant
SKBs.

Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
Signed-off-by: Ilya Lesokhin 
---
 net/ipv4/tcp_output.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e9f985e42405..c8cc679f1779 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2099,6 +2099,17 @@ static int tcp_mtu_probe(struct sock *sk)
return 0;
}
 
+   len = probe_size;
+   tcp_for_write_queue_from_safe(skb, next, sk) {
+   if (len <= skb->len)
+   break;
+
+   if (unlikely(TCP_SKB_CB(skb)->eor))
+   return -1;
+
+   len -= skb->len;
+   }
+
/* We're allowed to probe.  Build it now. */
nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false);
if (!nskb)
-- 
2.15.0.317.g14c63a9