From nobody Mon May 13 22:24:49 2024 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 4VdYvP54h7z5L4Kv; Mon, 13 May 2024 22:24:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VdYvP2kRfz3yfd; Mon, 13 May 2024 22:24:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715639089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FoUPuQQ0OdhqLJpjSIHnUwZmz78TUmrw/0+nHHqTkMg=; b=ps4svP84NW4zgRVmCaX3qZIt9TC7+qZH1OPbzMWG92V2EdvT+81wZJkKR+ZK7NB7iYmEIN 3TcJt6qQAfjJqLu0K4IptbgOwhd14nd3qXzgKc0SWGmwc6r+V737RoP59RgKq0BB6iRtVX VdODuBASQNtiHfjbn5Dha17tb3EFN3u8Zv0IbTntMtKv+zC85+NXjD5qzK4OonszNlN4yu +RukAaWPyNf++XRNzjnw1AkpbkXpV+RR1p82bFtBM45ahiMKXNxF99URzl8B4QI6hZ2dto twJCHnWn3AbdUT4Juh2L7U4ZSH4kgWws3tT5dq86ezvFKhiw3MwOjWwCBsFAyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715639089; a=rsa-sha256; cv=none; b=HUujLSVRAX73AVAW/13YEharXaxWxAMAW5doop+9k+15bEqCyfg+UJgpE4YpZdKMGRSEVi xK0aF8NPP4dJ7zyB7b47b89aIFvrXS8WO6EN5AfKxYcLJAQvxRs3tkNjDv70kpec8m6Zf5 4IqNBEnpWUOR74nbjR57nKxfOyxmeZKJnHgNBz7y76EYM9JGmzj/Hj2OodHiAodH2fG9Zw H5urayhXfbVHRhn1bwOIubbkadZ0GWpKvcYnQUfKrFaoe1TWnyTHaHwzNvWqWvny64WOG3 2KmpQK0XsCGi2X8KCn4Z0gLlWBxoBU0GZlbS2ibC8cGTf/+DyW1nQpiPED+zzA== 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=1715639089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FoUPuQQ0OdhqLJpjSIHnUwZmz78TUmrw/0+nHHqTkMg=; b=uXhjLh3cAIBEdfLV3dHbzOzSazmjgBOMPhcorzCNqdJ11I0BuNwWL6udRl6MPsqn4gUgFt ODPWZxhme+iEagaN/s7v8F2rpZ0BKNPkkCz8iBDUiKacyMdp0z+I8Mbzolgr2ViuoRL1Ab D4lVioKpuLo7LcIXhkWunXaAMnG6Ocm9DhmWFacAtYRFllBNDR+eSnriAPF1AoLniLiM70 AMHlxTZNLubxec+rFDEJxtvJX7vHsLzPhttn8pU9uDl2OLPOsA4bWg/4f9n68MQ+orgiqS oRqv24YWTWhwz95Zyb+hH7DsGgR4W0IYt70Bcx/JPw5ek1sQlvpdKZuRmHeyHA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VdYvP287mz15bR; Mon, 13 May 2024 22:24:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44DMOnbR041229; Mon, 13 May 2024 22:24:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44DMOnVt041226; Mon, 13 May 2024 22:24:49 GMT (envelope-from git) Date: Mon, 13 May 2024 22:24:49 GMT Message-Id: <202405132224.44DMOnVt041226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: c58d78f4fa99 - stable/14 - New sysctl to disable NOMATCH until devmatch runs 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c58d78f4fa9919d63a2d7dfd29772152727bfa43 Auto-Submitted: auto-generated The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c58d78f4fa9919d63a2d7dfd29772152727bfa43 commit c58d78f4fa9919d63a2d7dfd29772152727bfa43 Author: Isaac Cilia Attard AuthorDate: 2024-04-29 20:44:27 +0000 Commit: Colin Percival CommitDate: 2024-05-13 22:24:29 +0000 New sysctl to disable NOMATCH until devmatch runs Introduce hw.bus.devctl_nomatch_enabled and use it to suppress NOMATCH until devmatch runs There's a lot of NOMATCH events generated at boot. We also run devmatch once during early boot to load unmatched devices. To avoid redundant work, don't start generating NOMATCH events until after devmatch runs. Set hw.bus.devctl_nomatch_enabled=1 just before we run devmatch. The kernel will suppress NOMATCH events until this is set to true. This saves about 170ms from the boot on aarch64 running atop Apple M-series processors and the VMWare Fusion hypervisor. Reviewed by: imp, cperciva MFC after: 3 days Sponsored by: Google Summer of Code Pull Request: https://github.com/freebsd/freebsd-src/pull/1213 (cherry picked from commit 6437872c1d665c2605f54e8ff040b0ba41edad07) --- libexec/rc/rc.d/devmatch | 1 + sys/kern/kern_devctl.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/devmatch b/libexec/rc/rc.d/devmatch index 78050cfa4541..67bb14761614 100755 --- a/libexec/rc/rc.d/devmatch +++ b/libexec/rc/rc.d/devmatch @@ -46,6 +46,7 @@ devmatch_start() if [ -n "$one_nomatch" ]; then list=$(devmatch -p "${one_nomatch}" | sort -u) else + sysctl hw.bus.devctl_nomatch_enabled=1 list=$(devmatch | sort -u) fi diff --git a/sys/kern/kern_devctl.c b/sys/kern/kern_devctl.c index 12d4f9ebfc4d..0dd05a49c9ad 100644 --- a/sys/kern/kern_devctl.c +++ b/sys/kern/kern_devctl.c @@ -89,6 +89,9 @@ static int sysctl_devctl_queue(SYSCTL_HANDLER_ARGS); static int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_queue, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, NULL, 0, sysctl_devctl_queue, "I", "devctl queue length"); +static bool nomatch_enabled = false; +SYSCTL_BOOL(_hw_bus, OID_AUTO, devctl_nomatch_enabled, CTLFLAG_RWTUN, + &nomatch_enabled, 0, "enable nomatch events"); static void devctl_attach_handler(void *arg __unused, device_t dev); static void devctl_detach_handler(void *arg __unused, device_t dev, @@ -208,7 +211,8 @@ devctl_detach_handler(void *arg __unused, device_t dev, enum evhdev_detach state static void devctl_nomatch_handler(void *arg __unused, device_t dev) { - devaddq("?", "", dev); + if (nomatch_enabled) + devaddq("?", "", dev); } static int