Skip to contentSkip to conversation

tcp: add two missing addresses when using trace

PATCH Applied Jason Xing 3 participants 6 messages Mar 4, 2024 – Mar 7, 2024

Subsystems (4)
lore
Share & tools
lore

Jason Xing

author
#0 lore raw

v2 cover tcp: add two missing addresses when using trace

From: Jason Xing <[email protected]>

When I reviewed other people's patch [1], I noticed that similar things also happen in tcp_event_skb class and tcp_event_sk_skb class. They don't print those two addrs of skb/sk which already exist.

In this patch, I just do as other trace functions do, like trace_net_dev_start_xmit(), to know the exact flow or skb we would like to know in case some systems doesn't support BPF programs well or we have to use /sys/kernel/debug/tracing only for some reasons.

v2

1. change the description.

Jason Xing (2):
tcp: add tracing of skb/skaddr in tcp_event_sk_skb class
tcp: add tracing of skbaddr in tcp_event_skb class

 include/trace/events/tcp.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.37.3
author
#1 lore raw

PATCH v2 1/2 tcp: add tracing of skb/skaddr in tcp_event_sk_skb class

From: Jason Xing <[email protected]>

Printing the addresses can help us identify the exact skb/sk for those system in which it's not that easy to run BPF program. As we can see, it already fetches those, then use it directly and it will print like below:

...tcp_retransmit_skb: skbaddr=XXX skaddr=XXX family=AF_INET...

--
v2

1. correct the previous description

---
 include/trace/events/tcp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/trace/events/tcp.h +2 -1
index 7b1ddffa3dfc..ac36067ae066 100644
@@ -88,7 +88,8 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb,
 			      sk->sk_v6_rcv_saddr, sk->sk_v6_daddr);
 	),
 
-	TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c state=%s",
+	TP_printk("skbaddr=%p skaddr=%p family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c state=%s",
+		  __entry->skbaddr, __entry->skaddr,
 		  show_family_name(__entry->family),
 		  __entry->sport, __entry->dport, __entry->saddr, __entry->daddr,
 		  __entry->saddr_v6, __entry->daddr_v6,
Signature · 1 line
2.37.3
author
#3 lore raw

PATCH v2 2/2 tcp: add tracing of skbaddr in tcp_event_skb class

In reply to Jason Xing

From: Jason Xing <[email protected]>

Use the existing parameter and print the address of skbaddr as other trace functions do.

---
 include/trace/events/tcp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/trace/events/tcp.h +2 -1
index ac36067ae066..6ca3e0343666 100644
@@ -362,7 +362,8 @@ DECLARE_EVENT_CLASS(tcp_event_skb,
 		TP_STORE_ADDR_PORTS_SKB(__entry, skb);
 	),
 
-	TP_printk("src=%pISpc dest=%pISpc", __entry->saddr, __entry->daddr)
+	TP_printk("skbaddr=%p src=%pISpc dest=%pISpc",
+		  __entry->skbaddr, __entry->saddr, __entry->daddr)
 );
 
 DEFINE_EVENT(tcp_event_skb, tcp_bad_csum,
Signature · 1 line
2.37.3
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH net-next v2 1/2] tcp: add tracing of skb/skaddr in tcp_event_sk_skb class

In reply to Jason Xing
Quoted 11 lines · Jason Xing

From: Jason Xing <[email protected]>

Printing the addresses can help us identify the exact skb/sk for those system in which it's not that easy to run BPF program. As we can see, it already fetches those, then use it directly and it will print like below:

...tcp_retransmit_skb: skbaddr=XXX skaddr=XXX family=AF_INET...

#5 lore raw
In reply to Jason Xing
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 6 lines · On Mon, 4 Mar 2024 17:29:32 +0800 you wrote:

From: Jason Xing <[email protected]>

When I reviewed other people's patch [1], I noticed that similar things also happen in tcp_event_skb class and tcp_event_sk_skb class. They don't print those two addrs of skb/sk which already exist.

Quoted 6 lines

In this patch, I just do as other trace functions do, like trace_net_dev_start_xmit(), to know the exact flow or skb we would like to know in case some systems doesn't support BPF programs well or we have to use /sys/kernel/debug/tracing only for some reasons.

[...]

Here is the summary with links:
- [net-next,v2,1/2] tcp: add tracing of skb/skaddr in tcp_event_sk_skb class

    https://git.kernel.org/netdev/net-next/c/4e441bb8aca1
  - [net-next,v2,2/2] tcp: add tracing of skbaddr in tcp_event_skb class
    https://git.kernel.org/netdev/net-next/c/0ab544b6f055

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html