Skip to contentSkip to conversation

net/tcp: Prevent inlining tcp_syn_ack_timeout()

PATCH Applied Emil Tsalapatis 5 participants 6 messages Jul 8 – Jul 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/tcp: Prevent inlining tcp_syn_ack_timeout()

The tcp_syn_ack_timeout() function gets inlined by Clang, preventing tracing. Since the call is not in the fast path, prevent it from being inlined.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -1
index bf171b5e1eb3..f7215d53bbda 100644
@@ -748,7 +748,7 @@ static void tcp_write_timer(struct timer_list *t)
 	sock_put(sk);
 }
 
-void tcp_syn_ack_timeout(const struct request_sock *req)
+noinline_for_tracing void tcp_syn_ack_timeout(const struct request_sock *req)
 {
 	struct net *net = read_pnet(&inet_rsk(req)->ireq_net);
 
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 14 lines · Emil Tsalapatis

The tcp_syn_ack_timeout() function gets inlined by Clang, preventing tracing. Since the call is not in the fast path, prevent it from being inlined.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +0 -0
index bf171b5e1eb3..f7215d53bbda 100644

net/ipv4/tcp_timer.c static void tcp_write_timer(struct timer_list *t) · line 754

Quoted 8 lines
net/ipv4/tcp_timer.c +1 -1
@@ -748,7 +748,7 @@ static void tcp_write_timer(struct timer_list *t)
 	sock_put(sk);
 }
 
-void tcp_syn_ack_timeout(const struct request_sock *req)
+noinline_for_tracing void tcp_syn_ack_timeout(const struct request_sock *req)
 {
 	struct net *net = read_pnet(&inet_rsk(req)->ireq_net);
 

What's the point of tracing such function? It just increment a mib. If you want to discriminate between TFO and non TFO syn ack timeout, possibly adding another MIB counter and incrementing it in tcp_fastopen_synack_timer() would be better???

/P

Reviewed-by
#2 lore raw
Quoted 19 lines · Paolo Abeni
Quoted 17 lines · Emil Tsalapatis

The tcp_syn_ack_timeout() function gets inlined by Clang, preventing tracing. Since the call is not in the fast path, prevent it from being inlined.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +0 -0
index bf171b5e1eb3..f7215d53bbda 100644
@@ -748,7 +748,7 @@ static void tcp_write_timer(struct timer_list *t)
      sock_put(sk);
 }
 
Quoted 10 lines

net/ipv4/tcp_timer.c static void tcp_write_timer(struct timer_list *t) · line 754

Quoted 5 lines
net/ipv4/tcp_timer.c +1 -1
-void tcp_syn_ack_timeout(const struct request_sock *req)
+noinline_for_tracing void tcp_syn_ack_timeout(const struct request_sock *req)
 {
      struct net *net = read_pnet(&inet_rsk(req)->ireq_net);
 

What's the point of tracing such function? It just increment a mib. If you want to discriminate between TFO and non TFO syn ack timeout, possibly adding another MIB counter and incrementing it in tcp_fastopen_synack_timer() would be better???

Tracing has some merits that a MIB counter can not replace :)

Emil, next time add a link to the V1, this would have helped to understand the motivation.

https://mail-archive.com/[email protected]/msg24624.html

maintainer
#3 lore raw
In reply to Paolo Abeni
Quoted 18 lines · On Tue, 21 Jul 2026 15:24:52 +0200 Paolo Abeni wrote:
Quoted 17 lines · Emil Tsalapatis

The tcp_syn_ack_timeout() function gets inlined by Clang, preventing tracing. Since the call is not in the fast path, prevent it from being inlined.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +0 -0
index bf171b5e1eb3..f7215d53bbda 100644
@@ -748,7 +748,7 @@ static void tcp_write_timer(struct timer_list *t)
 	sock_put(sk);
 }
 
Quoted 10 lines

net/ipv4/tcp_timer.c static void tcp_write_timer(struct timer_list *t) · line 754

Quoted 5 lines
net/ipv4/tcp_timer.c +1 -1
-void tcp_syn_ack_timeout(const struct request_sock *req)
+noinline_for_tracing void tcp_syn_ack_timeout(const struct request_sock *req)
 {
 	struct net *net = read_pnet(&inet_rsk(req)->ireq_net);
 

What's the point of tracing such function? It just increment a mib. If you want to discriminate between TFO and non TFO syn ack timeout, possibly adding another MIB counter and incrementing it in tcp_fastopen_synack_timer() would be better???

FWIW we seem to capture the 5 tuple when it happens, not just mib counter. Internal commit (form 2019) just says we want to know when syn-ack is blackholed, unclear under what conditions this happens.

maintainer
#4 lore raw
Quoted 30 lines · Jakub Kicinski
Quoted 18 lines · On Tue, 21 Jul 2026 15:24:52 +0200 Paolo Abeni wrote:
Quoted 17 lines · Emil Tsalapatis

The tcp_syn_ack_timeout() function gets inlined by Clang, preventing tracing. Since the call is not in the fast path, prevent it from being inlined.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +0 -0
index bf171b5e1eb3..f7215d53bbda 100644
@@ -748,7 +748,7 @@ static void tcp_write_timer(struct timer_list *t)
 	sock_put(sk);
 }
 
Quoted 10 lines

net/ipv4/tcp_timer.c static void tcp_write_timer(struct timer_list *t) · line 754

Quoted 5 lines
net/ipv4/tcp_timer.c +1 -1
-void tcp_syn_ack_timeout(const struct request_sock *req)
+noinline_for_tracing void tcp_syn_ack_timeout(const struct request_sock *req)
 {
 	struct net *net = read_pnet(&inet_rsk(req)->ireq_net);
 

What's the point of tracing such function? It just increment a mib. If you want to discriminate between TFO and non TFO syn ack timeout, possibly adding another MIB counter and incrementing it in tcp_fastopen_synack_timer() would be better???

Quoted 3 lines

FWIW we seem to capture the 5 tuple when it happens, not just mib counter. Internal commit (form 2019) just says we want to know when syn-ack is blackholed, unclear under what conditions this happens.

Thanks for the context infos. I'm fine with the patch as-is.

/P

#5 lore raw
In reply to Emil Tsalapatis
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 8 Jul 2026 14:08:37 -0400 you wrote:

The tcp_syn_ack_timeout() function gets inlined by Clang, preventing tracing. Since the call is not in the fast path, prevent it from being inlined.

---
 net/ipv4/tcp_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [net-next] net/tcp: Prevent inlining tcp_syn_ack_timeout()

    https://git.kernel.org/netdev/net-next/c/d05338c1290e

You are awesome, thank you!

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