public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	Guillaume Nault <gnault@redhat.com>
Subject: Re: [PATCH net] ip_tunnel: adapt iptunnel_xmit_stats() to NETDEV_PCPU_STAT_DSTATS
Date: Thu, 12 Mar 2026 07:46:30 -0700	[thread overview]
Message-ID: <20260312074630.52e7a311@kernel.org> (raw)
In-Reply-To: <20260311123110.1471930-1-edumazet@google.com>

On Wed, 11 Mar 2026 12:31:10 +0000 Eric Dumazet wrote:
> @syncp offset in pcpu_sw_netstats and pcpu_dstats is different.
> 
> 32bit kernels would either have corruptions or freezes if the syncp
> sequence was overwritten.

And moving syncp would be too much of a hack? 

>  	if (pkt_len > 0) {
> -		struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
> -
> -		u64_stats_update_begin(&tstats->syncp);
> -		u64_stats_add(&tstats->tx_bytes, pkt_len);
> -		u64_stats_inc(&tstats->tx_packets);
> -		u64_stats_update_end(&tstats->syncp);
> -		put_cpu_ptr(tstats);
> +		if (dev->pcpu_stat_type == NETDEV_PCPU_STAT_DSTATS) {
> +			struct pcpu_dstats *dstats = get_cpu_ptr(dev->dstats);
> +
> +			u64_stats_update_begin(&dstats->syncp);
> +			u64_stats_add(&dstats->tx_bytes, pkt_len);
> +			u64_stats_inc(&dstats->tx_packets);
> +			u64_stats_update_end(&dstats->syncp);
> +			put_cpu_ptr(dstats);
> +			return;
> +		}
> +		if (dev->pcpu_stat_type == NETDEV_PCPU_STAT_TSTATS) {
> +			struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
> +
> +			u64_stats_update_begin(&tstats->syncp);
> +			u64_stats_add(&tstats->tx_bytes, pkt_len);
> +			u64_stats_inc(&tstats->tx_packets);
> +			u64_stats_update_end(&tstats->syncp);
> +			put_cpu_ptr(tstats);
> +			return;
> +		}
> +		pr_err_once("iptunnel_xmit_stats pcpu_stat_type=%d\n",
> +			    dev->pcpu_stat_type);
> +		WARN_ON_ONCE(1);
>  		return;
>  	}

This code can run with migration enabled? Cause dev_dstats_tx_add() etc
exist

  parent reply	other threads:[~2026-03-12 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 12:31 [PATCH net] ip_tunnel: adapt iptunnel_xmit_stats() to NETDEV_PCPU_STAT_DSTATS Eric Dumazet
2026-03-12 10:33 ` Guillaume Nault
2026-03-12 14:46 ` Jakub Kicinski [this message]
2026-03-12 14:53   ` Eric Dumazet
2026-03-12 15:12     ` Jakub Kicinski
2026-03-13  2: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=20260312074630.52e7a311@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=gnault@redhat.com \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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