From nobody Thu Mar 16 20:44:13 2023 X-Original-To: freebsd-stable@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 4PczlG5Xtlz3yZGT for ; Thu, 16 Mar 2023 20:44:26 +0000 (UTC) (envelope-from nagy.attila@gmail.com) Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PczlG03KLz4GWw for ; Thu, 16 Mar 2023 20:44:26 +0000 (UTC) (envelope-from nagy.attila@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=RL4dd1x8; spf=pass (mx1.freebsd.org: domain of nagy.attila@gmail.com designates 2607:f8b0:4864:20::32c as permitted sender) smtp.mailfrom=nagy.attila@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ot1-x32c.google.com with SMTP id p11-20020a9d454b000000b0069d8eb419f9so1291228oti.4 for ; Thu, 16 Mar 2023 13:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678999465; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=L6sSJTChXkljB+f8oT2y0Eo7z71aedQmYU4OWRkOqPQ=; b=RL4dd1x8Gefyi4z/mUubmZVD9VS4RtXpFxQLFB9T4PbETsuoFlxQGmTZ4/tOjeAczS loLmGHyJw+r9LgFQvbesnea3VLoHo+0Va7oBfHEN/ezDV3z3rWLOOuC8U+LuzORy0WX3 hZaLZfMp8n7ts5uTq0rGJRLH3hYcX3Lkj/iZ6BKXu9uXgnjYr7Di6yA++k52OBfnPmTa EQzqZqpL6LqPn0lsvng3keWGWlmyS8nxsR4rs3dYlcqfn0xhpQGh2rkTQJb8jkhJ/P/J dYSjDWg9ig3UfI699Cg6li/tKwiA6wq4n5qrSpWAyQVlaJKDMjTuxd7ENJ4CxFW1Baq3 FJtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678999465; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L6sSJTChXkljB+f8oT2y0Eo7z71aedQmYU4OWRkOqPQ=; b=u6+qfMHvdgeVLVtEq4fFpt7ED0Pxrek+6e4sAjJJIQl+fhCFVv5ehygIxLrSeEqUIU Q55deuIR2nEurgRCNa72mB+J1iLMK2vlAyNCGkvJuJiE7WQ15unSPnHj/gPavvyDH+fQ fZ3m029EHOXLe+TZAdUJ7c7s18igwnDthAH3sxl6zB6F8MsXs58CB0Qza2aMyQCKi/eG wjP7ri/ItQHp+3Vlz0kye8bs3luZyXmZJrQj0EO/byKgK4Q55jyYcNzlJBosACAYDwJw wlH5S3rfoXluNji992Mcb1cK//6Z7O6nnQdY33ZRJIxMpkdoFEK/0kI8Z/lwQRzSe2bb jRRg== X-Gm-Message-State: AO0yUKXvxRQpF9C0Agf1neaXk/eZaZf1vCp9ASlzymQiY5ilgjSwAavI grYL1FhwBqc7+T4G37l5UmL+1FdjkPOScmoE4nLlJXicqUY= X-Google-Smtp-Source: AK7set+TyX4Me7mWuE94GqQSarNUX9PD/wRe161BEIelbKKiLY9aASBv/MTeYL+wgT2I4LuRt2JrPY52QfyBIBrhoqU= X-Received: by 2002:a9d:6e9a:0:b0:694:7e05:e240 with SMTP id a26-20020a9d6e9a000000b006947e05e240mr321845otr.1.1678999464777; Thu, 16 Mar 2023 13:44:24 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Attila Nagy Date: Thu, 16 Mar 2023 21:44:13 +0100 Message-ID: Subject: Fwd: Kernel DHCP unpredictable/fails (PXE boot), userspace DHCP works just fine To: freebsd-stable@freebsd.org Content-Type: multipart/alternative; boundary="000000000000ad1af605f70a864c" X-Spamd-Result: default: False [-1.73 / 15.00]; URI_COUNT_ODD(1.00)[31]; NEURAL_HAM_SHORT(-0.97)[-0.969]; NEURAL_HAM_LONG(-0.96)[-0.964]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; NEURAL_SPAM_MEDIUM(0.20)[0.199]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[freebsd-stable@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::32c:from]; ARC_NA(0.00)[]; TAGGED_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-stable@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_NONE(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4PczlG03KLz4GWw X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N --000000000000ad1af605f70a864c Content-Type: text/plain; charset="UTF-8" Hi, As this is super annoying, I'm willing to pay a $500 bounty for solving this issue (whomever is first, however I don't anticipate a big competition :) Having an invoice would be best, but I'm willing to accept individuals as well). I can't give remote access, but can run debug builds with serial console. stable/13 branch. I have a bunch of netbooted machines, one set in a cluster is older (HP DL80 G9, 2x8C, Intel I350 -igb- NICs), the other set is newer (HP XL225n G10, AMD EPYC2x16C, BCM57412 -bnxt- NICs). All of these boot from the network, which is basically: - get IP and options with DHCP with the help of the NIC's PXE stack - get the loader and kernel, start it - do another round of DHCP from the kernel (bootp_subr.c) - mount the root via NFS and let everything work as usual The problem is that the newer machines take an indefinite time to boot. The older ones (with igb NIC) work reliably, they always boot fast. The process of getting an IP address via DHCP (bootpc_call from bootp_subr.c) either succeeds normally (in a few seconds), or takes a lot of time. Common (measured) times to boot range from 10s of minutes to anywhere between a few hours (1-6). Sometimes it just gets stuck and couldn't get past bootpc_call (getting the DHCP lease). What I've already tried: - we have a redundant set of DHCP servers which offer static leases (so there are two DHCPOFFERs), so I tried to turn off one of them, nothing has changed - tried to disable SMP, the effect is the same - tried to see whether it's a network issue. The NIC's PXE stack always gets the lease quickly and booting FreeBSD from an ISO and issuing dhclient on the same interface is also fast. After the machines have booted, there are no network issues, they work reliably (since more than a year for 20+ machines, so not just a few hours) This issue wasn't so bad previously (only a few mins to tens of minutes delay), but recently it got pretty unbearable, even making some machines unbootable for days... First I thought it might be a packet loss (or more exactly packet delivery from the DHCP server to the receiving socket), either in the network or in the NIC/kernel itself, so I placed a few random printfs into bootp_subr.c and udp_usrreq.c. After spending some time trying to understand the problem it feels like a race condition in bootpc_call, but I don't know the code well enough to effectively verify that. Here are the modified bootp_subr.c and udp_usrreq.c: https://gist.githubusercontent.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a8ade8af252f618c84a46da2452d557ebc5078ac/bootp_subr.c https://gist.github.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a8ade8af252f618c84a46da2452d557ebc5078ac/udp_usrreq.c (modified from stable/13 branch from a few weeks earlier) This is the output with the always working DL80 (igb) machine: https://gist.github.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a8ade8af252f618c84a46da2452d557ebc5078ac/DL80%2520igb%2520good.txt This is the console output from a working boot for the XL225n (bnxt) machine: https://gist.github.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a8ade8af252f618c84a46da2452d557ebc5078ac/XL225n%2520bnxt%2520good.txt as you can see, it's much slower than the DL80 (which also isn't that fast...) And this one is a longer output, without success to that point (2 minutes without completing the DHCP flow): https://gist.github.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw / a8ade8af252f618c84a46da2452d557ebc5078ac/XL225n%2520bnxt%2520long.txt For the latter, here's an excerpt from the DHCP log: https://gist.githubusercontent.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a8ade8af252f618c84a46da2452d557ebc5078ac/dhcp_log.txt It seems the DHCP state always gets reset to IF_DHCP_UNRESOLVED even if there's answers from the DHCP server. Here's another, longer console log, which succeeded after spending 236 seconds in the loop: https://gist.github.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a77f52f5e83c699b38a7c2d3acdc52d26ceeba71/XL225n%2520bnxt%2520long%2520good.txt Any ideas about this? --000000000000ad1af605f70a864c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

As this is super annoying, I'm willing to pay a $500 bounty fo= r solving this issue (whomever is first, however I don't anticipate a b= ig competition :) Having an invoice would be best, but I'm willing to a= ccept individuals as well).
I can't give remote access, but c= an run debug builds with serial console. stable/13 branch.
I have a bunch of netbooted machines, one set in a cluster is = older (HP DL80 G9, 2x8C, Intel I350 -igb- NICs), the other set is newer (HP= XL225n G10, AMD EPYC2x16C, BCM57412 -bnxt- NICs).
All of these b= oot from the network, which is basically:
- get IP and options wi= th DHCP with the help of the NIC's PXE stack
- get the loader= and kernel, start it
- do another round of DHCP from the kernel = (bootp_subr.c)
- mount the root via NFS and let everything work a= s usual

The problem is that the newer machines tak= e an indefinite time to boot. The older ones (with igb NIC) work reliably, = they always boot fast.
The process of getting an IP address v= ia DHCP (bootpc_call from bootp_subr.c) either succeeds normally (in a few = seconds), or takes a lot of time.
Common (measured) times to boot= range from 10s of minutes to anywhere between a few hours (1-6).
Sometimes it just gets stuck and couldn't get past bootpc_call (gettin= g the DHCP lease).

What I've already tried:
- we have a redundant set of DHCP servers which offer static leases= (so there are two DHCPOFFERs), so I tried to turn off one of them, nothing= has changed
- tried to disable SMP, the effect is the same
- tried to see whether it's a network issue. The NIC's= PXE stack always gets the lease quickly and booting FreeBSD from an ISO an= d issuing dhclient on the same interface is also fast. After the machines h= ave booted, there are no network issues, they work reliably (since more tha= n a year for 20+ machines, so not just a few hours)

This issue wasn't so bad previously (only a few mins to tens of m= inutes delay), but recently it got pretty unbearable, even making some mach= ines unbootable for days...

First I thought it mig= ht be a packet loss (or more exactly packet delivery from the DHCP server t= o the receiving socket), either in the network or in the NIC/kernel itself,= so I placed a few random printfs into bootp_subr.c and udp_usrreq.c.
=

After spending some time trying to understand the probl= em it feels like a race condition in
bootpc_call, but I don&= #39;t know the code well enough to effectively verify that.
<= br>
Here are the modified bootp_subr.c and udp_usrreq.c:
https://gist.githubusercontent.com/bra-fsn/128ae9a3bbc0dbd= bb2f6f4b3e2c5157a/raw/a8ade8af252f618c84a46da2452d557ebc5078ac/bootp_subr.c=
=
(modified from stable/13 branch from a few weeks earlier)

This is the output with the always working DL80 (igb) mach= ine:

This is the console output fr= om a working boot for the XL225n (bnxt) machine:
https://gist.github.com/bra-fsn/128ae9a3bbc0dbdbb2f6f4b3e2c5157a/raw/a8a= de8af252f618c84a46da2452d557ebc5078ac/XL225n%2520bnxt%2520good.txt
as you can see, it's much slower than the DL80 (which also isn= 9;t that fast...)

And this one is a longer output,= without success to that point (2 minutes without completing the DHCP flow)= :
=

For the latter, here's an excerpt from the DHCP log= :

It seems the DHCP state always g= ets reset to IF_DHCP_UNRESOLVED even if there's answers from the DHCP s= erver.

Here's another, longer console log,= which succeeded after spending 236 seconds in the loop:

Any ideas about this?

--000000000000ad1af605f70a864c--