Article View: linux.kernel.netdev
Article #13700[PATCH net v3 0/2] virtio_net: AF_XDP zero-copy fixes for arm64 and XDP queues
From: Haishuang Yan
Date: Tue, 10 Nov 2026 15:29
Date: Tue, 10 Nov 2026 15:29
62 lines
11469 bytes
11469 bytes
Two AF_XDP zero-copy fixes for virtio_net. Patch 1: on arm64, binding a zero-copy socket fails with -ENOMEM and a "rejecting DMA map of vmalloc memory" warning whenever the device uses the DMA API (e.g. VIRTIO_F_ACCESS_PLATFORM), because the static TX header lives in the kernel image, which arm64 maps in the vmalloc area. Patch 2: removing XDP, explicitly or when the device is unregistered, can leave a zero-copy pool bound to a queue above curr_queue_pairs. Unbinding the socket then fails in the driver, and the queue is refilled from the freed pool. The suspend fix that was patch 3 in v2 is dropped from this series. Review found problems with it for pools on queues above curr_queue_pairs; it will be reworked and sent separately on top of these two. Testing used KASAN kernels in QEMU with virtio-net-pci and iommu_platform=on: - Patch 1 on arm64 (TCG, virt): binding an XDP_ZEROCOPY socket fails without the patch and succeeds with it. - Patch 2 on x86_64 (KVM, q35, intel-iommu, two queue pairs): with a socket bound to an XDP queue, removing XDP and then closing the socket gives "Failed to disable zero-copy!" and a KASAN use-after-free in xp_alloc_batch() on net, and no warnings with this series. Unbinding the device from virtio_net with XDP attached and a socket on an XDP queue gives "Failed to disable zero-copy!" on net, and no warning with this series. In both cases the unregister then keeps waiting for eth0 to become free; that also happens with only XDP attached and no socket, so it is a separate issue. The issues were found with the help of an AI coding assistant. Changes in v3: - Drop patch 3, to be reworked and sent separately (Sashiko). - Patch 2: mention the unregister path in the changelog (Sashiko). - Rebased on net 1d5e2c57e9ff; the code of patches 1 and 2 is unchanged. Changes in v2: - Patch 1: drop the sentence about cache lines from the changelog (Sashiko). - New patch 2, for a pool left on a queue above curr_queue_pairs (Sashiko). - Patch 3: rework (Sashiko). v2: https://lore.kernel.org/netdev/20261108193845.73621-1-yanhaishuang@cmss.chinamobile.com/ v1: https://lore.kernel.org/netdev/20261107125723.33547-1-yanhaishuang@cmss.chinamobile.com/ Haishuang Yan (2): virtio_net: Don't DMA map the kernel image for the AF_XDP TX header virtio_net: Disable AF_XDP pools on queues above curr_queue_pairs drivers/net/virtio_net.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) base-commit: 1d5e2c57e9ffc134e14b3f837c8d7c53b508bd22 -- 2.43.0
Technical Details
Message-ID:
<20261110153003.23731-1-yanhaishuang@cmss.chinamobile.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359943-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359943-linux-kernel-netdev=dewy.ru From: yanhaishuang@cmss.chinamobile.com (Haishuang Yan) Newsgroups: linux.kernel.netdev Subject: [PATCH net v3 0/2] virtio_net: AF_XDP zero-copy fixes for arm64 and XDP queues Date: Wed, 11 Nov 2026 00:29:59 +0900 Organization: Usenet Network Message-ID: <20261110153003.23731-1-yanhaishuang@cmss.chinamobile.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="552000"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:yVTQqteFItyk6NKdeyv7gOXWPEw= sha256:NtQOhnAXxdJEz2JvJCyYJ4N3qYkYoHAQqKQMaznaB7Y= sha1:2SjcuyHc9El2cheJf2h4UWoeVmE= sha256:tw20gBiMZVGqukwOkLK/EtI9ATmjVBHPv9eAfqyQoIY= 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 B9868113A7B; Tue, 10 Nov 2026 10:45:30 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.749 X-Spam-Status: No, score=-2.749 tagged_above=-9999 required=6.31 tests=[DATE_IN_FUTURE_06_12=0.001, DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=fail (1024-bit key) reason="fail (body has been altered)" header.d=cmss.chinamobile.com 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 4qZsjk4Ic10p; Tue, 10 Nov 2026 10:45:27 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-359943-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 1DA47113A77; Tue, 10 Nov 2026 10:45:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 0CD4081F24; Tue, 10 Nov 2026 07:37:07 +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=1794296195; b=lFiNgB5MJf+6XijH2wm5lGcwiRoHuMIi2v6XzlKhkADACGcEmxCV4KQdgs1WMFihq1iV yZ9ao6gV8AIaeq/wthfO9BTUU80kCOLn43oQxeJ2ZGiPsxUDHP4Blom9Ko35dThA8anwM swnSq7FV66rliN3SkOPFbBsVFlyGFAU6cOO7qoSy69lvhPVC5SyXvI27oUCpPLY4qChjS U7n7ce6/65YqgcY4vnfW0LMw/ZaNS0EIdk1mw97AYnB3uopi4WfghBX78GH/engE7BKKm iPiLi2UagJP5PA4yt4QL7yif7ez+VFPuI45MhdBUaAIeEppSoag+84IcevJx4YsygjQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794296195; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo: X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG: Received:X-RM-TRANSID:From:To:Cc:Subject:Date:Message-ID:X-Mailer: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=cFd6ezi/lAlBtvDnXCqb/PVYufkJTh2+r/D5VNJo2rw=; b=ZsNzfidNpup/LI4HttW1YCNyBqztNZr0bpJpwhxEvCB3MCQqHHpJsxbgXQGOToZ8xwK/ WnvpKUCo6q6Jf2vQixnQIcb5VGtXyvxyexbMtC6gXoVaGLRlJ/CqHxFRPvgIUe/cM8kE1 3zj0X/6ddMdkPnpb87ef/hGfKLsUQVztWv14wE2Nkt9I2zK/RXDWHChwQs7EqtQrTqIn7 GCmlEDFzWVVtwCb8udCLOqk4xWk8wnqUgW60eap6yPpPtkz0cRLPHBtdyl16VxYXfrxrv 54WSIEYQU6F/CpEIFDgM422oVMt98HYgCKYuDjCj0xA427UKVS+OMeeKyfj/e+DTV/w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=LfTc7lZL; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; 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 7252D60A261D; Tue, 10 Nov 2026 07:36:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=LfTc7lZL X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.139 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794296189; b=S11v7AEt5WRfLnYziYFk2FQx2zh5p9zFXlpyRRQc0Zr+yYmqDzYUaqWQdA+UqiJN5dN1 Xly6mM+JMrBVfu6sWmyDglSmje7+B8yWfpfwoUF9YDr1erVxPhhbE1ILNkvAfU/b+LAT5 1AXYTN5taWza9nzyR2yR3rLvF9Sp2QQTvjJ2XG+wBBIK42H6fk/wveKfkfaVwaWhv0QyE NIsRkqLmQJ4ba3kbH7odt9R/92lZds+0A7deuTPFZO6Og4olRflepdIYb79NryNoCJ1Yd dtbWoQrNCNwZhteBhuNqu0992wDrhCEH6ESgyuUY2mxw/BMaSQNe4lVU8OtIuHx5zvg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794296189; h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received: X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From: To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=cFd6ezi/lAlBtvDnXCqb/PVYufkJTh2+r/D5VNJo2rw=; b=yY5h5fyKc6dqEI6Q7dgtVcDB1hVuahU2nvjWo5BawLDmDNLCVOjOMFEDn04zRoUwIoMa Q6dGKputt4r38GBnV+BdjzV0U78rlfUDavGuwRYDLt7tyZmxHK8Z6T3wY7gXLXFzPMLb+ FOQI1vyti/YGmTAnd2WcbSPkEYiUwn1hqX4uTeOJTn/JxwtugUUoBk6Bs0gz+roebVIxM 5gtjWm9J2nA7kKxcF65q1ZRYI0wH8YAkBZx2KKu6fSgwQMes+a+kiY11PDcJPCLopJYTS TPyeoQWZBNdYOxOtdZkBGZs0sX9cWQjG84Q9cCrTSQuo/K5Oq6kMr4kqiVM9A83uAFw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=LfTc7lZL; arc=none smtp.remote-ip=111.22.67.139 X-Received: from cmccmta6.chinamobile.com (cmccmta6.chinamobile.com [111.22.67.139]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B192606A326; Tue, 10 Nov 2026 07:36:27 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7B192606A326 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmss.chinamobile.com; s=default; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=LfTc7lZLt4NTisK0hdvZcTeiA5o3yNBjieukBJ5S2AIVeRSJAmR0LsHpC3T2jU2HyOyH++aBgtDwD 2xeRppo4t5AGOdM3xnVSBye9/PWbLhcrsCoeKf/OM7rdntJKpNhhreVQCFDg8p3iYXIsAR9lStL8Ou zBhrwVnJY4VPPj0U= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee16af2c979c48-a803e; Tue, 10 Nov 2026 15:36:26 +0800 (CST) X-RM-TRANSID: 2ee16af2c979c48-a803e X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-Received: from openEuler-24.03.03 (unknown[74.82.203.40]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee36af2c970885-ab713; Tue, 10 Nov 2026 15:36:25 +0800 (CST) X-RM-TRANSID: 2ee36af2c970885-ab713 X-Cc: Eugenio PΓ©rez <eperezma@redhat.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, netdev@vger.kernel.org, virtualization@lists.linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: git-send-email 2.43.0 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