From nobody Tue Apr 14 20:48:44 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fwGbM4PPTz6ZQ72; Tue, 14 Apr 2026 20:49:03 +0000 (UTC) (envelope-from kp@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fwGbM3jQpz47p4; Tue, 14 Apr 2026 20:49:03 +0000 (UTC) (envelope-from kp@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776199743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FVsgswl9yS7qYHdnKaf5Zolv1BUDLAs/itZI9to5SG4=; b=r2GjntCQmROzAy9RB5v/wx0zjpKYFWq26ls8XnFk0avowvkjBT+tX+I3LXw/dcuylvJjtk LZqLPYrA2HlM4rdhCa5iLvXe1eRbFozsHSW8bFdT4e9StFRNNuJ78J4sPCzQ59GCL33Mpn dt5fIfQh2Htlqk2MEzIGEzc38O6izcspbDjygIPSXGp/kJHi43kEnRxPDxse3VKyk4UiGU rGdJ62PBgv2AhOgcX49SHf2bCTp6+SVQs7Zb8A4952WMm2VLOLp95LmOlGsvAyrR2xC7aD vvJXhTgdsJC7PKTPKBGxWchSeMzSAYWo2SD8HB5PiX5YwMW0uvO5Cwm7okfshQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776199743; a=rsa-sha256; cv=none; b=DBdZ+GDXCz5DiJlLX4hz7wcQ4/NyluXMykjJX/0l/z84XwUkpXcjphneSBi4oKNPVVSHcj mSHby0Nqlf6FRqgJokfYoa47tojnVGPxBCebrjl8Aj/er3micpdO7hh4NpsFdYok/fMg8s S6frZRGTzEpdefaN4sj4np6cceJp5FxVUdsZ36Xpdwbc/nO3VfmwO6Eu0nWajwOV5bmoac HEhMWgoLSLOH/+JTg1+5gXtiCUBqAiBrgUcHntS8AOnjAUy+ky/te0Ly2Nt6ILtXT6+WL8 39SwzbIbkfk1Z/Z4F2U/OCmzxqclOdpaGBGR/06njXJUC5hJ+lvxlB2kE1AprQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776199743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FVsgswl9yS7qYHdnKaf5Zolv1BUDLAs/itZI9to5SG4=; b=XL2yiX/hjoWKKDxEu2xW5to4EmloEqFPJyNYNhiEwFcdNj6LuLHLOek22lyO8452FV5nqq nUBmX+Tm39eYmpyFBAx/CTZRpIuZdj+K/FD/FqwPoui3p/0bdDF1lXUB0QPRvgyVSVz6C7 7Br7W/3fl8zBbtWw0WxCs8m55RZO9MSrGeW6fx9E1iy2NayQoNClpRHqFVbTW7iiGjQLdj jZ8Vq/7XNHZCabWFB3MW14VZ2IGZkv9tCDCrrz+/bBHB2MyX/1nSvf5WaKN+nD4yiQfL0D LOweJzP53rgNBBZarE5a/P4ZJ5VixlW1klPqjaHDuU5vvrdzRdliaO6a/xcAFw== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R12" (not verified)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4fwGbM1kNgz9VG; Tue, 14 Apr 2026 20:49:03 +0000 (UTC) (envelope-from kp@freebsd.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id ABCB216E7B; Tue, 14 Apr 2026 22:49:00 +0200 (CEST) Content-Type: multipart/alternative; boundary=Apple-Mail-19B8ACE6-3C3A-4FAD-8D9C-088FBE08E17B Content-Transfer-Encoding: 7bit From: Kristof Provost List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 (1.0) Subject: Re: git: e9fc0c538264 - main - if_clone: Make ifnet_detach_sxlock opaque to consumers Date: Tue, 14 Apr 2026 22:48:44 +0200 Message-Id: <582CBBF6-BBE9-49DB-8DF6-8EA56238E0F1@freebsd.org> References: Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org In-Reply-To: To: Zhenlei Huang X-Mailer: iPhone Mail (23E254) --Apple-Mail-19B8ACE6-3C3A-4FAD-8D9C-088FBE08E17B Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On 14 Apr 2026, at 19:46, Zhenlei Huang <zlei= @freebsd.org> wrote:

=
=EF=BB=BF

On Apr 14, 2026, at 11:57 PM, Kristof Prov= ost <kp@FreeBSD.org> w= rote:

On 1= 3 Apr 2026, at 6:39, Zhenlei Huang wrote:

The bran= ch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=3De9fc0c53826= 4355bd3fd9120c650078281c2a290

commit e9fc0= c538264355bd3fd9120c650078281c2a290
Author: Zhenlei Huang zle= i@FreeBSD.org
AuthorDate: 2026-04-13 04:38:44 +0000
Commit: Zhenlei Huang zle= i@FreeBSD.org
CommitDate: 2026-04-13 04:38:44 +0000

if_clone: Make ifnet_detach_sxlock opaque to consumers

The change e133271fc1b5e introduced ifnet_detach_sxlock, and change
6d2a10d96fb5 widened its coverage, but there are still consumers,
net80211 and tuntap e.g., want it. Instead of sprinkling it everywhere,
make it opaque to consumers.

Out of tree drivers shall also benefit from this change.

Reviewed by:    kp
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D56298

I don=E2=80=99t really understand wh= y, but this commit causes bricoler test runs to fail for me.
Or more precisely, it looks like parallel test runs see a number of failures= in the pf tests.

Reverting only part of this c= hange, specifically this:

diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index db3db78c1b76..d0fe54b6146b 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -683,11 +683,12 @@ if_clone_detach(struct if_clone *ifc)
        V_if_cloners_count--;
        IF_CLONERS_UNLOCK();

-       sx_xlock(&ifnet_detach_sxlock);
        /* destroy all interfaces for this cloner */
-       while (!LIST_EMPTY(&ifc->ifc_iflist))
+       while (!LIST_EMPTY(&ifc->ifc_iflist)) {
+               sx_xlock(&ifnet_detach_sxlock);
                if_clone_destroyif_flags(ifc, LIST_FIRST(&ifc->ifc_if=
list), IFC_F_FORCE);
-       sx_xunlock(&ifnet_detach_sxlock);
+               sx_xunlock(&ifnet_detach_sxlock);
+       }

        IF_CLONE_REMREF(ifc);
 }

Seems to be enough to avoid the prob= lem. So it looks like somehow deleting all interfaces for a given cloner und= er that lock (rather than releasing it and re-acquiring it) causes the test f= ailures.



That is interesting. I do not expect a r= e-acquiring will make any differences, given ifc_detach_cloner() and / o= r if_clone_detach() are basically be invoked by VNET_SYSUNINIT() and  v= net_destroy() has acquired ifnet_detach_sxlock ( I planed to removed th= e acquiring of it in vnet_destroy() but not yet done ). So I'd ex= pect an assert `sx_assert(&ifnet_detach_sxlock, SA_XLOCKED)` in if_= clone_detach() will mostly succeed.

Some= drivers, for example wg(4), iterate all VNETs and invoke ifc_detach_cl= oner() on module unload. That should be the only case that `ifnet_detach_sxlo= ck` is not recursively acquired, and not acquired prior to
= t= he commit.

The failing tests I see are:

sys/netpfil/pf/divert-to:in_div  ->  failed: Test case body ret=
urned a non-ok exit code, but this is not allowed  [36.591s]
sys/netpfil/pf/divert-to:in_div_in  ->  failed: atf-check failed; see the=
 output of the test for details  [30.867s]
sys/netpfil/pf/divert-to:in_div_in_fwd_out_div_out  ->  failed: atf-check=
 failed; see the output of the test for details  [39.705s]
sys/netpfil/pf/divert-to:in_dn_in_div_in_out_div_out_dn_out  ->  failed: a=
tf-check failed; see the output of the test for details  [45.059s]
sys/netpfil/pf/divert-to:out_div  ->  failed: Test case body returned a n=
on-ok exit code, but this is not allowed  [23.629s]
sys/netpfil/pf/killstate:gateway  ->  failed: Killing with a different ga=
teway removed the state.  [32.803s]
sys/netpfil/pf/killstate:id  ->  failed: Killing a different ID removed t=
he state.  [32.789s]
sys/netpfil/pf/killstate:label  ->  failed: Killing a non-existing label r=
emoved the state.  [47.749s]
sys/netpfil/pf/killstate:multilabel  ->  failed: Setting new rules remove=
d the state.  [43.570s]
sys/netpfil/pf/killstate:src_dst  ->  failed: Killing with the wrong dest=
ination IP removed our state.  [57.819s]
sys/netpfil/pf/killstate:v6  ->  failed: Killing with the wrong IP remove=
d our state.  [54.957s]
sys/netpfil/pf/nat64:pool  ->  failed: atf-check failed; see the output o=
f the test for details  [51.118s]
sys/netpfil/pf/nat64:sctp_in  ->  failed: Failed to connect to SCTP serve=
r  [55.495s]
sys/netpfil/pf/nat64.py:TestNAT64::test_udp_checksum  ->  failed: /usr/te=
sts/sys/netpfil/pf/nat64.py:205: AttributeError  [80.001s]
sys/netpfil/pf/pflog:matches  ->  failed: atf-check failed; see the outpu=
t of the test for details  [61.807s]
sys/netpfil/pf/pflog:matches_logif  ->  failed: atf-check failed; see the=
 output of the test for details  [51.261s]
sys/netpfil/pf/pflog:unspecified_v6  ->  failed: atf-check failed; see th=
e output of the test for details  [36.281s]
sys/netpfil/pf/rdr:srcport_pass  ->  failed: atf-check failed; see the ou=
tput of the test for details  [76.815s]
sys/netpfil/pf/sctp:pfsync  ->  failed: Initial SCTP connection failed  [=
134.866s]
sys/netpfil/pf/sctp:related_icmp  ->  failed: SCTP connection failed  [59=
.620s]
sys/netpfil/pf/table:zero_one  ->  failed: atf-check failed; see the outp=
ut of the test for details  [64.125s]
sys/netpfil/pf/tcp:rst  ->  failed: atf-check failed; see the output of t=
he test for details  [80.261s]

Looking at it now, those runtimes se= ems suspiciously high as well.



I noticed that. My= local test shows most of them finish in seconds. Some require more time to f= inish but still within about 20 seconds.
I tested as the following= ,
```
# kyua test -k Kyuafile pf/divert-to
```

Is the failing tests always fail ?=

It=E2=80=99s relatively consistentl= y the same tests, I believe.

Does the kyua report show anything useful ?

Not obviously so, no, but I=E2=80=99ve also not done a l= ot of debugging. It=E2=80=99s an annoying problem, because re-running an ind= ividual test case just succeeds. 

In any event, I=E2= =80=99ll try to test the patch you sent me tomorrow. (Probably ~12 hours fro= m now.)

Best regards?
Kristof Provost&nbs= p;
= --Apple-Mail-19B8ACE6-3C3A-4FAD-8D9C-088FBE08E17B--