Thread View: linux.kernel.netdev
6 messages
6 total messages
Started by Minxi Hou
Wed, 18 Nov 2026 06:54
[PATCH net v5 0/2] net: openvswitch: fix a feature leak on a failed change
Author: Minxi Hou
Date: Wed, 18 Nov 2026 06:54
Date: Wed, 18 Nov 2026 06:54
80 lines
14550 bytes
14550 bytes
ovs_dp_change() records the requested user features before it calls the update that can fail, so a request rejected for an empty per-cpu-pids leaves the datapath claiming a feature it never enabled. The tc skb extension key is a reference count shared with cls_flower, and the code that would keep it in step is skipped on that path. Patch 1 fixes the ordering, and drops the reference on the two other paths that take one and never give it back. Patch 2 adds a set-dp command to the openvswitch selftest tool, and two tests that send such a request and check the features the datapath reports afterwards. They fail without the fix and pass with it. The problem turned up while the YNL spec for this family was being written: describing the ovs_datapath set command meant reading ovs_dp_change(), where the ordering stands out. v5: - Rebased onto current net. - The two teardown paths clear only OVS_DP_F_TC_RECIRC_SHARING, so a datapath on its way out keeps the bits an upcall in flight still reads. A whole-field store clears OVS_DP_F_UNALIGNED between the two reads in queue_userspace_packet() and pad_packet() (reported by Sashiko). - queue_userspace_packet() reads the features once and gives that value to pad_packet(), so OVS_DP_CMD_SET cannot split the head room decision from the padding decision either. - The tests write their diagnostics to stderr, the skip message included. A copy of stdout stayed open in the daemons the suite starts, which kept the kselftest runner reading a pipe that never reached EOF, so the run hung after the last subtest (reported by Matthieu Baerts). - A datapath that cannot be read, and one that reports no features, are told apart and reported as such instead of as a feature mismatch, and a failed expectation carries its own description. - checkpatch reports nothing for either patch. v4: https://lore.kernel.org/netdev/20261115163134.3202677-1-houminxi@gmail.com/ - Rebased onto current main, the tests say why they failed, and a datapath that cannot be read is no longer reported as a feature mismatch. v3: https://lore.kernel.org/netdev/20261110174651.972936-1-houminxi@gmail.com/ - Cover the recirc bit as well as the dispatch bit. v2: https://lore.kernel.org/netdev/20261108123424.2825403-1-houminxi@gmail.com/ - Name the two paths that leaked a reference and fix both. v1: https://lore.kernel.org/netdev/20261107113403.797779-1-houminxi@gmail.com/ Neither leak has a test of its own. The reference count behind the bit is not visible from user space, so the tests read back the features a datapath reports: the reset drops them to zero where a test can see it, and a datapath freed after a failed creation leaves no state to check. The alignment race has no test either, because it needs a set or a destroy to land between two reads of the field on another CPU, which a functional test cannot schedule; the patch removes the second read instead. One thing this series leaves alone: ovs_add_dp() returns the status of the last command in its body rather than of the add, so the "|| return 1" that follows its calls cannot fail. That predates this series and every OVS test that uses it. Signed-off-by: Minxi Hou <houminxi@gmail.com> Minxi Hou (2): net: openvswitch: do not record user features when the change fails selftests/net/openvswitch: check that a failed set keeps the features net/openvswitch/datapath.c | 58 ++++-- net/openvswitch/datapath.h | 7 +- .../testing/selftests/net/openvswitch/config | 3 + .../selftests/net/openvswitch/openvswitch.sh | 195 ++++++++++++++++++ .../selftests/net/openvswitch/ovs-dpctl.py | 65 ++++++ 5 files changed, 310 insertions(+), 18 deletions(-) base-commit: 2a324a58a084c5cfd7e5a2f55e0786bee170a4a5 -- 2.56.1
[PATCH net v5 2/2] selftests/net/openvswitch: check that a failed set keeps the features
Author: Minxi Hou
Date: Wed, 18 Nov 2026 06:54
Date: Wed, 18 Nov 2026 06:54
377 lines
25808 bytes
25808 bytes
Add a set-dp command to ovs-dpctl for the kernel's datapath SET command,
and two tests that use it.
The first test clears the features of a fresh datapath, sets the dispatch
bit with a valid pid list, and clears them again. It then sends a set that
would set that bit with an empty per-cpu-pids. The request has to fail
with EINVAL, and the datapath has to keep reporting the features it had,
which a kernel that records them before the change reads as 0x8 instead of
0x0. A second request sends OVS_DP_CMD_NEW for that name from an outdated
client, which makes the kernel drop the features, and a further set has
to work.
The second test covers the recirc bit. It sets that bit on a fresh datapath
and sends a set that would set the dispatch bit with an empty per-cpu-pids.
The rejected request has to leave the recirc bit in place. A kernel that
records the features first reads 0x8 there instead of 0x4. A datapath
holds that bit only when the tc skb extension is compiled in, so the test
prints the reason and skips when the kernel answers EOPNOTSUPP, and any
other failure of that request fails the test. CONFIG_NET_TC_SKB_EXT
depends on CONFIG_NET_CLS_ACT and both sit under CONFIG_NET_SCHED, so the
selftest config fragment selects all three.
The reference count itself is not visible from user space, so the steps
that use an outdated client only show that those paths run and that a
datapath keeps working across them.
set-dp sends the features it is given. When --features is left out it
sends the features the datapath reports, and it refuses to send the
request when the datapath reports none. A pid list that is not a list of
numbers is reported as such, and empty entries are dropped.
A failing run deletes debug.log, and ovs_sbx sends a command's stdout into
that same file, so the tests report a failure reason on stderr. stderr
still reaches the test runner from inside ovs_sbx, and unlike a duplicated
stdout it is not a second handle on the runner's pipe. The daemons the
suite starts outlive the script, and one that inherits such a handle keeps
the pipe open after the script exits, which leaves the run hanging until
the harness times out.
Every step that can fail says why it did. A datapath that cannot be read
is reported as that rather than as a feature mismatch: ovs-dpctl prints a
missing datapath and exits 0, and it leaves the features line out when the
kernel does not report them, so the check reads both cases from the output.
Reported-by: Matthieu Baerts <matttbe@kernel.org>
Link: https://lore.kernel.org/netdev/998d522f-e61d-420f-9834-6bdcbaab1361@kernel.org/
Signed-off-by: Minxi Hou <houminxi@gmail.com>
---
.../testing/selftests/net/openvswitch/config | 3 +
.../selftests/net/openvswitch/openvswitch.sh | 195 ++++++++++++++++++
.../selftests/net/openvswitch/ovs-dpctl.py | 65 ++++++
3 files changed, 263 insertions(+)
diff --git a/tools/testing/selftests/net/openvswitch/config b/tools/testing/selftests/net/openvswitch/config
index 15685d242813..38fa1477b7cd 100644
--- a/tools/testing/selftests/net/openvswitch/config
+++ b/tools/testing/selftests/net/openvswitch/config
@@ -2,10 +2,13 @@ CONFIG_GENEVE=m
CONFIG_INET_DIAG=y
CONFIG_IP_SCTP=y
CONFIG_IPV6=y
+CONFIG_NET_CLS_ACT=y
CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_DEMUX=m
+CONFIG_NET_SCHED=y
+CONFIG_NET_TC_SKB_EXT=y
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_OVS=y
CONFIG_NF_CT_PROTO_SCTP=y
diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
index 21444657a040..062ad7a45650 100755
--- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
+++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh
@@ -24,6 +24,8 @@ tests="
nat_connect_v4 ip4-nat-xon: Basic ipv4 tcp connection via NAT
nat_related_v4 ip4-nat-related: ICMP related matches work with SNAT
netlink_checks ovsnl: validate netlink attrs and settings
+ dp_features ovsdp: failed set keeps bits
+ dp_features_recirc ovsdp: recirc bit survives
upcall_interfaces ovs: test the upcall interfaces
tunnel_metadata ovs: test extraction of tunnel metadata
drop_reason drop: test drop reasons are emitted
@@ -1409,6 +1411,199 @@ test_netlink_checks () {
return 0
}
+ovs_dp_features_set() {
+ python3 $ovs_base/ovs-dpctl.py set-dp "$@"
+}
+
+ovs_dp_features_check() {
+ local out
+
+ # A datapath that cannot be read and a datapath that reports other
+ # features are different faults, so they return different statuses.
+ # ovs-dpctl prints a missing datapath instead of failing, and it leaves
+ # the features line out when the kernel does not report them, so both
+ # have to be recognised in the output. It prints the value with %X, so
+ # convert before comparing.
+ out=$(python3 $ovs_base/ovs-dpctl.py show "$1") || {
+ printf '# could not run ovs-dpctl show %s\n' "$1" >&2
+ return 2
+ }
+ case $out in
+ *"No DP found"*)
+ printf '# the datapath %s does not exist\n' "$1" >&2
+ return 2
+ ;;
+ *"features: 0x"*) ;;
+ *)
+ printf '# the datapath %s reports no features\n' "$1" >&2
+ return 2
+ ;;
+ esac
+ printf '%s\n' "$out" |
+ grep -q "features: 0x$(printf '%X' "$2")\$"
+}
+
+# info() writes debug.log, and a failing run deletes that file, so a FAIL
+# would reach CI with no reason. ovs_sbx sends a command's stdout to that
+# file too, which is why this writes to stderr: it is the one stream that
+# still reaches the test runner from inside ovs_sbx. Do not duplicate stdout
+# for this. The suite spawns daemons that outlive the script, and a second
+# handle on the runner's pipe keeps it open after the script exits, which is
+# a run that never finishes.
+ovs_fail() {
+ printf '# %s\n' "$*" >&2
+ return 1
+}
+
+ovs_dp_features_expect() {
+ local rc
+
+ ovs_dp_features_check "$1" "$2"
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ # The check already said why it could not answer; this adds the
+ # expectation that was not met.
+ ovs_fail "$3"
+ return 1
+ fi
+ return 0
+}
+
+# EOPNOTSUPP is not in the base errno list and its number differs by
+# architecture, so ask python instead of hard-coding one.
+ovs_errno() {
+ local n
+
+ n=$(python3 -c "import errno; print(errno.$1)" 2>/dev/null)
+ if [ -z "$n" ]; then
+ printf '# could not read errno.%s from python\n' "$1" >&2
+ return 1
+ fi
+ printf '%s\n' "$n"
+}
+
+# dp_features test
+# - a set with the dispatch bit and pids is accepted and reported back
+# - a set with an empty per-cpu-pids is rejected with EINVAL and leaves
+# the features as they were
+# - an outdated new request drops the features, and sets work afterwards
+test_dp_features() {
+ local t="test_dp_features"
+ local dp="dpfeat0"
+
+ sbx_add "$t" || return $?
+ ovs_add_dp "$t" "$dp" || return 1
+
+ info "clear the datapath features"
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 0 ||
+ { ovs_fail "the datapath features could not be cleared"; return 1; }
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 0 \
+ "features were not cleared" || return 1
+
+ # 8 is OVS_DP_F_DISPATCH_UPCALL_PER_CPU, the bit that makes the
+ # kernel read per-cpu-pids.
+ info "a set with the dispatch bit and pids is accepted"
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 8 \
+ --per-cpu-pids 1,2 ||
+ { ovs_fail "the set with dispatch and pids failed"; return 1; }
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 8 \
+ "the accepted set was not applied" || return 1
+
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 0 ||
+ { ovs_fail "the features could not be cleared"; return 1; }
+
+ # ovs-dpctl sends the empty list as an attribute with no payload,
+ # which is what the kernel rejects.
+ info "a set with an empty per-cpu-pids is rejected"
+ einval=$(ovs_errno EINVAL) || return 1
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 8 \
+ --per-cpu-pids "" &> /dev/null
+ rc=$?
+ [ $rc -eq "$einval" ] || {
+ ovs_fail "the empty per-cpu-pids set failed with $rc"
+ return 1
+ }
+
+ info "the rejected set keeps the features it had"
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 0 \
+ "the rejected set changed the features" || return 1
+
+ # An outdated client that asks for an existing datapath again makes
+ # the kernel drop its features. The datapath keeps working.
+ info "an outdated new request drops the features"
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 8 ||
+ { ovs_fail "the datapath rejected the dispatch bit"; return 1; }
+ ovs_sbx "$t" python3 $ovs_base/ovs-dpctl.py add-dp "$dp" -V 1:0 || {
+ ovs_fail "the outdated add request did not run"
+ return 1
+ }
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 0 \
+ "the outdated new request did not drop the features" || return 1
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 8 || {
+ ovs_fail "the datapath stopped accepting sets"
+ return 1
+ }
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 8 \
+ "the reset datapath took no features" || return 1
+
+ return 0
+}
+
+# dp_features_recirc test
+# - a datapath that holds the recirc bit keeps it across a rejected set
+# - an outdated new request drops the features
+# - the bit needs CONFIG_NET_TC_SKB_EXT, so the test skips without it
+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 ||
+ { ovs_fail "the datapath features could not be cleared"; 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 '# no tc skb extension, skipping recirc\n' >&2
+ ovs_exit_sig
+ return $ksft_skip
+ fi
+ ovs_fail "the recirc set failed with $rc"
+ return 1
+ fi
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 4 \
+ "the accepted recirc set was not applied" || return 1
+
+ info "the rejected set keeps the recirc bit"
+ einval=$(ovs_errno EINVAL) || return 1
+ ovs_sbx "$t" ovs_dp_features_set "$dp" --features 8 \
+ --per-cpu-pids "" &> /dev/null
+ rc=$?
+ [ $rc -eq "$einval" ] || {
+ ovs_fail "the rejected set failed with $rc"
+ return 1
+ }
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 4 \
+ "the rejected set dropped the recirc bit" || return 1
+
+ info "an outdated new request drops the features"
+ ovs_sbx "$t" python3 $ovs_base/ovs-dpctl.py add-dp "$dp" -V 1:0 || {
+ ovs_fail "the outdated add request did not run"
+ return 1
+ }
+ ovs_sbx "$t" ovs_dp_features_expect "$dp" 0 \
+ "the outdated new request did not drop the features" || return 1
+
+ return 0
+}
+
test_upcall_interfaces() {
sbx_add "test_upcall_interfaces" || return 1
diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
index 1615843c225e..efad71649a63 100644
--- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
+++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
@@ -2301,6 +2301,25 @@ class OvsDatapath(GenericNetlinkSocket):
return reply
+ def set(self, dpname, ifindex=0, features=None, per_cpu_pids=None):
+ """ Send OVS_DP_CMD_SET for a datapath. """
+ msg = OvsDatapath.dp_cmd_msg()
+ msg["cmd"] = OVS_DP_CMD_SET
+ msg["version"] = OVS_DATAPATH_VERSION
+ msg["reserved"] = 0
+ msg["dpifindex"] = ifindex
+ msg["attrs"].append(["OVS_DP_ATTR_NAME", dpname])
+ if features is not None:
+ msg["attrs"].append(["OVS_DP_ATTR_USER_FEATURES", features])
+ if per_cpu_pids is not None:
+ msg["attrs"].append(["OVS_DP_ATTR_PER_CPU_PIDS", per_cpu_pids])
+
+ reply = self.nlm_request(
+ msg, msg_type=self.prid, msg_flags=NLM_F_REQUEST | NLM_F_ACK
+ )
+
+ return reply[0]
+
def create(
self, dpname, shouldUpcall=False, versionStr=None, p=OvsPacket()
):
@@ -2961,6 +2980,23 @@ def main(argv):
deldpcmd = subparsers.add_parser("del-dp")
deldpcmd.add_argument("deldp", help="Datapath Name")
+ setdpcmd = subparsers.add_parser("set-dp")
+ setdpcmd.add_argument("setdp", help="Datapath Name")
+ setdpcmd.add_argument(
+ "-f",
+ "--features",
+ type=lambda x: int(x, 0),
+ default=None,
+ help="Datapath user features, defaults to the current value",
+ )
+ setdpcmd.add_argument(
+ "-p",
+ "--per-cpu-pids",
+ type=str,
+ default=None,
+ help="Comma separated upcall pids, an empty string sends none",
+ )
+
addifcmd = subparsers.add_parser("add-if")
addifcmd.add_argument("dpname", help="Datapath Name")
addifcmd.add_argument("addif", help="Interface name for adding")
@@ -3057,6 +3093,35 @@ def main(argv):
ovspk.upcall_handler(ovsflow)
elif hasattr(args, "deldp"):
ovsdp.destroy(args.deldp)
+ elif hasattr(args, "setdp"):
+ rep = ovsdp.info(args.setdp, 0)
+ if rep is None:
+ print(f"DP '{args.setdp}' not found.")
+ return 1
+ pids = None
+ if args.per_cpu_pids is not None:
+ # Empty entries are typos in a list the user did write, so drop
+ # them. An empty string leaves pids as [] and not None, which
+ # set() sends as an attribute with no payload: the kernel refuses
+ # that with EINVAL, and the selftest counts on the refusal.
+ try:
+ pids = [int(x) for x in args.per_cpu_pids.split(",")
+ if x != ""]
+ except ValueError:
+ print(f"invalid per-cpu-pids: {args.per_cpu_pids}")
+ return 1
+ features = args.features
+ if features is None:
+ features = rep.get_attr("OVS_DP_ATTR_USER_FEATURES")
+ if features is None:
+ print(f"DP '{args.setdp}' does not report its features")
+ return 1
+ try:
+ ovsdp.set(args.setdp, rep["dpifindex"], features, pids)
+ except NetlinkError as ne:
+ print(f"set failed: {ne.args[1]}")
+ return ne.code
+ print(f"DP '{args.setdp}' updated")
elif hasattr(args, "addif"):
rep = ovsdp.info(args.dpname, 0)
if rep is None:
--
2.56.1
Re: [PATCH net v5 2/2] selftests/net/openvswitch: check that a failed set keeps the features
Author: Matthieu Baerts
Date: Wed, 18 Nov 2026 09:45
Date: Wed, 18 Nov 2026 09:45
65 lines
14553 bytes
14553 bytes
Hi Minxi, Thank you for the new version. On 18/11/2026 07:54, Minxi Hou wrote: > Add a set-dp command to ovs-dpctl for the kernel's datapath SET command, > and two tests that use it. > > The first test clears the features of a fresh datapath, sets the dispatch > bit with a valid pid list, and clears them again. It then sends a set that > would set that bit with an empty per-cpu-pids. The request has to fail > with EINVAL, and the datapath has to keep reporting the features it had, > which a kernel that records them before the change reads as 0x8 instead of > 0x0. A second request sends OVS_DP_CMD_NEW for that name from an outdated > client, which makes the kernel drop the features, and a further set has > to work. > > The second test covers the recirc bit. It sets that bit on a fresh datapath > and sends a set that would set the dispatch bit with an empty per-cpu-pids. > The rejected request has to leave the recirc bit in place. A kernel that > records the features first reads 0x8 there instead of 0x4. A datapath > holds that bit only when the tc skb extension is compiled in, so the test > prints the reason and skips when the kernel answers EOPNOTSUPP, and any > other failure of that request fails the test. CONFIG_NET_TC_SKB_EXT > depends on CONFIG_NET_CLS_ACT and both sit under CONFIG_NET_SCHED, so the > selftest config fragment selects all three. > > The reference count itself is not visible from user space, so the steps > that use an outdated client only show that those paths run and that a > datapath keeps working across them. > > set-dp sends the features it is given. When --features is left out it > sends the features the datapath reports, and it refuses to send the > request when the datapath reports none. A pid list that is not a list of > numbers is reported as such, and empty entries are dropped. > > A failing run deletes debug.log, and ovs_sbx sends a command's stdout into > that same file, so the tests report a failure reason on stderr. stderr > still reaches the test runner from inside ovs_sbx, and unlike a duplicated > stdout it is not a second handle on the runner's pipe. The daemons the > suite starts outlive the script, and one that inherits such a handle keeps > the pipe open after the script exits, which leaves the run hanging until > the harness times out. > > Every step that can fail says why it did. A datapath that cannot be read > is reported as that rather than as a feature mismatch: ovs-dpctl prints a > missing datapath and exits 0, and it leaves the features line out when the > kernel does not report them, so the check reads both cases from the output. > > Reported-by: Matthieu Baerts <matttbe@kernel.org> No need to send a new version for that, but next time, I think it would be better to include an individual changelog per patch in the notes (under '---'). There, you can mention that the v5 addresses the error visible on the CI that I reported, instead of adding my Reported-by tag here: I didn't report the whole issue that makes you write the patch. (I didn't review the patch, but I can see you did some modifications) https://netdev-ctrl.bots.linux.dev/ansiview.html?f=/logs/build/1214612/diff/b4-diff.ansi Cheers, Matt -- Sponsored by the NGI0 Core fund.
Re: [PATCH net v5 2/2] selftests/net/openvswitch: check that a failed set keeps the features
Author: Minxi Hou
Date: Wed, 18 Nov 2026 11:12
Date: Wed, 18 Nov 2026 11:12
15 lines
11383 bytes
11383 bytes
Hi Matt, Both make sense, and I will do both. I will put a changelog per patch in the notes under --- next time, and mention the CI error there as context instead of a Reported-by tag. You reported the hang, not the ordering bug behind it, and the trailer claimed otherwise. The CI link was how I found the hang at all, so thanks for that. No new version for this one, as you said. Minxi
Re: [PATCH net v5 2/2] selftests/net/openvswitch: check that a failed set keeps the features
Author: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 07:29
Date: Sun, 22 Nov 2026 07:29
119 lines
12562 bytes
12562 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 Reported-by trailer probably does not belong on this commit.
- [Low] A comment in the new set-dp branch of main() in ovs-dpctl.py says
something the kernel does not do.
--
selftests/net/openvswitch: check that a failed set keeps the features
This adds a set-dp subcommand to ovs-dpctl.py that sends OVS_DP_CMD_SET.
It also adds two selftests, dp_features and dp_features_recirc. They check
that a set rejected for an empty per-cpu-pids leaves the datapath features
unchanged. The config fragment also enables NET_SCHED, NET_CLS_ACT and
NET_TC_SKB_EXT for the recirc test.
Link: https://lore.kernel.org/netdev/998d522f-e61d-420f-9834-6bdcbaab1361@kernel.org/
> Reported-by: Matthieu Baerts <matttbe@kernel.org>
> Link: https://lore.kernel.org/netdev/998d522f-e61d-420f-9834-6bdcbaab1361@kernel.org/
[Severity: Low]
Does this Reported-by belong on this commit? The commit adds the set-dp
subcommand, the two new tests and three config lines. It doesn't fix an
existing defect.
The kernel bug these tests cover is fixed in the parent commit "net:
openvswitch: do not record user features when the change fails". That
commit has no Reported-by.
The commit message describes two problems:
- a run that hangs when stdout is duplicated
- a FAIL with no reason when the reason only goes to debug.log
Neither can happen with the baseline openvswitch.sh, because the
dp_features tests don't exist there yet. The report was probably about an
earlier, unmerged revision of this patch. The linked message couldn't be
checked from the tree.
Documentation/process/submitting-patches.rst says the tag "is intended for
bugs". Could feedback on an earlier revision be credited in the changelog
below the --- line instead? If Matthieu reported the kernel bug, the tag
could go on the kernel fix.
> diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
> index 1615843c225e4..efad71649a630 100644
> --- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
> +++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
[ ... ]
> @@ -2961,6 +2980,23 @@ def main(argv):
[ ... ]
> + setdpcmd.add_argument(
> + "-p",
> + "--per-cpu-pids",
> + type=str,
> + default=None,
> + help="Comma separated upcall pids, an empty string sends none",
> + )
[ ... ]
> @@ -3057,6 +3093,35 @@ def main(argv):
> ovspk.upcall_handler(ovsflow)
> elif hasattr(args, "deldp"):
> ovsdp.destroy(args.deldp)
> + elif hasattr(args, "setdp"):
> + rep = ovsdp.info(args.setdp, 0)
> + if rep is None:
> + print(f"DP '{args.setdp}' not found.")
> + return 1
> + pids = None
> + if args.per_cpu_pids is not None:
> + # Empty entries are typos in a list the user did write, so drop
> + # them. An empty string leaves pids as [] and not None, which
> + # set() sends as an attribute with no payload: the kernel refuses
> + # that with EINVAL, and the selftest counts on the refusal.
[Severity: Low]
Is this comment accurate? The kernel only looks at OVS_DP_ATTR_PER_CPU_PIDS
when the requested features include OVS_DP_F_DISPATCH_UPCALL_PER_CPU:
net/openvswitch/datapath.c:ovs_dp_change() {
...
if (user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU &&
a[OVS_DP_ATTR_PER_CPU_PIDS]) {
/* Upcall Netlink Port IDs have been updated */
err = ovs_dp_set_upcall_portids(dp,
a[OVS_DP_ATTR_PER_CPU_PIDS]);
...
}
The !nla_len(ids) check that returns -EINVAL is inside
ovs_dp_set_upcall_portids(), so it only runs on this path.
datapath_policy[] has no entry for OVS_DP_ATTR_PER_CPU_PIDS.
That means set-dp <dp> --per-cpu-pids "" gets an ACK when --features lacks
bit 0x8. It also gets an ACK when --features is left out and the datapath
doesn't report 0x8. In both cases the tool prints "DP '...' updated" and
exits 0, not 22.
Both current tests pass --features 8, so they do get EINVAL. Could the
comment say that the refusal depends on the dispatch bit?
The --per-cpu-pids help text "an empty string sends none" has a similar
problem. An empty attribute is still sent, so the text reads as if no
attribute were sent.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118065435.2367014-1-houminxi%40gmail.com
Re: [PATCH net v5 2/2] selftests/net/openvswitch: check that a failed set keeps the features
Author: Minxi Hou
Date: Mon, 23 Nov 2026 16:05
Date: Mon, 23 Nov 2026 16:05
12 lines
11105 bytes
11105 bytes
Both nits are taken. The Reported-by: is on the kernel fix in v6, next to the Link: to your report, and this patch carries none. The note in the set-dp branch of main() was wrong about the mechanism. The kernel rejects the attribute with -EINVAL in two cases, a length of zero and a length that is not a multiple of four, and the tests use the first one. It now says that. v6 is three patches and follows as its own thread.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads