πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17334

Re: [PATCH net v4 2/2] selftests/net/openvswitch: check that a failed set keeps the features

#17334
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 16:33
168 lines
13829 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 patch adds `exec 9>&1` and `ovs_fail()` so that a FAIL prints
  its reason on the real stdout.
- [Low] ovs_dp_features_check's comment says "A show that fails and a
  datapath that reports other features are different faults, so they…
- [Low] The patch runs `exec 9>&1` once at the top level of
  openvswitch.sh (line 52) and never closes it.

--

selftests/net/openvswitch: check that a failed set keeps the features

This adds a set-dp command to ovs-dpctl.py that sends OVS_DP_CMD_SET. It
also adds two openvswitch.sh tests checking that a rejected set (dispatch
bit with an empty per-cpu-pids) leaves the datapath features unchanged.
The second test covers the recirc bit and skips when the kernel answers
EOPNOTSUPP.

> diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> index 21444657a0404..559c25d510998 100755
> --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
> +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh

[ ... ]

> @@ -44,6 +46,11 @@ info() {
>  	[ $VERBOSE = 0 ] || echo $*
>  }
>  
> +# ovs_sbx sends everything a command prints to debug.log, and a failing run
> +# deletes that file. Keep a handle on the real stdout so a failure reason
> +# still reaches the CI log.
> +exec 9>&1

[Severity: Low]
fd 9 stays open for the whole life of the script, and bash does not mark
it close-on-exec. That means every background daemon now inherits it.
This includes the upcall listener started by ovs_add_if -u and the
daemons started by ovs_netns_spawn_daemon():

	$*  >> $ovs_dir/stdout  2>> $ovs_dir/stderr &

These spawns redirect only fds 1 and 2.

Under the kselftest runner, fd 1, and so fd 9, is the write end of the
pipe into tap_prefix in run_one() in kselftest/runner.sh. tap_prefix
reads until EOF:

	(((( tap_timeout "$cmd" 2>&1; echo $? >&3) |
		tap_prefix >&4) 3>&1) |
		(read xs; exit $xs)) 4>>"$logfile"

If a daemon outlives the script, could this pipeline block until that
daemon exits?

One way a daemon could outlive the script is the retry branch in
run_test(). It removes the sandbox without running ovs_exit_sig:

	elif [ $ret -eq 2 ]; then
		rm -rf test_${tname}
		run_test "$1" "$2"

I could not find a current test that returns 2 after spawning a daemon,
so this needs such a leak to happen. Daemons may also already inherit
the runner's fds 3 and 4, which limits how much fd 9 adds.

fd 9 is only needed for the new >&9 diagnostics. Would it be better to
close it on the background spawns with 9>&-, or to open it only where
it is used?

[ ... ]

> +ovs_dp_features_check() {
> +	local out
> +
> +	# A show that fails and a datapath that reports other features are
> +	# different faults, so they return different statuses. ovs-dpctl prints
> +	# the value with %X, so convert before comparing.
> +	out=$(python3 $ovs_base/ovs-dpctl.py show "$1") || {
> +		printf '# could not read the datapath %s\n' "$1" >&9
> +		return 2
> +	}
> +	printf '%s\n' "$out" |
> +		grep -q "features: 0x$(printf '%X' "$2")\$"
> +}

[Severity: Low]
Can the return 2 path be reached when the datapath is missing? The show
branch of main() in ovs-dpctl.py only prints a message, and main() then
returns 0:

        if not found:
            msg = "No DP found"
            if args.showdp is not None:
                msg += ":'%s'" % args.showdp
            print(msg)

When OVS_DP_ATTR_USER_FEATURES is missing, print_ovsdp_full() leaves
out the features line and the exit status is still 0:

    if user_features is not None:
        print("  features: 0x%X" % user_features)

In both cases show exits 0, grep fails and the helper returns 1.
ovs_dp_features_expect() then prints the test-specific reason, for
example "the outdated new request did not drop the features", and not
"could not read the datapath". The "No DP found" text captured in $out
is thrown away.

[ ... ]

> +test_dp_features_recirc() {
> +	local t="test_dp_features_recirc"
> +	local dp="dpfeat1"
> +
> +	sbx_add "$t" || return $?
> +	ovs_add_dp "$t" "$dp" || return 1
> +
> +	ovs_sbx "$t" ovs_dp_features_set "$dp" --features 0 || return 1
> +
> +	# 4 is OVS_DP_F_TC_RECIRC_SHARING. The kernel takes the bit only when
> +	# the tc skb extension is compiled in.
> +	ovs_sbx "$t" ovs_dp_features_set "$dp" --features 4 &> /dev/null
> +	rc=$?
> +	if [ $rc -ne 0 ]; then
> +		eopnotsupp=$(ovs_errno EOPNOTSUPP) || return 1
> +		if [ $rc -eq "$eopnotsupp" ]; then
> +			# info() only writes debug.log, which CI does not keep.
> +			printf "# tc skb extension is not compiled in,"
> +			printf " skipping recirc\n"
> +			ovs_exit_sig
> +			return $ksft_skip
> +		fi
> +		info "the recirc set failed with $rc"
> +		return 1

[Severity: Low]
Should this be ovs_fail and not info()? With the default VERBOSE=0,
info() only appends to debug.log, and run_test() deletes $ovs_dir after
a FAIL:

	ovs_exit_sig
	[ "${PAUSE_ON_FAIL}" = "yes" ] || rm -rf "$ovs_dir"

So if the recirc set fails with anything other than EOPNOTSUPP, CI gets
a bare [FAIL] with no reason. The comment a few lines up says the same
thing about info().

The set-dp steps that only do "|| return 1" have the same gap. One is
the --features 0 step above. In test_dp_features() there are the
--features 0 steps and the --features 8 set before the outdated add-dp:

	ovs_sbx "$t" ovs_dp_features_set "$dp" --features 0 || return 1

ovs_sbx sends the "set failed: ..." or "DP ... not found." output from
ovs-dpctl.py to debug.log, so these failures also reach CI with no
reason.

[ ... ]

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115163134.3202677-1-houminxi%40gmail.com
Technical Details
Message-ID: <179484682148.3136.16392010517799748029@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364559-linux-kernel-netdev=dewy.ru
References: <20261115163134.3202677-3-houminxi@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364559-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v4 2/2] selftests/net/openvswitch: check that a failed
 set keeps the features
Date: Mon, 16 Nov 2026 16:33:41 +0000
Organization: Usenet Network
Message-ID: <179484682148.3136.16392010517799748029@kernel.org>
References: <20261115163134.3202677-3-houminxi@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2111825"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o1qU8QO2sggAPS6oz6ruxXvXeqE= sha256:ud+JzGA883sMR8fb1UXsPnucIBeXH4rXN0/QumXKtXw=
	sha1:8fiFHje2X2pSPzQJ0tDNRndgYPU= sha256:CC68INGXr4rOM27lf/cklSdvWryD4dv34vVvArQINk0=
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 31727114CE4; Mon, 16 Nov 2026 19:34:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 FEUvIoGpZcg4;
	Mon, 16 Nov 2026 19:34:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364559-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A6C3F114CE5; Mon, 16 Nov 2026 19:33:58 +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 483B52FCFC; Mon, 16 Nov 2026 16:33:44 +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=1794846823;
	b=ydNugJRTPWJkgNTeOwraixWRB5syQLjMd6YLBQI4V5FMAM/v3NjgP0jpd89gB/7W4sXv
	 dsdEqhQ7LYgrQtPDqMnjDTDA6QhWgrZ1g4Mr8Ve1jyRIuTkjmkO7bYC5Lay8+iccSJSIz
	 PpRVGyzwvL4JVO0TDFPXOIkA6Hz9gTglnbH1fSoV9CBkoTlY/dbXZAZ93h3oufZLQ73BH
	 yf8lqiEU5OsuzLBZNsgj4PlEnDlDYbWXchjpQk5KUdAvZAkskhjCRTHlS52gSXnxW38Gl
	 3UTlw7EVAAl5elgj0EE473cycZd4Jnk3O/Ob+lCGO07dKaLIMdbeyWTBIlyZY/oHn0A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794846823;
	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=ptEMg+KJOwEQxzXZlbSM1Cg78ADzSAlRdEto8HI8C4s=;
	b=qoaXc+9JVQ5V1ZRq+YMcdNulCPsxK7Gun9CFW1BltiaDfm/ZHFqCTxrl18kxtC5GBcGl
	 ylL+6JPiKkX21QB6/JKbK6OHC3SbVkzHPcBSeAMx8c/kG0OJ/qOSmkqOTBlJ0j1XYohk4
	 PjHEvm0kOYHmZZuFsVFlhe1XOQ07HcpOMGYv2cj43B5/bZ+x4PQ0lo4VdvdVF9OxNlG5g
	 6IriO1lgbm+O5ySeM7qPbV2GR4PYWEQUjtT8as6Un4Ly33DFl+dKTIt9L+ZL2ppXVcem2
	 iTGgN1XihMCdG9CP0ZRq3I/duIrzd1BdVtC6+9tOoGiQjECW0PA4JklTnvvCssqEcSg==
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=MBXNVCXH;
	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 9F3F3606A336;
	Mon, 16 Nov 2026 16:33:43 +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=MBXNVCXH
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=1794846822;
	b=UtIgWK5wyvHg2yf3EPN1XhN41cX9g/5k5HRD2mM2o3Wy6jg/AKLIEvk9En3Sy0wBZy1I
	 UtIZDEkpSkxP1755qtQRSkBKPpF4TuCsRQ3PR9mqmtIcVtCcE6q7AJGsCQtAXt7irHSP3
	 UQzrTsaHhT6UW1M48Eo03NRbCzVh/hmbceAcO4OQiC1l5YIHS/PYomnVsH78z60ULeKSf
	 zmr3PgL1eDnIPIgO0SOWfl/qP/uFJyMUv+aLOrfYBSmiL8o3XOCPT1FcfTxowiMYRMeih
	 kAeNPolZNkE3H1fhbaViSGWU5u3XN3e+f//1xHFAvsD6Uw3/ybqlUoiTzeZ/fpxp19Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794846822;
	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=ptEMg+KJOwEQxzXZlbSM1Cg78ADzSAlRdEto8HI8C4s=;
	b=ZghV99B8dDKwPWlyjJcW1dTwRVHXwA2zU9+yyu0+AK8mkWRJCa5ZUrI0MmjPYLhFmWwZ
	 5t8I9FgdsG8uVF7Xy7bP8YWoUfaUoP+vIDyoe62+AVm1XLjwqyqTooce+p4/QuJWK05as
	 VpwiTwFIvI90TaqQma4Hklvw95Td39l7LYFjgLmKrVNuNd0gnHRwnzbetVbTuX1yS0qDS
	 B0EylFahzqgmiLU14Ffa7q3HJLqnIAuhuTVXIh2mtSgtNGWAzzjuWUnwBq1ANCzhLFhl6
	 DHggReLVNnymgCq+U3/B/fWU+NOwiwyS44DmqxV9B14ePugTGQsHpoAILxrN7YOMqVA==
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=MBXNVCXH;
	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 C0343606A32A;
	Mon, 16 Nov 2026 16:33:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF2291F000CA;
	Mon, 16 Nov 2026 16:33:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794846822;
	bh=ptEMg+KJOwEQxzXZlbSM1Cg78ADzSAlRdEto8HI8C4s=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=MBXNVCXHIglAnQW2QvHh3jGLdu0vNUc/pjWPLfkook1pjVadTNW8dM4g4o2M8WfI6
	 xo5LDfFdejGY0ykzXQTokGIiiLif5qgiUb/neqaNkxRx1OttIcONIXTOZtMHR5+mTR
	 7nZ4Di3UnR/o8760pXLaAn0jALDOenvKNIIyYoyGmXcsR0FwIJoHJ9sbswT39+4iob
	 3kW+dScoOqcJSwLV4qGLcUGDtMf1smceRxL4Hqekw5swuS9VIiLPEBJlxXbisE8xXE
	 KXVv2sUjFyq00grGnn3Gjh05iP8Gm+/c5QpCPv8IStnDqDcHDWirdGlALfEnXfSRf4
	 CVAoFZnT5dVEw==
X-Cc: netdev@vger.kernel.org, aconole@redhat.com, echaudro@redhat.com,
 i.maximets@ovn.org, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 horms@kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261115163134.3202677-3-houminxi@gmail.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