Re: [PATCH net 1/2] virtio_net: Don't DMA map the kernel image for the AF_XDP TX header

From
netdev-bot+sashiko@kernel.org
Date
2026-11-08 05:41:17
Also in
bpf, lkml, virtualization
Reply to
Haishuang Yan, 2026-11-07
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
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