๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12639

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

#12639
From: netdev-bot+sashiko
Date: Sun, 08 Nov 2026 05:41
53 lines
10047 bytes
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
Technical Details
Message-ID: <179411647562.994134.8636776015987575971@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358592-linux-kernel-netdev=dewy.ru
References: <20261107125723.33547-2-yanhaishuang@cmss.chinamobile.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358592-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/2] virtio_net: Don't DMA map the kernel image for
 the AF_XDP TX header
Date: Sun, 08 Nov 2026 05:41:15 +0000
Organization: Usenet Network
Message-ID: <179411647562.994134.8636776015987575971@kernel.org>
References: <20261107125723.33547-2-yanhaishuang@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="74798"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6kPmNWZaN9Jdan0+bTM/oU9/GrM= sha256:O9+CIgCss2VP13A36IqiU6MS+zMMEKIRSGm3uK1RNQo=
	sha1:L8ulvd0Nd1WCLJvfJHlMC7sQBm8= sha256:kbPb9Yg447hatXFTa/wH1+65a/y+wW+OcDKdySQdZUw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E7CFA11350F; Sun,  8 Nov 2026 08:41:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id yytbzbA614TI;
	Sun,  8 Nov 2026 08:41:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358592-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 1510A1132B2; Sun,  8 Nov 2026 08:41:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 41CE82D82D; Sun,  8 Nov 2026 05:41:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794116478;
	b=4BZ5BZ05YPS2PmZ2sMyAJwS057jUrGdYgcc1LhbHfHIhtFu5zVCvOFUGUOjDqSiDPWBq
	 hUgO92HXjUqZXwes2VG96dxQHAAbusUjW2mxhio/Ead3oofCUbC8GgyOKeEbcwqBTk/Ke
	 rPlyc1Zg/aduPCYFfyNxqEkIYXbRw7Djr4vA4+qFC6NEQjlATDBig2zJ6DjkR7Jcd1M+X
	 YA3uvkaIK9DiIiYqfnc4qajNI8Y7IqMYK8Y6sOj2elPMW8W+294Aq380iZSKerVZ182p6
	 swyx+Sqe9KFnMwfghE+CZtT8isYlDnUyqmUvNCTNeljwNI3zkyF91VNKo3f6fIN9B9A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794116478;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=Y4BnRauqxdriNjwPu4pmz4HUBHW9FKJ4IoblZFFndPo=;
	b=DnIToUdUl2yakFbJViSLosnIROoPVM4oJMhUa2BTQbI3QbmjxJkM1SVFXJeL7fFOhMKk
	 C8S+Qi1VGFUeLnGhPVMKTEWJcHGFBQJOlTt/kOzWYiXnYOkuU6nCf7Q6H9NikoT0yzBe8
	 SuCBehkJijlIqm6tgjrC4+Af3gW/9qWNZdWKC3XLateBAB6vcgm/X1pjJp5QKidQQXdhR
	 lu1aZnsYR7TwRkg0YFbxLfCzwIG3MgYvbCxOVSxJ+0L0SfRAKDsUGvR+0tUM0wDA1GP2E
	 2bn+iPNO4jBNm1q586DkQHDqm+DhqsxfHG11RvWhYUVjex4rKUb4WqkOmyFBUgQB5jw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="f9z7/u1+";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B9008606A332;
	Sun,  8 Nov 2026 05:41:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f9z7/u1+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794116477;
	b=oZzlycrTYv2JXBtRIM2mT9+PRzWK0NvLlT61IA+rPQyUyBLvLy6bPBgTeysLhrZK63Sr
	 vrFE2VOOvROBbWoA1VVDIITR+2ft1eSZys6+H1I0cquqasBapg1nzz9m5WRm2BO2W21rY
	 PFHvTz5M9Wy91sEkUHiW1zk9XEJeb80DMAbgrXIhfTv6WUYVxzm9F46Xuy2fRYI70DWBC
	 QEsv62BL/PR5fcdsMppikTXmMulFoiEB3vkCFeK1bJzMuuV7o6oVst/1tqneFmKiKsDlA
	 n/IowHrOKkCvyQAlYrpUZe3MX8o1mS5TDEx+E6CZSSYFRwjgJ2SuDggnjmNtQZpBkYQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794116477;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=Y4BnRauqxdriNjwPu4pmz4HUBHW9FKJ4IoblZFFndPo=;
	b=Kf57+TTyAlDbsT0KDXxygCherh7mcGuFgda0hjLZyVnoL5CwFJpGMvXNJn1TLmx0FjfD
	 yz/oKg2CXyuGQtGTvuuFVXdSKsAX7wUOHfZoJOUVr9oqw/aBsy+aA9WZEjQP+7piJQLTn
	 9EqID1cnqBLib2UeD+knXakUebNIm6i7ZZrvYPddWAYcUGmOCzJ3q0zguhuTCeix9v4+X
	 Da5sASLwSiU+tpAoo912O30c1APEWu2LyQhuJcXdbZAcaIbKjA09xDlgoV5FTfRpT99VD
	 +pUs5H57Ds4AvKYdl59R3/QqA3H72zpWEBkNi0g6HPeFdNHFKBz+75FlSXf05GZ9BRQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="f9z7/u1+";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B38F606A31A;
	Sun,  8 Nov 2026 05:41:17 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 188A51F0089F;
	Sun,  8 Nov 2026 05:41:16 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794116477;
	bh=Y4BnRauqxdriNjwPu4pmz4HUBHW9FKJ4IoblZFFndPo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=f9z7/u1+Z4WkFL1MGxY8DDM31eyxR8d5T1CUogoA30rKuuwWB3yX6ZP7reeJjpqJk
	 jHBFwQgPg+1Ug1GvFFOKnOYckttmv5rrSZB+C5ev0qIF2z0+UngPrndZ7K9d64Ipjt
	 Y4cYz0TYtAusxC4ly+ddp4B1xXZ5jhg+4RY1Pq0Qh939hpTGBDx2BgKkjzpZu1izBg
	 MgsJqOppvP6iUhrg3ojnXkDpSKPL+WlpKezmCaNbgJUbmfrwtB7ri9qr5vZDGP23L9
	 DzX2GzYiMX1x11YwhVnlt+3/Sp29p+rXDRxIvTCbHp7s4W+HsOCOWwJpnUNDk2POqy
	 l4Gb+mFw4U6Rw==
X-Cc: mst@redhat.com, jasowangio@gmail.com, xuanzhuo@linux.alibaba.com,
 eperezma@redhat.com, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
 daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
 sdf@fomichev.me, netdev@vger.kernel.org, virtualization@lists.linux.dev,
 bpf@vger.kernel.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261107125723.33547-2-yanhaishuang@cmss.chinamobile.com>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list