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 -----
> 

Reply via email to