Re: [PATCH net 2/2] virtio_net: Keep AF_XDP zero-copy pools bound across suspend

From
Haishuang Yan <hidden>
Date
2026-11-08 09:24:32
Also in
bpf, lkml, virtualization
Reply to
netdev-bot+sashiko@kernel.org, 2026-11-08
On Sun, Nov 08, 2026 at 05:41:17AM +0000, netdev-bot+sashiko@kernel.org wrote:
quoted hunk ↗ jump to hunk
- [High] virtnet_xsk_pools_unbind() calls virtnet_xsk_pool_disable() for
  pools whose AF_XDP sockets are still XSK_BOUND.
- [High] virtio_net: stale DMA addresses in free_list after unaligned XSK
  pool rebind
- [High] virtio_net: uninitialized xsk_hdr_dma_addr used in
  virtnet_xsk_pool_enable()
- [Medium] virtnet_xsk_pools_unbind()
  (drivers/net/virtio_net.c:6063-6072) loops over max_queue_pairs and…
Thanks, I went through all four against the code and they all hold.

The three High ones come from the same mistake: the patch reuses
virtnet_xsk_pool_disable()/enable(), which assume the socket is
already unbound, while the sockets are still bound and the device is
still running. That opens the window against the RX path redirecting
to the socket, unmaps and remaps the pool behind buffers sitting on
its free_list, and lets TX NAPI run before xsk_hdr_dma_addr is set.

For v2 I'll stop unmapping and remapping the pool across suspend.
Freeze will keep the pool DMA mapping and only stash the driver's
per-queue xsk state after virtnet_freeze_down() has stopped NAPI, and
restore will attach it to the new queues before virtnet_open(). That
should remove all three problems instead of patching each one.

The Medium one is right too. A pool can be left bound on a queue at
or above curr_queue_pairs after native XDP is detached. As noted, that
comes from virtnet_xdp_set() not checking for bound pools, which
predates this patch. I'll fix it there as a separate patch in the
series, so suspend no longer has to handle that case.

v2 will be retested with KASAN for both aligned and unaligned pools.

pw-bot: cr

Thread (8 messages) 8 messages, 3 authors, last reply 9d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help