Stuart Henderson <s...@spacehopper.org> wrote: > On 2018/09/26 19:16, Stuart Henderson wrote: > > N.B. "Ports using KERN_CPTIME2 will need to be updated." > > > > This is likely to cause a bunch of breakage in things reporting CPU stats > > and time is very short to fix them before release. > > > > If you look after ports that do this, get onto a kernel with this change > > (very new commit so it probably won't be in snaps quite just yet) and > > test ASAP. > > Some starting points for investigation, > > assorted mozillas > collectd > conky > go > htop > libgtop2 > net-snmp > node > pgtop > py-psutil > libuv (+ embedded copies, at least in cmake, maybe more) > zabbix > > > > > > > > > ----- Forwarded message from Scott Soule Cheloha <chel...@openbsd.org> ----- > > > > From: Scott Soule Cheloha <chel...@openbsd.org> > > Date: Wed, 26 Sep 2018 11:23:13 -0600 (MDT) > > To: source-chan...@openbsd.org > > Subject: CVS: cvs.openbsd.org: src > > > > CVSROOT: /cvs > > Module name: src > > Changes by: chel...@cvs.openbsd.org 2018/09/26 11:23:13 > > > > Modified files: > > sys/kern : kern_sched.c kern_sysctl.c > > sys/sys : sched.h > > usr.bin/systat : cpu.c vmstat.c > > usr.bin/top : display.c display.h machine.c machine.h top.c > > > > Log message: > > KERN_CPTIME2: set ENODEV if the CPU is offline. > > > > This lets userspace distinguish between idle CPUs and those that are > > not schedulable because hw.smt=0. > > > > A subsequent commit probably needs to add documentation for this > > to sysctl.2 (and perhaps elsewhere) after the dust settles. > > > > Also included here are changes to systat(1) and top(1) that account > > for the ENODEV case and adjust behavior accordingly: > > > > - systat(1)'s cpu view prints placeholder marks ('-') instead of > > percentages for each state if the given CPU is offline. > > > > - systat(1)'s vmstat view checks for offline CPUs when computing the > > machine state total and excludes them, so the CPU usage graph > > only represents the states for online CPUs. > > > > - top(1) does not draw CPU rows for offline CPUs when the view is > > redrawn. If CPUs "go offline", percentages for each state are > > replaced by placeholder marks ('-'); the view will need to be > > redrawn to remove these rows. If CPUs "go online" the view will > > need to be redrawn to show these new CPUs. In "combined CPU" mode, > > the count and the state totals only represent online CPUs. > > > > Ports using KERN_CPTIME2 will need to be updated. The changes > > described above to make systat(1) and top(1) aware of the ENODEV > > case *and* gracefully handle a changing HW_NCPUONLINE while the > > application is running are not necessarily appropriate for each > > and every port. > > > > The changes described above are so extensive in part to demonstrate > > one way a program *might* be made robust to changing CPU availability. > > In particular, changing hw.smt after boot is an extremely rare event, > > and this needs to be weighed when updating ports. > > > > The logic needed to account for the KERN_CPTIME2 ENODEV case is > > very roughly: > > > > if (sysctl(...) == -1) { > > if (errno != ENODEV) { > > /* Actual error occurred. */ > > } else { > > /* CPU is offline. */ > > } > > } else { > > /* CPU is online and CPU states were set by sysctl(2). */ > > } > > > > Prompted by deraadt@. Basic idea for ENODEV from kettenis@. Discussed at > > length with kettenis@. Additional testing by tb@. > > > > No complaints from hackers@ after a week. > > > > ok kettenis@, "I think you should commit [now]" deraadt@ > > > > > > ----- End forwarded message ----- > >
conky hw.smt=0 ERROR : conky Conky: desktop window (1c00010) is subwindow of root window (e1) Conky: window type - desktop Conky: drawing to created window (0x1e00001) Conky: drawing to single buffer Conky: sysctl kern.cp_time2 failed Conky: sysctl kern.cp_time2 failed Conky: sysctl kern.cp_time2 failed Conky: sysctl kern.cp_time2 failed conky hw.smt=1 OK htop hw.smt=0 OK htop hw.smt=1 OK top hw.smt=0 OK top hw.smt=1 OK zabbix: hw.smt=0 OK zabbix: hw.smt=1 OK tested with zabbix_get -s localhost -k system.cpu.util xstatbar: hw.smt=0 ERROR xstatbar: sysinfo update: KERN.CPTIME2.4 failed: Operation not supported by device xstatbar: hw.smt=1 OK collectd: hw.smt=0 ERROR with plugin cpu (using write_log) Oct 3 12:08:50 solene collectd[37866]: plugin_load: plugin "cpu" successfully loaded. Oct 3 12:08:50 solene collectd[89100]: cpu plugin: sysctl failed: Operation not supported by device. Oct 3 12:08:50 solene collectd[89100]: read-function of plugin `cpu' failed. Will suspend it for 20.000 seconds. collectd: hw.smt=1 OK (using write_log) Oct 3 12:09:31 solene collectd[50994]: plugin_load: plugin "cpu" successfully loaded. Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-0.cpu-user 11768 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-1.cpu-user 25592 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-2.cpu-user 21417 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-5.cpu-user 884 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-4.cpu-user 427 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-3.cpu-user 15805 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-0.cpu-system 11650 1538561381\^M Oct 3 12:09:41 solene collectd[82167]: write_log values: localhost.cpu-7.cpu-user 1001 1538561381\^M thunderbird: hw.smt=0 OK thunderbird: hw.smt=1 OK firefox: hw.smt=0 OK firefox: hw.smt=1 OK