From nobody Mon Jun 29 17:37:26 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 4gptlT0bp3z6jYWG for ; Mon, 29 Jun 2026 17:37:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (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 4gptlS1w1fz3qNw for ; Mon, 29 Jun 2026 17:37:40 +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 209.85.128.171 as permitted sender) smtp.mailfrom=rlibby@gmail.com Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-80a123ef90aso40580637b3.0 for ; Mon, 29 Jun 2026 10:37:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782754658; x=1783359458; 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=WfVfQMXQyOMgYxbACTL1/aYGX/YP1/OJfRvdPTP1NmUwt8knMIioehi0hu7wt4doC+ kOdaxJR+yJmIGJaIIf0r53btomTEEgKwcsXqck2ROqukbdXMwTDf+gBgYr4I9OWfEuO3 KbU/grPo3fKgZQS7Ghs7PUApeLzFIyWpoIzHxzCMjHWHd7OCIUIDZt35dL+gYnv4Dbj6 aUXcsDHoD4ri1pZ0HSFI1F7Xr8cb2DsLOZMcC/ndBWT7Y1o/sMxRbsli27nCM52OlUlK OCESg4V+YNI3EO7wZxqDaZhlcM6zyUz7ELAkUMUXbt3CwwdFkocWOGBG7T/5tm72fb/T SdKQ== X-Forwarded-Encrypted: i=1; AHgh+RoVBI2mBVGcW1itDE7sKMylOYxUvVC6M8FOIYZ0YKLDODmy6tCf7BYv/fz4Ofy2R6bOKc2l2NoSb/YvIQGv6zO/AgBt@freebsd.org X-Gm-Message-State: AOJu0YzJIvNauZVdVAoFnQ04jX2LVm1rkMGrTxVOGcY8wJrc9RS5h3Xj 2YSR8q41Yz988ImvokxZg56HDt57GceDVR/wYkqMeFu8qaLAsi/8I2vT89WG3g== X-Gm-Gg: AfdE7ck7lyPKKs242O520jns3RZ1bU4n69EZHxwJnmaVHBA5OIIunQ2UqhTsYXP3XdQ IGkv8RF3fJw/204mUl9hsF+nWiQ4NXSmCNkh1WlxITdhf4Y9d3Db1atuPz8mpv7L6iXcs5TW70P bQGpMyaMcdfDcwfB2u9au2IDhNHLvpadODHqO/mik/m+MqOVSetqzEBUkRwDiaSDQg5QcqSrXdB BvcFMyquG/9fvO3YWy/t+yGdOIT8VEIgC9m1QnQUjaqnDTzzctBT3YtneIWatNghvqgn8MTIKTi /l8TgfZfded/aY+wITaBpbPHy/Jtzi1cqGkY8cggnxxw1lOHaKMYu/jk3bz+SQU0V2vWUECiOFY V2rp3XINkSFVTOKmj3m6vYPdTzv5e6EXlMP2Jxs8WrV9h6tPyEogKuH8ap++M9CIJzdGU1/54b8 sCrkmpxyxZeSVEZUAZhC1Zx4Em9eoC59RyssvyQ6SofW6hJTtWb8X0Hjh4FA== X-Received: by 2002:a05:690c:c4c3:b0:80c:784b:b482 with SMTP id 00721157ae682-810e98475e5mr2385287b3.18.1782754658353; Mon, 29 Jun 2026 10:37:38 -0700 (PDT) Received: from mail-yx1-f44.google.com (mail-yx1-f44.google.com. [74.125.224.44]) by smtp.gmail.com with ESMTPSA id 00721157ae682-810e9d4bcadsm674247b3.29.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-f44.google.com with SMTP id 956f58d0204a3-664ae993e4bso3462879d50.0 for ; Mon, 29 Jun 2026 10:37:37 -0700 (PDT) X-Forwarded-Encrypted: i=1; AHgh+RotykIgIxR3hdKNhGCArhmdDQQOVc1ACuHwjXNtPlsUaJX80kwAN+xOimH5B90W/F8uRqXMnjone9XnPrq9OQOpLpkB@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 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 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.42 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_SPAM_SHORT(0.48)[0.484]; FORGED_SENDER(0.30)[rlibby@freebsd.org,rlibby@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17: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:209.85.128.0/17, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@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-all@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.171:from]; R_DKIM_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.171:from,74.125.224.44:received] X-Spamd-Bar: - X-Rspamd-Queue-Id: 4gptlS1w1fz3qNw 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