Re: [PATCH v3 net-next] tcp: Remove use of daddr_cache in tracepoint

2017-10-19 Thread David Miller
From: David Ahern 
Date: Tue, 17 Oct 2017 13:09:33 -0700

> Running perf in one window to capture tcp_retransmit_skb tracepoint:
> $ perf record -e tcp:tcp_retransmit_skb -a
> 
> And causing a retransmission on an active TCP session (e.g., dropping
> packets in the receiver, changing MTU on the interface to 500 and back
> to 1500) triggers a panic:
 ...
> Remove use of ipv6_pinfo in favor of data in sock_common.
> 
> Fixes: e086101b150a ("tcp: add a tracepoint for tcp retransmission")
> Signed-off-by: David Ahern 

This doesn't apply to net-next, please respin.

Thanks.


Re: [PATCH v3 net-next] tcp: Remove use of daddr_cache in tracepoint

2017-10-17 Thread Song Liu
> > Remove use of ipv6_pinfo in favor of data in sock_common.
> >
> > Fixes: e086101b150a ("tcp: add a tracepoint for tcp retransmission")
> > Signed-off-by: David Ahern 
> > ---
>
> Reviewed-by: Eric Dumazet 

> Thanks David !

Tested-by: Song Liu 



Re: [PATCH v3 net-next] tcp: Remove use of daddr_cache in tracepoint

2017-10-17 Thread Eric Dumazet
On Tue, 2017-10-17 at 13:09 -0700, David Ahern wrote:
> Running perf in one window to capture tcp_retransmit_skb tracepoint:
> $ perf record -e tcp:tcp_retransmit_skb -a
> 
> And causing a retransmission on an active TCP session (e.g., dropping
> packets in the receiver, changing MTU on the interface to 500 and back
> to 1500) triggers a panic:

> Remove use of ipv6_pinfo in favor of data in sock_common.
> 
> Fixes: e086101b150a ("tcp: add a tracepoint for tcp retransmission")
> Signed-off-by: David Ahern 
> ---

Reviewed-by: Eric Dumazet 

Thanks David !




Re: [PATCH v3 net-next] tcp: Remove use of daddr_cache in tracepoint

2017-10-17 Thread Cong Wang
On Tue, Oct 17, 2017 at 1:09 PM, David Ahern  wrote:
> Running perf in one window to capture tcp_retransmit_skb tracepoint:
> $ perf record -e tcp:tcp_retransmit_skb -a
>
> And causing a retransmission on an active TCP session (e.g., dropping
> packets in the receiver, changing MTU on the interface to 500 and back
> to 1500) triggers a panic:
>
> [   58.543144] BUG: unable to handle kernel NULL pointer dereference at 
> 0008
> [   58.545300] IP: perf_trace_tcp_retransmit_skb+0xd0/0x145
> [   58.546770] PGD 0 P4D 0
> [   58.547472] Oops:  [#1] SMP
> [   58.548328] Modules linked in: vrf
> [   58.549262] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc4+ #26
> [   58.551004] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
> 1.7.5-20140531_083030-gandalf 04/01/2014
> [   58.554560] task: 81a0e540 task.stack: 81a0
> [   58.555817] RIP: 0010:perf_trace_tcp_retransmit_skb+0xd0/0x145
> [   58.557137] RSP: 0018:88003fc03d68 EFLAGS: 00010282
> [   58.558292] RAX:  RBX: e8c0ec80 RCX: 
> 880038543098
> [   58.559850] RDX: 0400 RSI: 88003fc03d70 RDI: 
> 88003fc14b68
> [   58.561099] RBP: 88003fc03da8 R08:  R09: 
> ead3224a
> [   58.562005] R10: 88003fc03db8 R11: 0010 R12: 
> 8800385428c0
> [   58.562930] R13: e8c0e478 R14: 81a93a40 R15: 
> 88003d4f0c00
> [   58.563845] FS:  () GS:88003fc0() 
> knlGS:
> [   58.564873] CS:  0010 DS:  ES:  CR0: 80050033
> [   58.565613] CR2: 0008 CR3: 3d68f004 CR4: 
> 000606f0
> [   58.566538] Call Trace:
> [   58.566865]  
> [   58.567140]  __tcp_retransmit_skb+0x4ab/0x4c6
> [   58.567704]  ? tcp_set_ca_state+0x22/0x3f
> [   58.568231]  tcp_retransmit_skb+0x14/0xa3
> [   58.568754]  tcp_retransmit_timer+0x472/0x5e3
> [   58.569324]  ? tcp_write_timer_handler+0x1e9/0x1e9
> [   58.569946]  tcp_write_timer_handler+0x95/0x1e9
> [   58.570548]  tcp_write_timer+0x2a/0x58
>
> Remove use of ipv6_pinfo in favor of data in sock_common.
>
> Fixes: e086101b150a ("tcp: add a tracepoint for tcp retransmission")
> Signed-off-by: David Ahern 

Acked-by: Cong Wang 


[PATCH v3 net-next] tcp: Remove use of daddr_cache in tracepoint

2017-10-17 Thread David Ahern
Running perf in one window to capture tcp_retransmit_skb tracepoint:
$ perf record -e tcp:tcp_retransmit_skb -a

And causing a retransmission on an active TCP session (e.g., dropping
packets in the receiver, changing MTU on the interface to 500 and back
to 1500) triggers a panic:

[   58.543144] BUG: unable to handle kernel NULL pointer dereference at 
0008
[   58.545300] IP: perf_trace_tcp_retransmit_skb+0xd0/0x145
[   58.546770] PGD 0 P4D 0
[   58.547472] Oops:  [#1] SMP
[   58.548328] Modules linked in: vrf
[   58.549262] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc4+ #26
[   58.551004] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
1.7.5-20140531_083030-gandalf 04/01/2014
[   58.554560] task: 81a0e540 task.stack: 81a0
[   58.555817] RIP: 0010:perf_trace_tcp_retransmit_skb+0xd0/0x145
[   58.557137] RSP: 0018:88003fc03d68 EFLAGS: 00010282
[   58.558292] RAX:  RBX: e8c0ec80 RCX: 880038543098
[   58.559850] RDX: 0400 RSI: 88003fc03d70 RDI: 88003fc14b68
[   58.561099] RBP: 88003fc03da8 R08:  R09: ead3224a
[   58.562005] R10: 88003fc03db8 R11: 0010 R12: 8800385428c0
[   58.562930] R13: e8c0e478 R14: 81a93a40 R15: 88003d4f0c00
[   58.563845] FS:  () GS:88003fc0() 
knlGS:
[   58.564873] CS:  0010 DS:  ES:  CR0: 80050033
[   58.565613] CR2: 0008 CR3: 3d68f004 CR4: 000606f0
[   58.566538] Call Trace:
[   58.566865]  
[   58.567140]  __tcp_retransmit_skb+0x4ab/0x4c6
[   58.567704]  ? tcp_set_ca_state+0x22/0x3f
[   58.568231]  tcp_retransmit_skb+0x14/0xa3
[   58.568754]  tcp_retransmit_timer+0x472/0x5e3
[   58.569324]  ? tcp_write_timer_handler+0x1e9/0x1e9
[   58.569946]  tcp_write_timer_handler+0x95/0x1e9
[   58.570548]  tcp_write_timer+0x2a/0x58

Remove use of ipv6_pinfo in favor of data in sock_common.

Fixes: e086101b150a ("tcp: add a tracepoint for tcp retransmission")
Signed-off-by: David Ahern 
---
v3
- remove use of inet6_sk and check sk_family (requested by Eric)
- Add IS_ENABLED(CONFIG_IPV6) around use of sk_v6_rcv_saddr and
  sk_v6_daddr as done in sock_common (noted by Cong)

v2
- remove np and get addresses from sock_common

 include/trace/events/tcp.h | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 3d1cbd072b7e..271812216ce3 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -27,7 +27,6 @@ TRACE_EVENT(tcp_retransmit_skb,
),
 
TP_fast_assign(
-   struct ipv6_pinfo *np = inet6_sk(sk);
struct inet_sock *inet = inet_sk(sk);
struct in6_addr *pin6;
__be32 *p32;
@@ -44,12 +43,15 @@ TRACE_EVENT(tcp_retransmit_skb,
p32 = (__be32 *) __entry->daddr;
*p32 =  inet->inet_daddr;
 
-   if (np) {
+#if IS_ENABLED(CONFIG_IPV6)
+   if (sk->sk_family == AF_INET6) {
pin6 = (struct in6_addr *)__entry->saddr_v6;
-   *pin6 = np->saddr;
+   *pin6 = sk->sk_v6_rcv_saddr;
pin6 = (struct in6_addr *)__entry->daddr_v6;
-   *pin6 = *(np->daddr_cache);
-   } else {
+   *pin6 = sk->sk_v6_daddr;
+   } else
+#endif
+   {
pin6 = (struct in6_addr *)__entry->saddr_v6;
ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);
pin6 = (struct in6_addr *)__entry->daddr_v6;
-- 
2.1.4