From nobody Mon Jun 29 17:37:26 2026 X-Original-To: dev-commits-src-main@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 4gptlT3lvhz6jYWH for ; Mon, 29 Jun 2026 17:37:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-yx1-f54.google.com (mail-yx1-f54.google.com [74.125.224.54]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gptlR6g7Wz3q7c for ; Mon, 29 Jun 2026 17:37:39 +0000 (UTC) (envelope-from rlibby@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none); spf=pass (mx1.freebsd.org: domain of rlibby@gmail.com designates 74.125.224.54 as permitted sender) smtp.mailfrom=rlibby@gmail.com Received: by mail-yx1-f54.google.com with SMTP id 956f58d0204a3-664d22d7337so1639458d50.1 for ; Mon, 29 Jun 2026 10:37:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782754659; x=1783359459; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k1j1oXKKxONEG5dl3EbUERtW+c7/nctqOpF4lzZWxnI=; b=T0z94g6j/Vv+syukhDld/GEBLte5zNOXehKqYRIXSoWW/aTT3lxjayLL6vk/1Q96qI hXiKjszccPOuefQPWkPYhTkcubiCrGti7wm/jmeHyj/CphSoRsjrE4NeWoGCWzNB/zhI UcZ4yz1befxJGpoh+ZjML6hXNIHECoSPWFm/ux1u3EWOjpozalgIMsp9jhFL/axUMyNc 4uvlZlZ3tspsPIdZsO7vuXngBbp3vCU5jtjZL9XpYRdbd7e4AzVyShzRq2NL6IOFGFoW 2ByLOPv7+vswnuGCLiHKOgAfJnmqcjLgKT2EFHaA2gcBPD5XLtKIxpAM7MC0+W0HQooI wFMw== X-Forwarded-Encrypted: i=1; AHgh+Robf2GQ8Kyg9fElp2XgouwRYmNpHXVfbFIkCTNIQo3uTHKfAjKjp1Zn60d4PCHJpJCg9a9bkcnrgM4JnSZ5XisUAul15A==@freebsd.org X-Gm-Message-State: AOJu0YwEgqDVKuP8RRhV6+0rdvNJBsLxNLqaO2EsEQvY8ra8LM7KZ6U8 BJTIEnncv7uqWs+8JqucWh3Cb9UbQ1WAoXaS74Xt013fCCwZVgTxXAJk1aF0kg== X-Gm-Gg: AfdE7cl06ww7et/Xl/AAmqdbwF9lwXvOc/5PBek82Jrs2QT4TxnUzkCuNiiyKogZfuL iA4Ox7bL3QmzcOv2w/A5LFZNFjMbOfg4IK/whuZYI20HgTbnHE1+fJ3zn3jwnCmEPr9oh0weOq0 j9qwD7kkwgtJGACIEZLpjyfuUkETUzn3f7Zq0fAPax3gwV9V8BLTWK/32Qo4JmOjWf2A2AE0eYd 3+4ruR3k1VKDZjDdnON1FLeXf8hw4edGx1FsvRLjOJ1VRU03PLcijSwp4TbFQbvUeLKlTBbCHGJ aoZxCsIItnbb38lP70eAUaspLlFGoRQQlBKVN3Z6zl2WkxBHxvmIJQleFRYO/km+orBnLDaHgRC Om/rkOWkZcX0bAKg27wK7IWj2Ix0h4dr08y65x+RtpCivTwr/r99bbXNreeawFGZRQb4Ip+UAT0 SIfI+ifF4CY9+oKSw1bZm2YbzxVkj432wgdcNuKnHOogkQ31Q= X-Received: by 2002:a05:690e:134c:b0:664:ecd0:61be with SMTP id 956f58d0204a3-664fba823a1mr167807d50.21.1782754658471; Mon, 29 Jun 2026 10:37:38 -0700 (PDT) Received: from mail-yx1-f47.google.com (mail-yx1-f47.google.com. [74.125.224.47]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-664b9f8b0cesm3822455d50.17.2026.06.29.10.37.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jun 2026 10:37:38 -0700 (PDT) Received: by mail-yx1-f47.google.com with SMTP id 956f58d0204a3-6626b5ace23so2709606d50.0 for ; Mon, 29 Jun 2026 10:37:37 -0700 (PDT) X-Forwarded-Encrypted: i=1; AHgh+RoS/c/XOjO+dPAJqorspoMZ3LnsPGdPoMSIv4PhU5kXex3P17RSWQLxCdFxub5v0NHGP6+noXU5g/ijQdGfEERqeH4cbg==@freebsd.org X-Received: by 2002:a05:690e:4386:b0:664:dadd:ada8 with SMTP id 956f58d0204a3-664fab3f74dmr200153d50.1.1782754657683; Mon, 29 Jun 2026 10:37:37 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: <6a33714c.187fe.20ec4acc@gitrepo.freebsd.org> In-Reply-To: From: Ryan Libby Date: Mon, 29 Jun 2026 10:37:26 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AVVi8CehozmXffa4hQDn_d6gKxrd9q9uzmJu6z6Os5-Mikv0dEWwwDzZQudE-Vg Message-ID: Subject: Re: git: 08180f1b613b - main - witness: actually set read-only tunables in time for witness_startup To: Alan Somers Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-1.41 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_SPAM_SHORT(0.49)[0.488]; FORGED_SENDER(0.30)[rlibby@freebsd.org,rlibby@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:74.125.0.0/16:c]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:15169, ipnet:74.125.0.0/16, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[rlibby@freebsd.org,rlibby@gmail.com]; FREEFALL_USER(0.00)[rlibby]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[74.125.224.54:from]; R_DKIM_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[74.125.224.54:from,74.125.224.47:received] X-Spamd-Bar: - X-Rspamd-Queue-Id: 4gptlR6g7Wz3q7c On Mon, Jun 22, 2026 at 7:30=E2=80=AFPM Ryan Libby wro= te: > > On Mon, Jun 22, 2026 at 4:08=E2=80=AFPM Alan Somers = wrote: > > > > On Wed, Jun 17, 2026 at 10:18=E2=80=AFPM Ryan Libby wrote: > > > > > > The branch main has been updated by rlibby: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D08180f1b613b6fe000135e= fa28b7c3293cbf1683 > > > > > > commit 08180f1b613b6fe000135efa28b7c3293cbf1683 > > > Author: Ryan Libby > > > AuthorDate: 2026-06-18 03:52:53 +0000 > > > Commit: Ryan Libby > > > CommitDate: 2026-06-18 04:05:43 +0000 > > > > > > witness: actually set read-only tunables in time for witness_star= tup > > > > > > SYSCTL_XXX with CTLFLAG_RDTUN and without CTLFLAG_NOFETCH should = not be > > > used for values that are needed before SI_SUB_KLD. Otherwise the= y are > > > tuned after they are needed. Set CTLFLAG_RDTUN | CTLFLAG_NOFETCH= for > > > the debug.witness.witness_count and debug.witness.skipspin sysctl= s and > > > add separate tunables for them, which run at SI_SUB_TUNABLES time= , i.e., > > > in time for witness_startup. > > > > > > Reviewed by: kib, markj > > > Sponsored by: Dell Inc. > > > Differential Revision: https://reviews.freebsd.org/D57613 > > > > My dev VM instapanics on boot, and I've bisected it to this change. > > Apparently it doesn't affect everybody, or it would've been reported > > already. So I'm not asking you to revert it. But could you please > > take a look at the problem? > > > > Stack trace: > > > > ---<>--- > > Copyright (c) 1992-2026 The FreeBSD Project. > > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 199= 4 > > The Regents of the University of California. All rights reserve= d. > > FreeBSD is a registered trademark of The FreeBSD Foundation. > > FreeBSD 16.0-CURRENT #25 n286717-a9e12d3ec8bd: Mon Jun 22 16:50:06 MDT = 2026 > > somers@fbsd-head.lauralan.noip.me:/usr/obj/usr/home/somers/src/free= bsd.org/src/main/amd64.amd64/sys/GENERIC > > amd64 > > FreeBSD clang version 21.1.8 (https://github.com/llvm/llvm-project.git > > llvmorg-21.1.8-0-g2078da43e25a) > > WARNING: WITNESS option enabled, expect reduced performance. > > SRAT: Ignoring memory at addr 0xff000000 > > panic: physical address 0x4af918000 not covered by the DMAP > > cpuid =3D 0 > > time =3D 1 > > KDB: stack backtrace: > > db_trace_self_wrapper() at db_trace_self_wrapper+0x36/frame 0xffffffff8= 293bd60 > > vpanic() at vpanic+0x149/frame 0xffffffff8293be90 > > panic() at panic+0x43/frame 0xffffffff8293bef0 > > pmap_map() at pmap_map+0x2c/frame 0xffffffff8293bf00 > > vm_page_startup() at vm_page_startup+0x71c/frame 0xffffffff8293bf90 > > vm_mem_init() at vm_mem_init+0x1a/frame 0xffffffff8293bfa0 > > mi_startup() at mi_startup+0x1ed/frame 0xffffffff8293bff0 > > KDB: enter: panic > > [ thread pid 0 tid 0 ] > > Stopped at kdb_enter+0x33: movq $0,0x15ad202(%rip) > > > > /boot/loader.conf contents: > > > > kern.boottrace.enabled=3D1 > > debug.kasan.panic_on_violation=3D0 > > debug.kmsan.panic_on_violation=3D0 > > debug.witness.witness_count=3D49152 > > Thanks for the report. > > I'm able to repro with > set debug.witness.witness_count=3D49152 > at the loader prompt. > > The WITNESS_COUNT default is 1536. There is an allocation that is > O(n^2) of witness_count. The setting of 49152 should end up > attempting to allocate over 2.25 GiB... but actually it will overflow > a 32-bit int to become negative, leading to us trying to pmap_map > memory somewhere after the end of the biggest phys segment. > > I think a minimum fix would change the types to prevent overflow. > Actually we also don't check that we aren't just exceeding the size of > the segment, so presumably we could also hit another panic in just > trying to allocate too much. > > This was a sort of latent issue: before your setting of witness_count > was just being ignored. > > Ryan asomers, I just pushed: 2407abc9fb3b ("witness: harden tunables for large settings") That should avoid the panic with your settings. Thanks to kib's suggestion, if you set boot verbose you should be able to see a log line in /var/log/messages about how much startup memory witness wants. In any case you should also see log lines if it can't be satisfied and is automatically reduced. Your setting of debug.witness.witness_count=3D49152 should result in a request of over 2.25 GiB of startup allocations because witness uses an O(n^2) adjacency matrix. I'm curious whether you are testing something with that many unique lock names and if so whether witness is solving your use case. I wonder if a different graph representation might be better for that use case. I assume witness is designed with an adjacency matrix for speed. Then again I'm unsure if this has been examined from a performance perspective, and specifically I wonder about the pointer indirection vs just calculating indices. Ryan