Date: Mon, 13 May 2024 22:24:49 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c58d78f4fa99 - stable/14 - New sysctl to disable NOMATCH until devmatch runs Message-ID: <202405132224.44DMOnVt041226@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c58d78f4fa9919d63a2d7dfd29772152727bfa43 commit c58d78f4fa9919d63a2d7dfd29772152727bfa43 Author: Isaac Cilia Attard <iciliaat@gmail.com> AuthorDate: 2024-04-29 20:44:27 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405132224.44DMOnVt041226>