From: Tobias Klauser Date: Fri, 11 Jul 2025 20:59:10 +0000 (+0200) Subject: runtime: drop NetBSD kernel bug sysmon workaround fixed in NetBSD 9.2 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=52b6d7f67af28a4df6665a595e3f35b9875be2b5;p=gostls13.git runtime: drop NetBSD kernel bug sysmon workaround fixed in NetBSD 9.2 The NetBSD releases supported by the NetBSD project as off today are 9.4 and 10.1. The Go project's NetBSD builders are on 9.3. Thus, it is fine to drop the workaround which was only needed for NetBSD before 9.2. Fixes #46495 Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64 Change-Id: I3c2ec42fb0f08f7dafdfb7f1dbd97853afc16386 Reviewed-on: https://go-review.googlesource.com/c/go/+/687735 Auto-Submit: Tobias Klauser Auto-Submit: Benny Siegert Reviewed-by: Benny Siegert Reviewed-by: Michael Pratt Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI --- diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go index 10b14a8718..f117253f34 100644 --- a/src/runtime/os_netbsd.go +++ b/src/runtime/os_netbsd.go @@ -101,9 +101,6 @@ var sigset_all = sigset{[4]uint32{^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0) // From NetBSD's const ( - _CTL_KERN = 1 - _KERN_OSREV = 3 - _CTL_HW = 6 _HW_NCPU = 3 _HW_PAGESIZE = 7 @@ -141,13 +138,6 @@ func getPageSize() uintptr { return 0 } -func getOSRev() int { - if osrev, ok := sysctlInt([]uint32{_CTL_KERN, _KERN_OSREV}); ok { - return int(osrev) - } - return 0 -} - //go:nosplit func semacreate(mp *m) { } @@ -268,7 +258,6 @@ func osinit() { if physPageSize == 0 { physPageSize = getPageSize() } - needSysmonWorkaround = getOSRev() < 902000000 // NetBSD 9.2 } var urandom_dev = []byte("/dev/urandom\x00") diff --git a/src/runtime/proc.go b/src/runtime/proc.go index b41bbe93cf..9715f56890 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -6199,10 +6199,6 @@ func checkdead() { // This is a variable for testing purposes. It normally doesn't change. var forcegcperiod int64 = 2 * 60 * 1e9 -// needSysmonWorkaround is true if the workaround for -// golang.org/issue/42515 is needed on NetBSD. -var needSysmonWorkaround bool = false - // haveSysmon indicates whether there is sysmon thread support. // // No threads on wasm yet, so no sysmon. @@ -6311,26 +6307,6 @@ func sysmon() { netpollAdjustWaiters(delta) } } - if GOOS == "netbsd" && needSysmonWorkaround { - // netpoll is responsible for waiting for timer - // expiration, so we typically don't have to worry - // about starting an M to service timers. (Note that - // sleep for timeSleepUntil above simply ensures sysmon - // starts running again when that timer expiration may - // cause Go code to run again). - // - // However, netbsd has a kernel bug that sometimes - // misses netpollBreak wake-ups, which can lead to - // unbounded delays servicing timers. If we detect this - // overrun, then startm to get something to handle the - // timer. - // - // See issue 42515 and - // https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50094. - if next := timeSleepUntil(); next < now { - startm(nil, false, false) - } - } // Check if we need to update GOMAXPROCS at most once per second. if debug.updatemaxprocs != 0 && lastgomaxprocs+1e9 <= now { sysmonUpdateGOMAXPROCS()