🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15799

Re: [PATCH net v5 2/2] selftests: net: add a vhost-net test for the tun NAPI queue bound

#15799
From: Willem de Bruijn
Date: Fri, 13 Nov 2026 15:07
68 lines
14392 bytes
Antonio Quartulli wrote:
> On 13/11/2026 00:34, Willem de Bruijn wrote:
> > Antonio Quartulli wrote:
> >> Send 16k packets from vhost-net into a tap device with IFF_NAPI and
> >> netdev_max_backlog set to 8, in the three ways vhost-net passes packets
> >> to tun: batches of XDP buffers, one packet per sendmsg() with MSG_MORE,
> >> and zerocopy buffers. Check that excess packets are dropped and counted,
> >> that the queue keeps draining while vhost-net keeps sending, that every
> >> packet is either delivered or dropped, and that every buffer comes back
> >> to the ring. If a dropped zerocopy buffer is never completed, the test
> >> fails, and closing vhost-net then blocks until the buffer is released.
> >>
> >> The zerocopy variant needs vhost_net loaded with experimental_zcopytx
> >> set and is skipped otherwise; with it, vhost-net does not batch and the
> >> batch variant is skipped instead.
> > 
> > That means it will be skipped as part of kselftests.
> > 
> > And as a misc device all tests may be skipped in minimal environments
> > if vhost-net is not autoloaded.
> > 
> > Maybe a .sh wrapper could resolve both.
> 
> Right. With a wrapper script we should be able to deal with these.
> 
> >   
> >> The test drives a minimal split virtqueue itself, in little-endian as
> >> VIRTIO_F_VERSION_1 requires. It needs root and CONFIG_VHOST_NET.
> >> netdev_max_backlog is global: the test lowers it only once setup has
> >> succeeded and restores it first in teardown, and should not run in
> >> parallel with other tests.
> >>
> >> Written and tested with the help of an AI coding assistant (Claude
> >> Code).
> >>
> >> Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
> >> ---
> >>   tools/testing/selftests/net/.gitignore  |   1 +
> >>   tools/testing/selftests/net/Makefile    |   1 +
> >>   tools/testing/selftests/net/config      |   1 +
> >>   tools/testing/selftests/net/tun_vhost.c | 409 ++++++++++++++++++++++++
> >>   4 files changed, 412 insertions(+)
> >>   create mode 100644 tools/testing/selftests/net/tun_vhost.c
> > 
> > That's a lot of code for a fairly narrow test.
> > 
> > Not that long ago I would have applauded all test coverage we can get.
> > But now that LLMs generate them instantly, not sure where to draw the
> > line.
> 
> Well, the test has already done its job because it immediately helped me 
> fix some small itches in patch 1.
> 
> This said, I can definitely shrink this test a bit, maybe around 50% of 
> the current code. But it'll still be quite some code for a small fix.
> 
> Should I just drop this patch?
> 
> Alternatively, I drop it from this series and I send the shrunk-down 
> version with the wrapper script to net-next later on.
> 
> 
> Opinions?

If you could compress it to about 50%, let's merge.

Maybe we can use it over time for more coverage in this area.
Technical Details
Message-ID: <willemdebruijn.kernel.14b320acee076@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362715-linux-kernel-netdev=dewy.ru
References: <20261111014208.1795777-1-antonio@mandelbit.com> <20261111014208.1795777-3-antonio@mandelbit.com> <willemdebruijn.kernel.1220f3b31f685@gmail.com> <73aa2f53-e2ba-42b7-9712-06e223459144@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362715-linux-kernel-netdev=dewy.ru
From: willemdebruijn.kernel@gmail.com (Willem de Bruijn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 2/2] selftests: net: add a vhost-net test for the
 tun NAPI queue bound
Date: Fri, 13 Nov 2026 10:07:44 -0500
Organization: Usenet Network
Message-ID: <willemdebruijn.kernel.14b320acee076@gmail.com>
References: <20261111014208.1795777-1-antonio@mandelbit.com>
 <20261111014208.1795777-3-antonio@mandelbit.com>
 <willemdebruijn.kernel.1220f3b31f685@gmail.com>
 <73aa2f53-e2ba-42b7-9712-06e223459144@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1372694"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0ZRIyMmCYlB+h0kWhsNDnYnEve8= sha256:2Lq91tjqkRJTVEMuTmBXPY/ITg6oFjz1ZYhnvoLoxlg=
	sha1:PBACrUzCd9/pVh6cvpH0Fcxpqkc= sha256:agbfvK6ngvoTSSQai/k4clWVdNLphtEBG4g6FKKHkgQ=
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 CC8BC114564; Fri, 13 Nov 2026 18:27:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.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 Vp1Z66xigrbT;
	Fri, 13 Nov 2026 18:27:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-362715-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 09DC7114586; Fri, 13 Nov 2026 18:27:20 +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 C50CF2C4F7E; Fri, 13 Nov 2026 15:09:12 +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=1794582468;
	b=1EdKZEXu8xBcOYeK/IwfZ8JyOJ4sQSvxEnyCsxz5GzBXzF4up6vAul6vaeTqAgu3uCOc
	 WvDocFJFjeWbh+6wB/JoA5q4xVC8qzlUzTD5wQpIkyKN+y9NFDVaEjFZ2f9mf9e2/fBaY
	 fuTqLpuoefYmShcJGoI98IRIWSFRVcmU968HfkkNoNqwHg1Tkl2GAAak/pbivh3AAkWvq
	 6O4Pvttr8/ngcwP3wEKVEEPoALvmAhq16EAskxLnuUZ2o1GvTr0LLz5z7tbQoCo9WXWSP
	 CWf7nUejJLXOhWspfeMVZ16h9nDn+dfQ6J4/uTDpAO0gs0jarWyIwUBQe0BV93r4BWQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794582468;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Date:From:To:Cc:Message-ID:In-Reply-To:
	 References:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding;
	bh=Xdl4Tdbv431DSm2QRDQ9sk/ziyVXTlG68qSFJIbEu6c=;
	b=kVGG9vA4+rOW63pmyTqMO5E6PGAhLeKEOSzhjRZSvXRTZP0p+39fFhG9j3C8u8GHHNz6
	 +64NPgpuNyHQH4BcC8oxf2EN29hT7Kh4hK7RokKpGd5nBaJTJlKUAqCp1Y/irI97fh6Mf
	 RgOfyFl4jXH4t6fu8fh43UBRduKMIkYXKetFYUvMu1Y1Miy0veQtoZ39hUBvDOGznMraA
	 GyG1rhOP9Y0u8afkZL3uX5/cqgVGfTfkUHsfQi/bGXynTe/eQsYKdM4nxAHpebNrdAyCf
	 jHQLaYwXEZhzisk7pY7FRN0160jYbsH2Q/Pnh05SyXQdURnogNqRZnZWOnA+3PCEDhA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KlKFJQ5Q;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.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 11EE2606EB6D;
	Fri, 13 Nov 2026 15:07:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KlKFJQ5Q
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.174
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794582467;
	b=oi+IGOrJf8kqTNbVdUoAInZx0DsHDTvESK7D8lQssQOQImSBTqmKiFGvYXfE9QEYIcmC
	 kq3RFhz9U4STftwmk1JOB1TO8JvjvKXnWgWz0bjHvYqMn0tuGcDacgDj6PVdgS2U8L/S6
	 Ced5zRSYL/ug1+UeMn8nDtJfZf0pXuC+RyiM4RV6/tTUx5Qrx77BA/DsmeGK9PNHSVgcz
	 y51GTgztB0SD9GetnvJnHNXXQNPVbFclwUmG8mtDGenpH/Ma/oBGDfV1fvjIHaOGSqBVa
	 JIO1ZTPAv+LU/d1EDqnqnr/8O+hAJE+kuRePnz71enRVuP3/pUfsE0CArpbJ47QOvsQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794582467;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:
	 MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=Xdl4Tdbv431DSm2QRDQ9sk/ziyVXTlG68qSFJIbEu6c=;
	b=Jqz74pr0ibZ1Kf4CCMiih6H5xW0BkKLhWZNeBMmNJYnjVQZOtE+aQmjItD0weXT5hZel
	 HPYNAIOWI2QaNyWbvLLpwQA9hcHXRMsC8XhTs0Mu7eBT5nqzuRJrgb9wPAn3EmfxQ4WcA
	 NArRN7w7hYNhHWPUNku77vZZy07MNmw6mUMCSgWejoQL+gbNLnos1pIFUx7LE7eXvUUl6
	 cF++uRh+/RFgRD1CGKp1cTQKiBH0JjRraCcYUlcmxQSYfUw0M601zSntZhMlQT5cvcz39
	 zYVYEQiDT3urW8aUEMFdRgRGj2U2aOuWEZorbp5h/zyqeJaaE3tnPWcCfGaLXEh6N4A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=KlKFJQ5Q;
	arc=none smtp.remote-ip=209.85.221.174
X-Received: from mail-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D86A0606A898
	for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 15:07:46 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D86A0606A898
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-vk1-f174.google.com with SMTP id 71dfb90a1353d-5eaaa9b1591so1936693e0c.3
        for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 07:07:46 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794582466; x=1795187266; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:mime-version:subject
         :references:in-reply-to:message-id:cc:to:from:date:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=Xdl4Tdbv431DSm2QRDQ9sk/ziyVXTlG68qSFJIbEu6c=;
        b=KlKFJQ5QPmLUdTnjclUHm38zTF2SAkx0xiF0MhAa3Y89oCgC52J4hdLsyOdxXE9slo
         fkG2uJJxtO6pqBB0fdepdqPiia0eUjc9WNW5nj7L5EL8dt73uJxAG6IVVMx4psoVW7ww
         jwBeXuVj0KXEax7xTZnZrxu7dqfvMuEuP6BnOAqcCr++FtVqm4tGd4yS3Y1rN92TjGy4
         Ta5mjQ5XdVUN1FqFG3QuGnVMJ+9WaOhTbWILnZtdeHU/v9FJyjjiQG1cBkKqoIRemjQj
         mkQvg+v43o+eaVir/iQvs5GmAfIEILoS+Gi+D+NC2LwXcQGd1d2/rjq1t0y9hg+oTA0E
         KIeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794582466; x=1795187266;
        h=content-transfer-encoding:content-type:mime-version:subject
         :references:in-reply-to:message-id:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=Xdl4Tdbv431DSm2QRDQ9sk/ziyVXTlG68qSFJIbEu6c=;
        b=YpMHlR6ZRcezv9issh5ydkXhKLY2YUoo7QoR6Bq0qznlk9JjDl5QATFeUVF7PvwyDD
         uOG7Av21YbNFdVnysqDcF6pGn+mXjMTBn33Cu536PeDchXZilO+k+ejNet2Ja7AYh2/h
         o2YP5Pf/EvjJiBitVmIGdKbxhiA1Uy169JFKl1ZyJmVOX786BqBSPM+A17+rcEqEOXki
         qZlcx+h/JhILpssu2NDLCRIzs8d8FNcZYaehold4PttmXCRb6HzBwrW3R1AIEuFoMY9W
         jDWbUmXLKaNjYrAdKuIXdYSx5fSecBuLW2hFg9RmQtcVyyFnNvLDeJzuRBQWmG9vr72R
         LbgQ==
X-Forwarded-Encrypted: i=1; AL+hErG3uytoNxv7n6HqDj4AJXwCjdMG7SdlF/iyj1j5htnufLiyEbgRHt6TCwqfXIEOGbrhf9cAAAc=@vger.kernel.org
X-Gm-Message-State: APuU4Z/IHskMljVdSYTuSVV8x4TPIGJ43K8vTs9zXmYizXwS6B6Q+iCA
	ft27VGfElp+nd27hdQVj7ZvLpQJk9IT67ikmbyUgPGcK9iASQYGVf1wCkFuqhQ==
X-Gm-Gg: AYBFou2I48CgRpoBN3YUx1V78g77JJEmCeMQSLkfx5THlfLzpxYXp79eeD8ZzK8Rny5
	oolbBooGqyfor7QcQTZc1nZ49wbOsCSBn7YTUWfvX2FfLihNvU+xIrp6AyuAd/k+8Qm0S2jyfz4
	SbxI7MAR112j6+ymOqooKgbbK4DOZFv/A1YDWW4+NhGDOulfFIDHxdDSehmaE4QHM8DHFmAs4gU
	LHmbXx52FGNCPqFrv8dsxA8qgGZOzjiQ68W2hI4es3SY18nUnFhMGI7y3HWFwLNSnAGylfhabT2
	Vzg0wpoXSaszFgIvXxOw751aAS5U8ScST2+cL/x3ioVAwu6TnunJ2XXu0Me4c32gBSJsglSjft1
	au4iTxX6XLrarTbV/ijrkTn6+48bLLCFPx5DvaW8Q53mtguRo3q4FdeafQly6vB5jd7JvtxysEi
	XH7TklzNNtVGcpTptC9cUI/c+oC2OdOj0n4NNhdmTkmL13yvrwIBx6noLiNMFz6RoDPyE+c2qCl
	IEn+JIP6LvzjSmanWmeuf86gAVrPdFVV9Bn7Dq4AJtjaCwYasZnUj3+ZfTAOIZCg2z/F+yBwPOl
	hO7r4qzvg/JwZfgB86Nii8eFUGCHl4YnO6cHkgnL8i7hoPg7gy8FrHXVffMV/pFFs5da4y5WRTr
	0QBKsI9CIE4r2YCIO4lQ8I0nPrmWDGypYMlcopMY4V6rOUiEbMlmkZFRwxoa1IpHDO2hjrsKBkv
	y04ymLsIoG
X-Received: by 2002:a05:6122:3382:b0:5e9:176f:a548 with SMTP id 71dfb90a1353d-5ee344ee205mr1106421e0c.0.1794582465695;
        Fri, 13 Nov 2026 07:07:45 -0800 (PST)
X-Received: from gmail.com (15.60.86.34.bc.googleusercontent.com. [34.86.60.15])
        by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5ee3df52b8esm122502e0c.0.2026.11.13.07.07.44
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 13 Nov 2026 07:07:44 -0800 (PST)
X-Cc: andrew+netdev@lunn.ch, 
 davem@davemloft.net, 
 edumazet@kernel.org, 
 kuba@kernel.org, 
 pabeni@redhat.com, 
 horms@kernel.org, 
 mst@redhat.com, 
 eperezma@redhat.com, 
 shuah@kernel.org, 
 ast@kernel.org, 
 daniel@iogearbox.net, 
 hawk@kernel.org, 
 john.fastabend@gmail.com, 
 sdf@fomichev.me, 
 maheshb@google.com, 
 peterpenkov96@gmail.com, 
 netdev@vger.kernel.org, 
 virtualization@lists.linux.dev, 
 linux-kselftest@vger.kernel.org, 
 bpf@vger.kernel.org
X-In-Reply-To: <73aa2f53-e2ba-42b7-9712-06e223459144@mandelbit.com>
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