* [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
@ 2021-01-29 0:12 Hariharan Ananthakrishnan
2021-01-29 0:16 ` Alexei Starovoitov
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Hariharan Ananthakrishnan @ 2021-01-29 0:12 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski
Cc: netdev, Song Liu, Daniel Borkmann, Alexei Starovoitov,
Brendan Gregg, Hariharan Ananthakrishnan
Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
distinguish AF_INET and AF_INET6 families.
The following tcp tracepoints are updated:
tcp:tcp_destroy_sock
tcp:tcp_rcv_space_adjust
tcp:tcp_retransmit_skb
tcp:tcp_send_reset
tcp:tcp_receive_reset
tcp:tcp_retransmit_synack
tcp:tcp_probe
Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
Signed-off-by: Brendan Gregg <bgregg@netflix.com>
---
include/trace/events/tcp.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index cf97f6339acb..a319d2f86cd9 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -59,6 +59,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb,
__field(int, state)
__field(__u16, sport)
__field(__u16, dport)
+ __field(__u16, family)
__array(__u8, saddr, 4)
__array(__u8, daddr, 4)
__array(__u8, saddr_v6, 16)
@@ -75,6 +76,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb,
__entry->sport = ntohs(inet->inet_sport);
__entry->dport = ntohs(inet->inet_dport);
+ __entry->family = sk->sk_family;
p32 = (__be32 *) __entry->saddr;
*p32 = inet->inet_saddr;
@@ -86,7 +88,8 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb,
sk->sk_v6_rcv_saddr, sk->sk_v6_daddr);
),
- TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c state=%s",
+ TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c state=%s",
+ show_family_name(__entry->family),
__entry->sport, __entry->dport, __entry->saddr, __entry->daddr,
__entry->saddr_v6, __entry->daddr_v6,
show_tcp_state_name(__entry->state))
@@ -125,6 +128,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk,
__field(const void *, skaddr)
__field(__u16, sport)
__field(__u16, dport)
+ __field(__u16, family)
__array(__u8, saddr, 4)
__array(__u8, daddr, 4)
__array(__u8, saddr_v6, 16)
@@ -140,6 +144,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk,
__entry->sport = ntohs(inet->inet_sport);
__entry->dport = ntohs(inet->inet_dport);
+ __entry->family = sk->sk_family;
p32 = (__be32 *) __entry->saddr;
*p32 = inet->inet_saddr;
@@ -153,7 +158,8 @@ DECLARE_EVENT_CLASS(tcp_event_sk,
__entry->sock_cookie = sock_gen_cookie(sk);
),
- TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c sock_cookie=%llx",
+ TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c sock_cookie=%llx",
+ show_family_name(__entry->family),
__entry->sport, __entry->dport,
__entry->saddr, __entry->daddr,
__entry->saddr_v6, __entry->daddr_v6,
@@ -192,6 +198,7 @@ TRACE_EVENT(tcp_retransmit_synack,
__field(const void *, req)
__field(__u16, sport)
__field(__u16, dport)
+ __field(__u16, family)
__array(__u8, saddr, 4)
__array(__u8, daddr, 4)
__array(__u8, saddr_v6, 16)
@@ -207,6 +214,7 @@ TRACE_EVENT(tcp_retransmit_synack,
__entry->sport = ireq->ir_num;
__entry->dport = ntohs(ireq->ir_rmt_port);
+ __entry->family = sk->sk_family;
p32 = (__be32 *) __entry->saddr;
*p32 = ireq->ir_loc_addr;
@@ -218,7 +226,8 @@ TRACE_EVENT(tcp_retransmit_synack,
ireq->ir_v6_loc_addr, ireq->ir_v6_rmt_addr);
),
- TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c",
+ TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c",
+ show_family_name(__entry->family),
__entry->sport, __entry->dport,
__entry->saddr, __entry->daddr,
__entry->saddr_v6, __entry->daddr_v6)
@@ -238,6 +247,7 @@ TRACE_EVENT(tcp_probe,
__array(__u8, daddr, sizeof(struct sockaddr_in6))
__field(__u16, sport)
__field(__u16, dport)
+ __field(__u16, family)
__field(__u32, mark)
__field(__u16, data_len)
__field(__u32, snd_nxt)
@@ -264,6 +274,7 @@ TRACE_EVENT(tcp_probe,
__entry->sport = ntohs(inet->inet_sport);
__entry->dport = ntohs(inet->inet_dport);
__entry->mark = skb->mark;
+ __entry->family = sk->sk_family;
__entry->data_len = skb->len - __tcp_hdrlen(th);
__entry->snd_nxt = tp->snd_nxt;
@@ -276,7 +287,8 @@ TRACE_EVENT(tcp_probe,
__entry->sock_cookie = sock_gen_cookie(sk);
),
- TP_printk("src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx",
+ TP_printk("family=%s src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx",
+ show_family_name(__entry->family),
__entry->saddr, __entry->daddr, __entry->mark,
__entry->data_len, __entry->snd_nxt, __entry->snd_una,
__entry->snd_cwnd, __entry->ssthresh, __entry->snd_wnd,
base-commit: bbc20b70424aeb3c84f833860f6340adda5141fc
--
2.27.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-01-29 0:12 [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints Hariharan Ananthakrishnan
@ 2021-01-29 0:16 ` Alexei Starovoitov
2021-01-29 0:53 ` Brendan Gregg
2021-02-01 22:06 ` Jakub Kicinski
2021-02-04 17:26 ` Jakub Kicinski
2 siblings, 1 reply; 10+ messages in thread
From: Alexei Starovoitov @ 2021-01-29 0:16 UTC (permalink / raw)
To: Hariharan Ananthakrishnan
Cc: Eric Dumazet, David S . Miller, Jakub Kicinski,
Network Development, Song Liu, Daniel Borkmann,
Alexei Starovoitov, Brendan Gregg
On Thu, Jan 28, 2021 at 4:12 PM Hariharan Ananthakrishnan
<hari@netflix.com> wrote:
>
> Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
> distinguish AF_INET and AF_INET6 families.
>
> The following tcp tracepoints are updated:
> tcp:tcp_destroy_sock
> tcp:tcp_rcv_space_adjust
> tcp:tcp_retransmit_skb
> tcp:tcp_send_reset
> tcp:tcp_receive_reset
> tcp:tcp_retransmit_synack
> tcp:tcp_probe
>
> Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
> Signed-off-by: Brendan Gregg <bgregg@netflix.com>
> ---
> include/trace/events/tcp.h | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
> index cf97f6339acb..a319d2f86cd9 100644
> --- a/include/trace/events/tcp.h
> +++ b/include/trace/events/tcp.h
> @@ -59,6 +59,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb,
> __field(int, state)
> __field(__u16, sport)
> __field(__u16, dport)
> + __field(__u16, family)
> __array(__u8, saddr, 4)
> __array(__u8, daddr, 4)
> __array(__u8, saddr_v6, 16)
raw tracepoint can access all sk and skb fields already.
Why do you need this?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-01-29 0:16 ` Alexei Starovoitov
@ 2021-01-29 0:53 ` Brendan Gregg
0 siblings, 0 replies; 10+ messages in thread
From: Brendan Gregg @ 2021-01-29 0:53 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Hariharan Ananthakrishnan, Eric Dumazet, David S . Miller,
Jakub Kicinski, Network Development, Song Liu, Daniel Borkmann,
Alexei Starovoitov
On Fri, Jan 29, 2021 at 11:16 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Thu, Jan 28, 2021 at 4:12 PM Hariharan Ananthakrishnan
> <hari@netflix.com> wrote:
> >
> > Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
> > distinguish AF_INET and AF_INET6 families.
> >
> > The following tcp tracepoints are updated:
> > tcp:tcp_destroy_sock
> > tcp:tcp_rcv_space_adjust
> > tcp:tcp_retransmit_skb
> > tcp:tcp_send_reset
> > tcp:tcp_receive_reset
> > tcp:tcp_retransmit_synack
> > tcp:tcp_probe
> >
> > Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
> > Signed-off-by: Brendan Gregg <bgregg@netflix.com>
> > ---
> > include/trace/events/tcp.h | 20 ++++++++++++++++----
> > 1 file changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
> > index cf97f6339acb..a319d2f86cd9 100644
> > --- a/include/trace/events/tcp.h
> > +++ b/include/trace/events/tcp.h
> > @@ -59,6 +59,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb,
> > __field(int, state)
> > __field(__u16, sport)
> > __field(__u16, dport)
> > + __field(__u16, family)
> > __array(__u8, saddr, 4)
> > __array(__u8, daddr, 4)
> > __array(__u8, saddr_v6, 16)
>
> raw tracepoint can access all sk and skb fields already.
> Why do you need this?
We (Netflix) can dig it out using raw tracepoints and BTF (once it's
rolled out) but this was about fixing the existing tracepoints so they
were more useful.
I think tracepoints and their arguments suit a class of
non-kernel-hacker users: SREs, operators, sysadmins, etc. People who
run and tweak bpftrace one-liners.
Brendan
--
Brendan Gregg, Senior Performance Architect, Netflix
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-01-29 0:12 [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints Hariharan Ananthakrishnan
2021-01-29 0:16 ` Alexei Starovoitov
@ 2021-02-01 22:06 ` Jakub Kicinski
2021-02-02 7:38 ` Eric Dumazet
2021-02-04 17:26 ` Jakub Kicinski
2 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2021-02-01 22:06 UTC (permalink / raw)
To: Eric Dumazet
Cc: Hariharan Ananthakrishnan, David S . Miller, netdev, Song Liu,
Daniel Borkmann, Alexei Starovoitov, Brendan Gregg
On Fri, 29 Jan 2021 00:12:10 +0000 Hariharan Ananthakrishnan wrote:
> Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
> distinguish AF_INET and AF_INET6 families.
>
> The following tcp tracepoints are updated:
> tcp:tcp_destroy_sock
> tcp:tcp_rcv_space_adjust
> tcp:tcp_retransmit_skb
> tcp:tcp_send_reset
> tcp:tcp_receive_reset
> tcp:tcp_retransmit_synack
> tcp:tcp_probe
>
> Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
> Signed-off-by: Brendan Gregg <bgregg@netflix.com>
Eric, any thoughts?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-02-01 22:06 ` Jakub Kicinski
@ 2021-02-02 7:38 ` Eric Dumazet
2021-02-03 16:26 ` sdf
0 siblings, 1 reply; 10+ messages in thread
From: Eric Dumazet @ 2021-02-02 7:38 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Hariharan Ananthakrishnan, David S . Miller, netdev, Song Liu,
Daniel Borkmann, Alexei Starovoitov, Brendan Gregg
On Mon, Feb 1, 2021 at 11:06 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 29 Jan 2021 00:12:10 +0000 Hariharan Ananthakrishnan wrote:
> > Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
> > distinguish AF_INET and AF_INET6 families.
> >
> > The following tcp tracepoints are updated:
> > tcp:tcp_destroy_sock
> > tcp:tcp_rcv_space_adjust
> > tcp:tcp_retransmit_skb
> > tcp:tcp_send_reset
> > tcp:tcp_receive_reset
> > tcp:tcp_retransmit_synack
> > tcp:tcp_probe
> >
> > Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
> > Signed-off-by: Brendan Gregg <bgregg@netflix.com>
>
> Eric, any thoughts?
I do not use these tracepoints in production scripts, but I wonder if
existing tools could break after this change ?
Or do we consider tracepoints format is not part of the ABI and can be
arbitrarily changed by anyone ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-02-02 7:38 ` Eric Dumazet
@ 2021-02-03 16:26 ` sdf
2021-02-03 18:16 ` Jakub Kicinski
0 siblings, 1 reply; 10+ messages in thread
From: sdf @ 2021-02-03 16:26 UTC (permalink / raw)
To: Eric Dumazet
Cc: Jakub Kicinski, Hariharan Ananthakrishnan, David S . Miller,
netdev, Song Liu, Daniel Borkmann, Alexei Starovoitov,
Brendan Gregg
On 02/02, Eric Dumazet wrote:
> On Mon, Feb 1, 2021 at 11:06 PM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Fri, 29 Jan 2021 00:12:10 +0000 Hariharan Ananthakrishnan wrote:
> > > Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
> > > distinguish AF_INET and AF_INET6 families.
> > >
> > > The following tcp tracepoints are updated:
> > > tcp:tcp_destroy_sock
> > > tcp:tcp_rcv_space_adjust
> > > tcp:tcp_retransmit_skb
> > > tcp:tcp_send_reset
> > > tcp:tcp_receive_reset
> > > tcp:tcp_retransmit_synack
> > > tcp:tcp_probe
> > >
> > > Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
> > > Signed-off-by: Brendan Gregg <bgregg@netflix.com>
> >
> > Eric, any thoughts?
> I do not use these tracepoints in production scripts, but I wonder if
> existing tools could break after this change ?
> Or do we consider tracepoints format is not part of the ABI and can be
> arbitrarily changed by anyone ?
They are not ABI and since we are extending tracepoints with additional
info (and not removing any existing fields) it shouldn't be a problem.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-02-03 16:26 ` sdf
@ 2021-02-03 18:16 ` Jakub Kicinski
2021-02-03 18:25 ` Hariharan Ananthakrishnan
0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2021-02-03 18:16 UTC (permalink / raw)
To: sdf
Cc: Eric Dumazet, Hariharan Ananthakrishnan, David S . Miller,
netdev, Song Liu, Daniel Borkmann, Alexei Starovoitov,
Brendan Gregg
On Wed, 3 Feb 2021 08:26:04 -0800 sdf@google.com wrote:
> On 02/02, Eric Dumazet wrote:
> > On Mon, Feb 1, 2021 at 11:06 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > > Eric, any thoughts?
>
> > I do not use these tracepoints in production scripts, but I wonder if
> > existing tools could break after this change ?
>
> > Or do we consider tracepoints format is not part of the ABI and can be
> > arbitrarily changed by anyone ?
>
> They are not ABI and since we are extending tracepoints with additional
> info (and not removing any existing fields) it shouldn't be a problem.
Okay, but we should perhaps add the field at the end just to be on the
safe side (and avoid weird alignment of the IP addresses).
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-02-03 18:16 ` Jakub Kicinski
@ 2021-02-03 18:25 ` Hariharan Ananthakrishnan
2021-02-03 18:44 ` Jakub Kicinski
0 siblings, 1 reply; 10+ messages in thread
From: Hariharan Ananthakrishnan @ 2021-02-03 18:25 UTC (permalink / raw)
To: Jakub Kicinski
Cc: sdf, Eric Dumazet, David S . Miller, netdev, Song Liu,
Daniel Borkmann, Alexei Starovoitov, Brendan Gregg
On Wed, Feb 3, 2021 at 10:16 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed, 3 Feb 2021 08:26:04 -0800 sdf@google.com wrote:
> > On 02/02, Eric Dumazet wrote:
> > > On Mon, Feb 1, 2021 at 11:06 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > > > Eric, any thoughts?
> >
> > > I do not use these tracepoints in production scripts, but I wonder if
> > > existing tools could break after this change ?
> >
> > > Or do we consider tracepoints format is not part of the ABI and can be
> > > arbitrarily changed by anyone ?
> >
> > They are not ABI and since we are extending tracepoints with additional
> > info (and not removing any existing fields) it shouldn't be a problem.
>
> Okay, but we should perhaps add the field at the end just to be on the
> safe side (and avoid weird alignment of the IP addresses).
I added it after dport to be consistent with the earlier patch to
sock:inet_sock_set_state
https://lore.kernel.org/patchwork/patch/870492/.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-02-03 18:25 ` Hariharan Ananthakrishnan
@ 2021-02-03 18:44 ` Jakub Kicinski
0 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2021-02-03 18:44 UTC (permalink / raw)
To: Hariharan Ananthakrishnan
Cc: sdf, Eric Dumazet, David S . Miller, netdev, Song Liu,
Daniel Borkmann, Alexei Starovoitov, Brendan Gregg
On Wed, 3 Feb 2021 10:25:11 -0800 Hariharan Ananthakrishnan wrote:
> On Wed, Feb 3, 2021 at 10:16 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > On Wed, 3 Feb 2021 08:26:04 -0800 sdf@google.com wrote:
> > > They are not ABI and since we are extending tracepoints with additional
> > > info (and not removing any existing fields) it shouldn't be a problem.
> >
> > Okay, but we should perhaps add the field at the end just to be on the
> > safe side (and avoid weird alignment of the IP addresses).
> I added it after dport to be consistent with the earlier patch to
> sock:inet_sock_set_state
> https://lore.kernel.org/patchwork/patch/870492/.
I see :(
I'll give it a few more hours and if there are no objections apply the
patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints
2021-01-29 0:12 [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints Hariharan Ananthakrishnan
2021-01-29 0:16 ` Alexei Starovoitov
2021-02-01 22:06 ` Jakub Kicinski
@ 2021-02-04 17:26 ` Jakub Kicinski
2 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2021-02-04 17:26 UTC (permalink / raw)
To: Hariharan Ananthakrishnan
Cc: Eric Dumazet, David S . Miller, netdev, Song Liu,
Daniel Borkmann, Alexei Starovoitov, Brendan Gregg
On Fri, 29 Jan 2021 00:12:10 +0000 Hariharan Ananthakrishnan wrote:
> Similar to sock:inet_sock_set_state tracepoint, expose sk_family to
> distinguish AF_INET and AF_INET6 families.
>
> The following tcp tracepoints are updated:
> tcp:tcp_destroy_sock
> tcp:tcp_rcv_space_adjust
> tcp:tcp_retransmit_skb
> tcp:tcp_send_reset
> tcp:tcp_receive_reset
> tcp:tcp_retransmit_synack
> tcp:tcp_probe
>
> Signed-off-by: Hariharan Ananthakrishnan <hari@netflix.com>
> Signed-off-by: Brendan Gregg <bgregg@netflix.com>
Fixed up white space and applied, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-02-04 17:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-29 0:12 [PATCH] net: tracepoint: exposing sk_family in all tcp:tracepoints Hariharan Ananthakrishnan
2021-01-29 0:16 ` Alexei Starovoitov
2021-01-29 0:53 ` Brendan Gregg
2021-02-01 22:06 ` Jakub Kicinski
2021-02-02 7:38 ` Eric Dumazet
2021-02-03 16:26 ` sdf
2021-02-03 18:16 ` Jakub Kicinski
2021-02-03 18:25 ` Hariharan Ananthakrishnan
2021-02-03 18:44 ` Jakub Kicinski
2021-02-04 17:26 ` Jakub Kicinski
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).