* [PATCH net-next v2 0/2] tcp: add tcp_warn_once() common helper
@ 2024-10-21 15:52 Jason Xing
2024-10-21 15:52 ` [PATCH net-next v2 1/2] tcp: add a common helper to debug the underlying issue Jason Xing
2024-10-21 15:52 ` [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe() Jason Xing
0 siblings, 2 replies; 8+ messages in thread
From: Jason Xing @ 2024-10-21 15:52 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, ncardwell; +Cc: netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Paolo Abeni suggested we can introduce a new helper to cover more cases
in the future for better debug.
Jason Xing (2):
tcp: add a common helper to debug the underlying issue
tcp: add more warn of socket in tcp_send_loss_probe()
include/net/tcp.h | 27 ++++++++++++++++-----------
net/ipv4/tcp_output.c | 4 +---
2 files changed, 17 insertions(+), 14 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v2 1/2] tcp: add a common helper to debug the underlying issue
2024-10-21 15:52 [PATCH net-next v2 0/2] tcp: add tcp_warn_once() common helper Jason Xing
@ 2024-10-21 15:52 ` Jason Xing
2024-10-21 17:50 ` David Ahern
2024-10-21 15:52 ` [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe() Jason Xing
1 sibling, 1 reply; 8+ messages in thread
From: Jason Xing @ 2024-10-21 15:52 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, ncardwell; +Cc: netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Following the commit c8770db2d544 ("tcp: check skb is non-NULL
in tcp_rto_delta_us()"), we decided to add a helper so that it's
easier to get verbose warning on either cases.
Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Cc: Neal Cardwell <ncardwell@google.com>
---
v2
Link: https://lore.kernel.org/all/38811a75-ae98-48e7-96c0-bb1a39a0d722@kernel.org/
1. fix "break quoted strings at a space character" warning (David Ahern)
---
include/net/tcp.h | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 739a9fb83d0c..8b8d94bb1746 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -2430,6 +2430,19 @@ void tcp_plb_update_state(const struct sock *sk, struct tcp_plb_state *plb,
void tcp_plb_check_rehash(struct sock *sk, struct tcp_plb_state *plb);
void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb);
+static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str)
+{
+ WARN_ONCE(cond,
+ "%sout:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n",
+ str,
+ tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
+ tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
+ tcp_sk(sk)->tlp_high_seq, sk->sk_state,
+ inet_csk(sk)->icsk_ca_state,
+ tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
+ inet_csk(sk)->icsk_pmtu_cookie);
+}
+
/* At how many usecs into the future should the RTO fire? */
static inline s64 tcp_rto_delta_us(const struct sock *sk)
{
@@ -2441,17 +2454,7 @@ static inline s64 tcp_rto_delta_us(const struct sock *sk)
return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp;
} else {
- WARN_ONCE(1,
- "rtx queue empty: "
- "out:%u sacked:%u lost:%u retrans:%u "
- "tlp_high_seq:%u sk_state:%u ca_state:%u "
- "advmss:%u mss_cache:%u pmtu:%u\n",
- tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
- tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
- tcp_sk(sk)->tlp_high_seq, sk->sk_state,
- inet_csk(sk)->icsk_ca_state,
- tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
- inet_csk(sk)->icsk_pmtu_cookie);
+ tcp_warn_once(sk, 1, "rtx queue empty: ");
return jiffies_to_usecs(rto);
}
--
2.37.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe()
2024-10-21 15:52 [PATCH net-next v2 0/2] tcp: add tcp_warn_once() common helper Jason Xing
2024-10-21 15:52 ` [PATCH net-next v2 1/2] tcp: add a common helper to debug the underlying issue Jason Xing
@ 2024-10-21 15:52 ` Jason Xing
2024-10-21 17:51 ` David Ahern
2024-10-22 8:00 ` Eric Dumazet
1 sibling, 2 replies; 8+ messages in thread
From: Jason Xing @ 2024-10-21 15:52 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, ncardwell; +Cc: netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Add two fields to print in the helper which here covers tcp_send_loss_probe().
Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Cc: Neal Cardwell <ncardwell@google.com>
--
v2
Link:https://lore.kernel.org/all/CAL+tcoAr7RHhaZGV12wYDcPPPaubAqdxMCmy7Jujtr8b3+bY=w@mail.gmail.com/
1. use "" instead of NULL in tcp_send_loss_probe()
---
include/net/tcp.h | 4 +++-
net/ipv4/tcp_output.c | 4 +---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 8b8d94bb1746..78158169e944 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -2433,12 +2433,14 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb);
static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str)
{
WARN_ONCE(cond,
- "%sout:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n",
+ "%scwn:%u out:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u mss:%u advmss:%u mss_cache:%u pmtu:%u\n",
str,
+ tcp_snd_cwnd(tcp_sk(sk)),
tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
tcp_sk(sk)->tlp_high_seq, sk->sk_state,
inet_csk(sk)->icsk_ca_state,
+ tcp_current_mss((struct sock *)sk),
tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
inet_csk(sk)->icsk_pmtu_cookie);
}
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 054244ce5117..36562b5fe290 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2954,9 +2954,7 @@ void tcp_send_loss_probe(struct sock *sk)
}
skb = skb_rb_last(&sk->tcp_rtx_queue);
if (unlikely(!skb)) {
- WARN_ONCE(tp->packets_out,
- "invalid inflight: %u state %u cwnd %u mss %d\n",
- tp->packets_out, sk->sk_state, tcp_snd_cwnd(tp), mss);
+ tcp_warn_once(sk, tp->packets_out, "");
smp_store_release(&inet_csk(sk)->icsk_pending, 0);
return;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 1/2] tcp: add a common helper to debug the underlying issue
2024-10-21 15:52 ` [PATCH net-next v2 1/2] tcp: add a common helper to debug the underlying issue Jason Xing
@ 2024-10-21 17:50 ` David Ahern
0 siblings, 0 replies; 8+ messages in thread
From: David Ahern @ 2024-10-21 17:50 UTC (permalink / raw)
To: Jason Xing, davem, edumazet, kuba, pabeni, ncardwell; +Cc: netdev, Jason Xing
On 10/21/24 9:52 AM, Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> Following the commit c8770db2d544 ("tcp: check skb is non-NULL
> in tcp_rto_delta_us()"), we decided to add a helper so that it's
> easier to get verbose warning on either cases.
>
> Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> ---
> v2
> Link: https://lore.kernel.org/all/38811a75-ae98-48e7-96c0-bb1a39a0d722@kernel.org/
> 1. fix "break quoted strings at a space character" warning (David Ahern)
> ---
> include/net/tcp.h | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe()
2024-10-21 15:52 ` [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe() Jason Xing
@ 2024-10-21 17:51 ` David Ahern
2024-10-22 0:47 ` Jason Xing
2024-10-22 8:00 ` Eric Dumazet
1 sibling, 1 reply; 8+ messages in thread
From: David Ahern @ 2024-10-21 17:51 UTC (permalink / raw)
To: Jason Xing, davem, edumazet, kuba, pabeni, ncardwell; +Cc: netdev, Jason Xing
On 10/21/24 9:52 AM, Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> Add two fields to print in the helper which here covers tcp_send_loss_probe().
>
> Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> --
> v2
> Link:https://lore.kernel.org/all/CAL+tcoAr7RHhaZGV12wYDcPPPaubAqdxMCmy7Jujtr8b3+bY=w@mail.gmail.com/
> 1. use "" instead of NULL in tcp_send_loss_probe()
> ---
> include/net/tcp.h | 4 +++-
> net/ipv4/tcp_output.c | 4 +---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 8b8d94bb1746..78158169e944 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -2433,12 +2433,14 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb);
> static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str)
> {
> WARN_ONCE(cond,
> - "%sout:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n",
> + "%scwn:%u out:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u mss:%u advmss:%u mss_cache:%u pmtu:%u\n",
> str,
> + tcp_snd_cwnd(tcp_sk(sk)),
> tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
> tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
> tcp_sk(sk)->tlp_high_seq, sk->sk_state,
> inet_csk(sk)->icsk_ca_state,
> + tcp_current_mss((struct sock *)sk),
> tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
> inet_csk(sk)->icsk_pmtu_cookie);
> }
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 054244ce5117..36562b5fe290 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -2954,9 +2954,7 @@ void tcp_send_loss_probe(struct sock *sk)
> }
> skb = skb_rb_last(&sk->tcp_rtx_queue);
> if (unlikely(!skb)) {
> - WARN_ONCE(tp->packets_out,
> - "invalid inflight: %u state %u cwnd %u mss %d\n",
> - tp->packets_out, sk->sk_state, tcp_snd_cwnd(tp), mss);
> + tcp_warn_once(sk, tp->packets_out, "");
you dropped the "invalid inflight: " string for context.
> smp_store_release(&inet_csk(sk)->icsk_pending, 0);
> return;
> }
Besides the nit:
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe()
2024-10-21 17:51 ` David Ahern
@ 2024-10-22 0:47 ` Jason Xing
0 siblings, 0 replies; 8+ messages in thread
From: Jason Xing @ 2024-10-22 0:47 UTC (permalink / raw)
To: David Ahern; +Cc: davem, edumazet, kuba, pabeni, ncardwell, netdev, Jason Xing
On Tue, Oct 22, 2024 at 1:51 AM David Ahern <dsahern@kernel.org> wrote:
>
> On 10/21/24 9:52 AM, Jason Xing wrote:
> > From: Jason Xing <kernelxing@tencent.com>
> >
> > Add two fields to print in the helper which here covers tcp_send_loss_probe().
> >
> > Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
> > Suggested-by: Paolo Abeni <pabeni@redhat.com>
> > Signed-off-by: Jason Xing <kernelxing@tencent.com>
> > Cc: Neal Cardwell <ncardwell@google.com>
> > --
> > v2
> > Link:https://lore.kernel.org/all/CAL+tcoAr7RHhaZGV12wYDcPPPaubAqdxMCmy7Jujtr8b3+bY=w@mail.gmail.com/
> > 1. use "" instead of NULL in tcp_send_loss_probe()
> > ---
> > include/net/tcp.h | 4 +++-
> > net/ipv4/tcp_output.c | 4 +---
> > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/net/tcp.h b/include/net/tcp.h
> > index 8b8d94bb1746..78158169e944 100644
> > --- a/include/net/tcp.h
> > +++ b/include/net/tcp.h
> > @@ -2433,12 +2433,14 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb);
> > static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str)
> > {
> > WARN_ONCE(cond,
> > - "%sout:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n",
> > + "%scwn:%u out:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u mss:%u advmss:%u mss_cache:%u pmtu:%u\n",
> > str,
> > + tcp_snd_cwnd(tcp_sk(sk)),
> > tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
> > tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
> > tcp_sk(sk)->tlp_high_seq, sk->sk_state,
> > inet_csk(sk)->icsk_ca_state,
> > + tcp_current_mss((struct sock *)sk),
> > tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
> > inet_csk(sk)->icsk_pmtu_cookie);
> > }
> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> > index 054244ce5117..36562b5fe290 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -2954,9 +2954,7 @@ void tcp_send_loss_probe(struct sock *sk)
> > }
> > skb = skb_rb_last(&sk->tcp_rtx_queue);
> > if (unlikely(!skb)) {
> > - WARN_ONCE(tp->packets_out,
> > - "invalid inflight: %u state %u cwnd %u mss %d\n",
> > - tp->packets_out, sk->sk_state, tcp_snd_cwnd(tp), mss);
> > + tcp_warn_once(sk, tp->packets_out, "");
>
> you dropped the "invalid inflight: " string for context.
Well, sorry, let me add it back.
>
> > smp_store_release(&inet_csk(sk)->icsk_pending, 0);
> > return;
> > }
>
> Besides the nit:
> Reviewed-by: David Ahern <dsahern@kernel.org>
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe()
2024-10-21 15:52 ` [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe() Jason Xing
2024-10-21 17:51 ` David Ahern
@ 2024-10-22 8:00 ` Eric Dumazet
2024-10-22 9:13 ` Jason Xing
1 sibling, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2024-10-22 8:00 UTC (permalink / raw)
To: Jason Xing; +Cc: davem, kuba, pabeni, dsahern, ncardwell, netdev, Jason Xing
On Mon, Oct 21, 2024 at 5:53 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> From: Jason Xing <kernelxing@tencent.com>
>
> Add two fields to print in the helper which here covers tcp_send_loss_probe().
>
> Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> --
> v2
> Link:https://lore.kernel.org/all/CAL+tcoAr7RHhaZGV12wYDcPPPaubAqdxMCmy7Jujtr8b3+bY=w@mail.gmail.com/
> 1. use "" instead of NULL in tcp_send_loss_probe()
> ---
> include/net/tcp.h | 4 +++-
> net/ipv4/tcp_output.c | 4 +---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 8b8d94bb1746..78158169e944 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -2433,12 +2433,14 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb);
> static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str)
> {
> WARN_ONCE(cond,
> - "%sout:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n",
> + "%scwn:%u out:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u mss:%u advmss:%u mss_cache:%u pmtu:%u\n",
> str,
> + tcp_snd_cwnd(tcp_sk(sk)),
> tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
> tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
> tcp_sk(sk)->tlp_high_seq, sk->sk_state,
> inet_csk(sk)->icsk_ca_state,
> + tcp_current_mss((struct sock *)sk),
You can not promote to non const, because tcp_current_mss() might
change socket state.
If a debug helper changes the socket state, then it is no longer a debug helper.
> tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
This was already reported btw.
> inet_csk(sk)->icsk_pmtu_cookie);
> }
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 054244ce5117..36562b5fe290 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -2954,9 +2954,7 @@ void tcp_send_loss_probe(struct sock *sk)
> }
> skb = skb_rb_last(&sk->tcp_rtx_queue);
> if (unlikely(!skb)) {
> - WARN_ONCE(tp->packets_out,
> - "invalid inflight: %u state %u cwnd %u mss %d\n",
> - tp->packets_out, sk->sk_state, tcp_snd_cwnd(tp), mss);
> + tcp_warn_once(sk, tp->packets_out, "");
> smp_store_release(&inet_csk(sk)->icsk_pending, 0);
> return;
> }
> --
> 2.37.3
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe()
2024-10-22 8:00 ` Eric Dumazet
@ 2024-10-22 9:13 ` Jason Xing
0 siblings, 0 replies; 8+ messages in thread
From: Jason Xing @ 2024-10-22 9:13 UTC (permalink / raw)
To: Eric Dumazet; +Cc: davem, kuba, pabeni, dsahern, ncardwell, netdev, Jason Xing
On Tue, Oct 22, 2024 at 4:00 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Mon, Oct 21, 2024 at 5:53 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
> >
> > From: Jason Xing <kernelxing@tencent.com>
> >
> > Add two fields to print in the helper which here covers tcp_send_loss_probe().
> >
> > Link: https://lore.kernel.org/all/5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com/
> > Suggested-by: Paolo Abeni <pabeni@redhat.com>
> > Signed-off-by: Jason Xing <kernelxing@tencent.com>
> > Cc: Neal Cardwell <ncardwell@google.com>
> > --
> > v2
> > Link:https://lore.kernel.org/all/CAL+tcoAr7RHhaZGV12wYDcPPPaubAqdxMCmy7Jujtr8b3+bY=w@mail.gmail.com/
> > 1. use "" instead of NULL in tcp_send_loss_probe()
> > ---
> > include/net/tcp.h | 4 +++-
> > net/ipv4/tcp_output.c | 4 +---
> > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/net/tcp.h b/include/net/tcp.h
> > index 8b8d94bb1746..78158169e944 100644
> > --- a/include/net/tcp.h
> > +++ b/include/net/tcp.h
> > @@ -2433,12 +2433,14 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb);
> > static inline void tcp_warn_once(const struct sock *sk, bool cond, const char *str)
> > {
> > WARN_ONCE(cond,
> > - "%sout:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u advmss:%u mss_cache:%u pmtu:%u\n",
> > + "%scwn:%u out:%u sacked:%u lost:%u retrans:%u tlp_high_seq:%u sk_state:%u ca_state:%u mss:%u advmss:%u mss_cache:%u pmtu:%u\n",
> > str,
> > + tcp_snd_cwnd(tcp_sk(sk)),
> > tcp_sk(sk)->packets_out, tcp_sk(sk)->sacked_out,
> > tcp_sk(sk)->lost_out, tcp_sk(sk)->retrans_out,
> > tcp_sk(sk)->tlp_high_seq, sk->sk_state,
> > inet_csk(sk)->icsk_ca_state,
> > + tcp_current_mss((struct sock *)sk),
>
> You can not promote to non const, because tcp_current_mss() might
> change socket state.
>
> If a debug helper changes the socket state, then it is no longer a debug helper.
It does make sense. Thanks.
>
> > tcp_sk(sk)->advmss, tcp_sk(sk)->mss_cache,
>
> This was already reported btw.
So I'm going to remove this tcp_current_mss() line.
Thanks,
Jason
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-10-22 9:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 15:52 [PATCH net-next v2 0/2] tcp: add tcp_warn_once() common helper Jason Xing
2024-10-21 15:52 ` [PATCH net-next v2 1/2] tcp: add a common helper to debug the underlying issue Jason Xing
2024-10-21 17:50 ` David Ahern
2024-10-21 15:52 ` [PATCH net-next v2 2/2] tcp: add more warn of socket in tcp_send_loss_probe() Jason Xing
2024-10-21 17:51 ` David Ahern
2024-10-22 0:47 ` Jason Xing
2024-10-22 8:00 ` Eric Dumazet
2024-10-22 9:13 ` Jason Xing
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).