public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Josh Hunt <johunt@akamai.com>,
	edumazet@google.com, davem@davemloft.net, kuba@kernel.org,
	netdev@vger.kernel.org, ncardwell@google.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] tcp: check skb is non-NULL in tcp_rto_delta_us()
Date: Thu, 19 Sep 2024 11:05:50 +0200	[thread overview]
Message-ID: <5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com> (raw)
In-Reply-To: <20240910190822.2407606-1-johunt@akamai.com>

On 9/10/24 21:08, Josh Hunt wrote:
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 2aac11e7e1cc..196c148fce8a 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -2434,9 +2434,26 @@ static inline s64 tcp_rto_delta_us(const struct sock *sk)
>   {
>   	const struct sk_buff *skb = tcp_rtx_queue_head(sk);
>   	u32 rto = inet_csk(sk)->icsk_rto;
> -	u64 rto_time_stamp_us = tcp_skb_timestamp_us(skb) + jiffies_to_usecs(rto);
>   
> -	return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp;
> +	if (likely(skb)) {
> +		u64 rto_time_stamp_us = tcp_skb_timestamp_us(skb) + jiffies_to_usecs(rto);
> +
> +		return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp;
> +	} else {
> +		WARN_ONCE(1,
> +			"rtx queue emtpy: "
> +			"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);

As the underlying issue here share the same root cause as the one 
covered by the WARN_ONCE() in tcp_send_loss_probe(), I'm wondering if it 
would make sense do move the info dumping in a common helper, so that we 
get the verbose warning on either cases.

Thanks,

Paolo


  parent reply	other threads:[~2024-09-19  9:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 19:08 [PATCH net v3] tcp: check skb is non-NULL in tcp_rto_delta_us() Josh Hunt
2024-09-10 19:11 ` Neal Cardwell
2024-09-19  9:05 ` Paolo Abeni [this message]
2024-09-19 17:35   ` Neal Cardwell
2024-09-24  0:37     ` Jason Xing
2024-09-24  1:58       ` Neal Cardwell
2024-09-24 17:26   ` Josh Hunt
2024-10-12  0:17     ` Jason Xing
2024-09-23 10:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5632e043-bdba-4d75-bc7e-bf58014492fd@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johunt@akamai.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox