From: sashiko-bot@kernel.org
To: "Showta Ishizaki" <zakinko@snowrabbit.org>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH RFC net v11 1/6] net: account for ingress-resolved virtio net hdr state
Date: Sat, 05 Dec 2026 04:01:51 +0000 [thread overview]
Message-ID: <sashiko-outbox-251038@kernel.org> (raw)
In-Reply-To: <20261204.rfcv11.99731.1.zakinko@snowrabbit.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] tun: device-wide atomic64_t rx_csum_sw causes false sharing
in tun_struct
--
commit 565eda5d8ee04fb6c73d9fb10982bd2d4103c120
Author: Michael S. Tsirkin <mst@redhat.com>
net: account for ingress-resolved virtio net hdr state
This commit updates callers of virtio_net_hdr_to_skb() and
virtio_net_hdr_tnl_to_skb() to treat only negative return values as errors,
and adds a per-device rx_csum_sw counter in tun exposed via ethtool -S.
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index ae05b1e58abaa..19647fa977757 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -211,6 +211,7 @@ struct tun_struct {
> u32 flow_count;
> u32 rx_batched;
> atomic_long_t rx_frame_errors;
> + atomic64_t rx_csum_sw;
> struct bpf_prog __rcu *xdp_prog;
> struct tun_prog __rcu *steering_prog;
> struct tun_prog __rcu *filter_prog;
[Severity: Medium]
Can placing atomic64_t rx_csum_sw here cause false sharing on
struct tun_struct?
rx_csum_sw sits directly between rx_batched and the read-mostly RCU pointers
(xdp_prog, steering_prog, and filter_prog) with no cacheline separation, so
it shares a 64-byte cacheline with fields read on every RX and TX packet.
On a multi-queue device, accepted packets completing checksums in software
(such as non-TCP/UDP packets with VIRTIO_NET_HDR_F_NEEDS_CSUM) run
atomic64_inc(&tun->rx_csum_sw) in tun_get_user() and tun_xdp_one(). That
dirties the shared cacheline across other CPUs running fast-path RX/TX queues.
Using a per-CPU counter summed in tun_get_ethtool_stats() would avoid both
the false sharing and cross-CPU atomic contention across queues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204.rfcv11.99731.0.zakinko@snowrabbit.org?part=1
next prev parent reply other threads:[~2026-12-05 4:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 4:01 [PATCH RFC net v11 0/6] more virtio-net csum hardening Showta Ishizaki
2026-12-04 4:01 ` [PATCH RFC net v11 2/6] um: vector: trim skbs before verifying the header Showta Ishizaki
2026-12-05 4:01 ` sashiko-bot
2026-12-04 4:01 ` [PATCH RFC net v11 1/6] net: account for ingress-resolved virtio net hdr state Showta Ishizaki
2026-12-05 4:01 ` sashiko-bot [this message]
2026-12-04 4:01 ` [PATCH RFC net v11 3/6] virtio_net: parse tunnel csum_start little-endian Showta Ishizaki
2026-12-04 4:01 ` [PATCH RFC net v11 4/6] net: resolve uncommon partial checksums at ingress Showta Ishizaki
2026-12-05 4:01 ` sashiko-bot
2026-12-04 4:01 ` [PATCH RFC net v11 6/6] net: add a sysctl to opt out of virtio net hdr checksum validation Showta Ishizaki
2026-12-05 4:01 ` sashiko-bot
2026-12-04 4:01 ` [PATCH RFC net v11 5/6] net: virtio: compute the outer checksum of non-GSO tunnel packets Showta Ishizaki
2026-12-05 4:01 ` sashiko-bot
2026-12-04 4:06 ` [PATCH RFC net v11 0/6] more virtio-net csum hardening netdev-bot+sinfo
2026-12-05 4:01 ` sashiko-bot
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=sashiko-outbox-251038@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
--cc=zakinko@snowrabbit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.