Home | History | Annotate | Download | only in sysmon
History log of /src/sys/dev/sysmon/sysmon.c
RevisionDateAuthorComments
 1.32  28-Mar-2022  riastradh driver(9): devsw_detach never fails. Make it return void.

Prune a whole lotta dead branches as a result of this. (Some logic
calling this is also wrong for other reasons; devsw_detach is final
-- you should never have any reason to decide to roll it back. To be
cleaned up in subsequent commits...)

XXX kernel ABI change to devsw_detach signature requires bump
 1.31  31-Dec-2021  riastradh sysmon: Delete trailing whitespace. No functional change intended.
 1.30  26-Aug-2019  nakayama Module class of sysmon_envsys, sysmon_wdog and sysmon_power is
MODULE_CLASS_DRIVER, not MODULE_CLASS_MISC.

Fix that invoking envsys without sysmon_envsys kernel module failes with:
WARNING: module error: incompatible module class for `sysmon_envsys' (1 != 3)
 1.29  26-Apr-2019  pgoyette branches: 1.29.2;
Set the "required modules" to NULL, not to an empty string.

It really doesn't make that much difference to the code, but the output
from modstat(8) is different! (With an empty string in the MODULE() macro
modstat reports an empty string, but with a NULL in the macro, modstat
prints a '-' just like it does for other "empty" fields.)
 1.28  05-May-2015  pgoyette branches: 1.28.2; 1.28.8; 1.28.10; 1.28.18;
Optimize a bit - don't re-enter the mutex if we're just going to exit.

While here, remove some parens around a return value.
 1.27  05-May-2015  pgoyette If module_autoload() returns an error, just return that value instead
of overwriting with ENODEV.

Thanks, christos!
 1.26  04-May-2015  pgoyette If autoload of the subcomponent module fails, don't try to call its
open routine. Just return an error.

Hopefully this will fix the recently reported issues with atf tests
running on xen guest.
 1.25  29-Apr-2015  pgoyette At suggestion from riastradh@ ...

Remove auto_configure(9) goop from sysmon device. It does make things
a bit cleaner, and also reduces source code by about 10%.

Tested via QEMU with no obvious side-effects.
 1.24  25-Apr-2015  pgoyette Correctly check return status when registering with pmf
 1.23  25-Apr-2015  pgoyette Fix typo - thanks, riz@
 1.22  25-Apr-2015  pgoyette Register the sysmon pseudo-device with power management framework so we
can properly suspend the system.

Thanks, mrg, for pointing this out.
 1.21  24-Apr-2015  pgoyette With new (corrected) configuration declarations file, the cdevsw is
already included by config. So, for built-in sysmon module we don't
need to add the cdevsw to the table.
 1.20  23-Apr-2015  pgoyette Modularize sysmon and its components
 1.19  25-Jul-2014  dholland branches: 1.19.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.18  16-Mar-2014  dholland branches: 1.18.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.17  03-Mar-2008  xtraeme branches: 1.17.38; 1.17.48; 1.17.54;
Pass D_MPSAFE to d_flag in the cdevsw struct, so that the kernel_lock
is not taken in the driver methods.

I've been running with this for some days without any effect.
 1.16  04-Jan-2008  ad branches: 1.16.2; 1.16.6;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.15  04-Mar-2007  christos branches: 1.15.16; 1.15.22; 1.15.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14  16-Nov-2006  christos branches: 1.14.4;
__unused removal on arguments; approved by core.
 1.13  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12  03-Sep-2006  christos branches: 1.12.2; 1.12.4;
add missing initializers
 1.11  11-Dec-2005  christos branches: 1.11.4; 1.11.8;
merge ktrace-lwp.
 1.10  29-Jun-2003  fvdl branches: 1.10.2; 1.10.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.9  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.8  18-Apr-2003  thorpej * Add a generic power management event API, defined in <sys/power.h>.
Right now, only power switch state change events are supported. This
is a work-in-progress.
* Add support to sysmon for delivering power mangement events to userland.
Add poll, kqueue, and read entry points to sysmon.
* Adapt ACPI to use the new generic <sys/power.h> event types.

This provides the kernel support for a forthcoming powerd(8) which can
do nice things like gracefully shut the system down when an ACPI power
button is pressed.
 1.7  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.6  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.5  13-Nov-2001  lukem branches: 1.5.8;
add RCSIDs
 1.4  05-Nov-2000  thorpej branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8;
Split the envsys and watchdog parts of sysmon into their own
files.
 1.3  04-Nov-2000  thorpej Add a watchog timer framework to the system monitor.
 1.2  28-Jun-2000  thorpej branches: 1.2.2;
Fix a couple of brain-o's in error cases, and use PCATCH for
the sysmon mutex wait.
 1.1  24-Jun-2000  thorpej Add a clearing-house pseudo-device for system monitoring devices
such as the LM78 and VT82C686A (and eventually ACPI). Multiple
sensor devices can be hooked registered with `sysmon', and eventually
sysmon will also handle hardware (and software) watchdog timers.

Convert the `lm' and `viaenv' drivers to the new interface.
 1.2.2.3  30-Jul-2000  bouyer pull up 1.1 -> 1.2 (requested by thorpej):
Fix a couple of brain-o's in error cases, and use PCATCH for
the sysmon mutex wait.
 1.2.2.2  30-Jul-2000  bouyer Pull up (requested by thorpej):
lm_pnpbios.c 1.2->1.3
files 1.374->1.375
nslm7x.c 1.3->1.4
nslm7xvar.h 1.2->1.3
lm_isa.c 1.2->1.3
files.pci 1.96->1.97
viaenv.c 1.2->1.3
sysmon.c 1.1
sysmonvar.h 1.1

Add a clearing-house pseudo-device for system monitoring devices
such as the LM78 and VT82C686A (and eventually ACPI). Multiple
sensor devices can be hooked registered with `sysmon', and eventually
sysmon will also handle hardware (and software) watchdog timers.

Convert the `lm' and `viaenv' drivers to the new interface.
 1.2.2.1  28-Jun-2000  bouyer file sysmon.c was added on branch netbsd-1-5 on 2000-07-30 17:54:16 +0000
 1.4.8.1  18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.4.6.2  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.6.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.3  11-Nov-2002  nathanw Catch up to -current
 1.4.4.2  17-Sep-2002  nathanw Catch up to -current.
 1.4.4.1  14-Nov-2001  nathanw Catch up to -current.
 1.4.2.3  22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.2  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1  05-Nov-2000  bouyer file sysmon.c was added on branch thorpej_scsipi on 2000-11-20 11:43:12 +0000
 1.5.8.1  16-May-2002  gehenna Add the character device switch.
 1.10.18.5  17-Mar-2008  yamt sync with head.
 1.10.18.4  21-Jan-2008  yamt sync with head
 1.10.18.3  03-Sep-2007  yamt sync with head.
 1.10.18.2  30-Dec-2006  yamt sync with head.
 1.10.18.1  21-Jun-2006  yamt sync with head.
 1.10.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.11.8.1  03-Sep-2006  yamt sync with head.
 1.11.4.1  09-Sep-2006  rpaulo sync with head
 1.12.4.2  10-Dec-2006  yamt sync with head.
 1.12.4.1  22-Oct-2006  yamt sync with head
 1.12.2.1  18-Nov-2006  ad Sync with head.
 1.14.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.15.28.1  08-Jan-2008  bouyer Sync with HEAD
 1.15.22.1  18-Feb-2008  mjf Sync with HEAD.
 1.15.16.2  23-Mar-2008  matt sync with HEAD
 1.15.16.1  09-Jan-2008  matt sync with HEAD
 1.16.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.16.2.1  24-Mar-2008  keiichi sync with head.
 1.17.54.1  18-May-2014  rmind sync with head
 1.17.48.2  03-Dec-2017  jdolecek update from HEAD
 1.17.48.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.38.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.2.1  10-Aug-2014  tls Rebase.
 1.19.4.1  06-Jun-2015  skrll Sync with HEAD
 1.28.18.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.28.18.1  10-Jun-2019  christos Sync with HEAD
 1.28.10.1  26-Aug-2019  martin Pull up following revision(s) (requested by nakayama in ticket #1344):

sys/dev/sysmon/sysmon.c: revision 1.30

Module class of sysmon_envsys, sysmon_wdog and sysmon_power is
MODULE_CLASS_DRIVER, not MODULE_CLASS_MISC.

Fix that invoking envsys without sysmon_envsys kernel module failes with:
WARNING: module error: incompatible module class for `sysmon_envsys' (1 != 3)
 1.28.8.2  29-Apr-2017  pgoyette Remove explicit inclusion of <sys/localcount.h> since there is no
explicit usage of localcounts here. <sys/conf.h> will take care of
including as needed.
 1.28.8.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.28.2.3  26-Jul-2016  pgoyette Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT. This better describes
what we're doing, and why.
 1.28.2.2  19-Jul-2016  pgoyette Instead of repeatedly typing the conditional initialization of the
.d_localcount members in the various {b,c}devsw, define an initializer
macro and use it. This also removes the need for defining new symbols
for each 'struct localcount'.

As suggested by riastradh@
 1.28.2.1  18-Jul-2016  pgoyette Rump drivers are always installed via devsw_attach() so we need to
always allocate a 'struct localcount' for these drivers whenever they
are built as modules.
 1.29.2.1  26-Aug-2019  martin Pull up following revision(s) (requested by nakayama in ticket #118):

sys/dev/sysmon/sysmon.c: revision 1.30

Module class of sysmon_envsys, sysmon_wdog and sysmon_power is
MODULE_CLASS_DRIVER, not MODULE_CLASS_MISC.

Fix that invoking envsys without sysmon_envsys kernel module failes with:
WARNING: module error: incompatible module class for `sysmon_envsys' (1 != 3)

RSS XML Feed