Re: [PATCH net 1/2] virtio_net: Don't DMA map the kernel image for the AF_XDP TX header
From: netdev-bot+sashiko
Date: Sun Nov 08 2026 - 00:42:12 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message's second reason for the change does not match
what the patch does.
--
virtio_net: Don't DMA map the kernel image for the AF_XDP TX header
This patch removes the static xsk_hdr that lives in the kernel image. In
its place, virtnet_xsk_pool_enable() now kzalloc's a header for each send
queue, and virtnet_xsk_pool_disable() frees it. The point is to stop
virtqueue_map_single_attrs() from rejecting the mapping on arm64, where
the kernel image sits in the vmalloc area.
> and binding an AF_XDP zero-copy socket fails with -ENOMEM. Even where
> the mapping succeeds, the header shares cache lines with unrelated data.
[Severity: Low]
Does the second sentence here match what the patch does? It reads as
though the patch also gives the header its own cache line.
virtnet_xsk_pool_enable() now uses a plain allocation:
sq->xsk_hdr = kzalloc_obj(*sq->xsk_hdr);
This is a small object of about 24 bytes, the size of struct
virtio_net_hdr_v1_hash_tunnel. It has no cache-line alignment or padding.
__kmalloc_minalign() in mm/slab_common.c can also lower the kmalloc
minimum alignment:
if (IS_ENABLED(CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC) &&
is_swiotlb_allocated())
minalign = ARCH_KMALLOC_MINALIGN;
So the new header can still share cache lines with other slab objects.
The header is also mapped DMA_TO_DEVICE only. That means sharing a cache
line would not cause a correctness problem for this mapping in the first
place.
Could this sentence be dropped, or reworded so it doesn't suggest the
patch provides cache-line isolation? The main reason given, the vmalloc
rejection on arm64, looks correct.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261107125723.33547-1-yanhaishuang%40cmss.chinamobile.com