Home | History | Annotate | Download | only in sysmon
History log of /src/sys/dev/sysmon/sysmonvar.h
RevisionDateAuthorComments
 1.53  31-Dec-2021  riastradh sysmon(9): Document lock order.
 1.52  31-Dec-2021  riastradh sysmon(9): Fix callout/thread synchronization.

Callout may ONLY take sme_work_mtx, at IPL_SOFTCLOCK; MUST NOT touch
sme_mtx at IPL_NONE. All state the callout needs is serialized by
sme_work_mtx now:

- calls to sme_schedule_callout
- calls to sme_schedule_halt
- struct sysmon_envsys::sme_events_timeout
- struct sysmon_envsys::sme_events_list
- struct sysmon_envsys::sme_callout_state
- struct envsys_data::flags
=> yes, this is a little silly -- used for ENVSYS_FNEED_REFRESH
=> should maybe separate the static driver-defined features from
the state flags needed by sysmon_envsys but not important now

Sleeping under sme_work_mtx (except on other adaptive locks at
IPL_SOFTCLOCK) is forbidden. Calling out to the driver under
sme_work_mtx is forbidden.

This should properly fix:

https://mail-index.netbsd.org/tech-kern/2015/10/14/msg019511.html
PR kern/56592
 1.51  31-Dec-2021  riastradh sysmon: Delete trailing whitespace. No functional change intended.
 1.50  11-Sep-2017  pgoyette Improve tracking of the state of an event's callout, and protect all
queries or modifications of the state with the sme_mtx mutex.

Detach the rndsrc before re-attaching it (with potentially new values).

Clean up some lock-ordering issues.

And a couple of KNF issues for good measure!

Should address PR kern/52533

XXX Pullup-8 along with the previous fixes from msaitoh@
XXX http://mail-index.netbsd.org/source-changes/2017/09/06/msg088028.html
~
~
 1.49  23-Apr-2015  pgoyette branches: 1.49.10;
Modularize sysmon and its components
 1.48  18-Apr-2015  mlelstv use unsigned type for flag bits.
 1.47  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.46  14-Mar-2015  hannken Add a counter of busy events and stop enqueueing more work if a device is busy.
Protect this counter with a new short time lock "sme_work_mtx" and
keep "sme_mtx" as long time lock.

Removes a deadlock where an active event holds "sme_mtx", the callout
"sme_events_check" blocks on "sme_mtx" and callout processing stops.
 1.45  22-Nov-2014  ozaki-r branches: 1.45.2;
Kill sme_callout_mtx and use sme_mtx instead

We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.

Discussed with riastradh@ in http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
 1.44  11-Dec-2012  pgoyette branches: 1.44.12;
Replace a couple of many-line #define with equivalent code loops.

No functional change intended, and atf tests (using swsensor(4)) still
pass 100%
 1.43  16-Jul-2012  pgoyette branches: 1.43.2;
Extend previous changes so that even sensors which don't use a refresh()
callback to update the value can be polled to provide rnd(4) entropy.
 1.42  15-Jul-2012  pgoyette If a sensor is flagged as capable of providing rnd(4) with entropy,
hook the sensor into rnd subsystem, and make sure we periodically
refresh the sensor whether or not it is being actively monitored.
 1.41  04-Jun-2011  pgoyette branches: 1.41.2; 1.41.8;
Since nothing actually records or maintains an average sensor value,
remove value_avg from the prop_dict. We can't completely remove it
because there's one driver that uses this field for its own private
purposes, so for now we just rename the member.
 1.40  04-Jan-2011  matt branches: 1.40.2; 1.40.6;
add support for autostarting watchdogs (wdog was started by firmware
and can't be disabled). Add critical pool hooks for kernel tickled
watchdogs.
 1.39  11-Apr-2010  pgoyette Use a typedef to define the prototype of the per-sensor callback.

Update manpage for the prototype, and fix a fubar'd Cross-reference.
 1.38  01-Apr-2010  pgoyette Permit creation of an event-monitor for alarm limits even if the limits
are not currently set (and, in case of battery capacity sensors, if there
is no value_max). Ensure that such an event-monitor does not trigger the
delivery of any actual events.

Provide a mechanism for sensors to set their limits at time other than
system startup (for example, when a battery is inserted).

This allows us to boot a system with a battery missing, install the
battery some time later, and automatically monitor it without requiring
any user intervention to create the event-monitor. (The actual changes
for battery sensors to use this new capability will come later.)
 1.37  27-Mar-2010  pgoyette Constify the args to sysmon_envsys_foreach_sensor()'s callback function.
 1.36  27-Mar-2010  pgoyette Fix the locking protocol in sysmon_envsys_foreach_sensor(), and add an
additional argument to control whether or not the sensors are refreshed
before invoking the callback routine.
 1.35  26-Mar-2010  pgoyette Add a routine to iterate over all the sensors on the system. This will
be needed to update acpiapm_get_powstat() which is currently slightly
broken due to recent rearrangement of acpi_bat(4)'s sensors. (This
approach is in lieu of exporting proplists between kernel entities, and
avoids exposing some internal sysmon_envsys details.)
 1.34  19-Mar-2010  pgoyette Modify previous commit. The routine to deliver events is intended to be
exported to device drivers, so rename it and move the declaration to
<dev/sysmon/sysmonvar.h>
 1.33  14-Mar-2010  pgoyette branches: 1.33.2;
Retire the 'monitor' member of the envsys_data_t. It was only used in
one place, and functioned as a logical OR of the ENVSYS_FMON* flag bits.
 1.32  28-Feb-2010  pgoyette Move definitions of internal data structures and flag bits to avoid
exposing them to user-land.
 1.31  14-Feb-2010  pgoyette Remove the flags member of the limits structure. Its value was only
meaningful for a few limited function calls; all persitent storage
of limit-present flags is maintained in the edata->upropset member.
 1.30  31-Jan-2010  martin branches: 1.30.2;
Add a convenience function to find the maximum value currently reported
by a set (selected via a passed callback predicate) of sensors.
This provides an easy way to query the current temperature of a thermal
zone, for example, from within the kernel - assuming the caller knows
the topology.
 1.29  14-Jun-2009  pgoyette Ooops - {get,set}_limits() need to be sensor-specific. Pass an extra
argument to them to identify the individual sensor being processed.
 1.28  13-Jun-2009  pgoyette Add capability to send sensor limit values to the driver so they can
be programmed into device registers. This way we can let the hardware
help us out instead of having to always compare the value against each
limit. (Driver updates for some sensors to take advantage of this
capability will be forthcoming.)
 1.27  03-Jun-2008  jmcneill branches: 1.27.12; 1.27.16; 1.27.20;
Add SME_POLL_ONLY flag, which informs sme to only refresh the sensor when
it is polled (and not from GTREDATA).
 1.26  04-Apr-2008  hannken branches: 1.26.2; 1.26.4; 1.26.6;
Update includes. Builds again on sparc64.

Ok: Juan Romero Pardines <xtraeme@netbsd.org>
 1.25  01-Apr-2008  xtraeme Introduce per-device locking/synchronization and maintain only a
global mutex for the linked list of devices and the global proplib
dictionary.

This has improved locking contention a lot when multiple devices with
multiple monitoring events are running:

New:

0.30 35 0.33 sme_global_mtx sysmonioctl_envsys+28b
0.10 10 0.11 00000000cd97feac sysmon_envsys_acquire+4c
0.08 6 0.09 00000000cd97feac sme_update_dictionary+24f
0.01 4 0.01 00000000cd97feac sme_events_worker+2f
0.01 10 0.01 00000000cd97fe2c sysmon_envsys_acquire+4c
0.00 1 0.00 00000000cd97fe2c sysmon_envsys_release+3b
28.38 94 9.16 sme_global_mtx sysmonioctl_envsys+28b
4.54 74 1.47 00000000cd97fe2c sysmon_envsys_acquire+4c
0.06 3 0.02 00000000cd97fe2c sysmon_envsys_release+3b
0.03 1 0.01 00000000cd97fe2c sme_events_worker+2f
1.40 19 0.45 00000000cd97bee4 sysmon_envsys_acquire+4c

Old:

4.25 313 4.74 sme_mtx <all>
3.12 185 3.49 sme_mtx sme_events_worker+21
1.12 128 1.25 sme_mtx sysmonioctl_envsys+29b
34.75 1423 59.52 sme_mtx <all>
22.08 477 37.82 sme_mtx sysmonioctl_envsys+29b
12.67 946 21.70 sme_mtx sme_events_worker+21
 1.24  23-Mar-2008  xtraeme Fix some problems reported by <drochner> a while ago on tech-kern:

sme_events_worker: skip sensors with invalid state.
sme_acadapter_check:

* use a boolean to check if an SME_CLASS_ACADAPTER was found.
* Always refresh sensor data before checking value_cur.

Introduce the SME_INIT_REFRESH flag. If a device sets this it will mean
that after interrupts are enabled in the autoconf(9) process, sensor
data will be refreshed once.
 1.23  16-Dec-2007  dyoung branches: 1.23.6;
In sysmon_wdog_unregister(), do not return until all of the watchdog
timer's users are gone. A signal cancels the unregister:
sysmon_wdog_unregister() leaves the watchdog registered.

The only user of sysmon_wdog_unregister() that I can find is in
elansc(4), so this looks like a safe change to make.
 1.22  20-Nov-2007  xtraeme branches: 1.22.2; 1.22.6;
After comments from Andrew Doran:

- The mutex for the callout handler must run at IPL_SOFTCLOCK.
- Just stop the callout in sysmon_envsys_unregister() and don't wait
for the callout to finish.
 1.21  16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.20  03-Nov-2007  xtraeme branches: 1.20.2;
Remove sysmon_envsys_find() proto, it's defined on sysmon_envsysvar.h.
 1.19  10-Oct-2007  xtraeme branches: 1.19.2;
Fix the problems described in:
http://mail-index.netbsd.org/current-users/2007/07/16/0012.html

- Introduce sme_class into the sysmon_envsys struct to specify a
class; currently there are two classes: SME_CLASS_ACADAPTER and
SME_CLASS_BATTERY.

- Add a new envsys event: PENVSYS_EVENT_LOW_POWER that is reached when
all SME_CLASS_BATTERY devices are in CRITICAL/LOW state and there's not
any SME_CLASS_ACADAPTER connected.

- Add the 'low-power' event into the sensor_battery script that will
shutdown the system gracefully via 'shutdown -p'. If powerd(8) is
not running, cpu_reboot(9) with RB_POWERDOWN is used.

- Make acpiacad(4) a SME_CLASS_ACADAPTER device and acpibat(4) a
SME_CLASS_BATTERY device.

Update the documentation accordingly to these changes.
 1.18  08-Sep-2007  xtraeme branches: 1.18.2;
- Build unconditionally compatibility code, there's no point to have it
disabled, because some drivers depend in the old code yet.
- Use a new mutex for sysmon_envsys_next_sensor_index (used in
compatibility code), otherwise bad things happen with LKMs. Thanks
to this, the hack for LKMs has been removed.
- Check in advance if the driver doesn't exist already on the list
before adding the sensors in the dictionary.
- Don't forget to call sme_event_unregister_all() if
sysmon_envsys_unregister() fails after adding the array into the global
dictionary or when creating sensors.
- Modify and add some DPRINTFs.

The lm(4) lkm works without known problems registering and unregistering
it multiple times.
 1.17  02-Sep-2007  xtraeme Convert the sysmon watchdog framework to use mutex(9) rather than
simple_locks and initialize them on init_main via sysmon_wdog_init().

All the sysmon code now is cleaned up and doesn't use old style locking.
 1.16  30-Aug-2007  xtraeme More misc changes for sysmon_envsys(9):

- Add the SLIST for sensor descriptions and sme_uniqsensors into the
struct sysmon_envsys (it's per device now).
- Use only one common struct with three members for the static tables
(there's no need to have different structs just for them).
- While initializing/destroying the events framework, use the
strategy specified by Andrew Doran in:
http://mail-index.netbsd.org/tech-kern/2007/06/21/0025.html).

(forgot in previous)
 1.15  01-Jul-2007  xtraeme branches: 1.15.2; 1.15.6; 1.15.8;
Imported envsys 2, a brief description of the new features:
(Part 1: API)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.14  08-May-2007  xtraeme Remove duplicate sysmonioctl_envsys() prototype.
 1.13  04-Mar-2007  christos branches: 1.13.2; 1.13.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12  08-Jul-2006  christos branches: 1.12.10;
expose the ioctl internal function now used by the acpi_apm code.
 1.11  11-Dec-2005  christos branches: 1.11.4; 1.11.8; 1.11.16;
merge ktrace-lwp.
 1.10  11-Aug-2003  yamt branches: 1.10.16;
do wakeup() only when someone is waiting for us.
 1.9  11-Aug-2003  yamt introduce SME_FLAG_BUSY and set it during operations
instead of keeping sysmon_envsys_list_slock spinlock held
because some drivers might sleep in sysmon_envsys ops,

XXX sysmon_envsys_lock is now redundant
 1.8  29-Jun-2003  fvdl branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7  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.6  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.5  17-Apr-2003  thorpej Start at a power management framework for sysmon. Right now we just
provide some VERY basic support for power/sleep buttons and lid switches;
if someone presses the power button, shut down the system semi-gracefully.

Eventually, we will send events for all types of button/lid events down
to a userland power management daemon, which will be able to define a
separate policy for each button/switch.
 1.4  10-Apr-2003  thorpej Group things in this file a bit more logically.
 1.3  05-Nov-2000  thorpej branches: 1.3.2; 1.3.8;
Split the envsys and watchdog parts of sysmon into their own
files.
 1.2  04-Nov-2000  thorpej Add a watchog timer framework to the system monitor.
 1.1  24-Jun-2000  thorpej branches: 1.1.2;
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.1.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.1.2.1  24-Jun-2000  bouyer file sysmonvar.h was added on branch netbsd-1-5 on 2000-07-30 17:54:16 +0000
 1.3.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.3.2.3  22-Nov-2000  bouyer Sync with HEAD.
 1.3.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.3.2.1  05-Nov-2000  bouyer file sysmonvar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:12 +0000
 1.8.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.8.2.2  03-Aug-2004  skrll Sync with HEAD
 1.8.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.10.16.8  24-Mar-2008  yamt sync with head.
 1.10.16.7  21-Jan-2008  yamt sync with head
 1.10.16.6  07-Dec-2007  yamt sync with head
 1.10.16.5  15-Nov-2007  yamt sync with head.
 1.10.16.4  27-Oct-2007  yamt sync with head.
 1.10.16.3  03-Sep-2007  yamt sync with head.
 1.10.16.2  30-Dec-2006  yamt sync with head.
 1.10.16.1  21-Jun-2006  yamt sync with head.
 1.11.16.1  13-Jul-2006  gdamore Merge from HEAD.
 1.11.8.1  11-Aug-2006  yamt sync with head
 1.11.4.1  09-Sep-2006  rpaulo sync with head
 1.12.10.2  17-May-2007  yamt sync with head.
 1.12.10.1  12-Mar-2007  rmind Sync with HEAD.
 1.13.4.1  11-Jul-2007  mjf Sync with head.
 1.13.2.4  12-Oct-2007  ad Sync with head.
 1.13.2.3  09-Oct-2007  ad Sync with head.
 1.13.2.2  15-Jul-2007  ad Sync with head.
 1.13.2.1  27-May-2007  ad Sync with head.
 1.15.8.2  09-Jan-2008  matt sync with HEAD
 1.15.8.1  06-Nov-2007  matt sync with HEAD
 1.15.6.5  21-Nov-2007  joerg Sync with HEAD.
 1.15.6.4  04-Nov-2007  jmcneill Sync with HEAD.
 1.15.6.3  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.6.2  02-Oct-2007  joerg Sync with HEAD.
 1.15.6.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.15.2.2  10-Sep-2007  skrll Sync with HEAD.
 1.15.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.18.2.1  14-Oct-2007  yamt sync with head.
 1.19.2.3  21-Nov-2007  bouyer Sync with HEAD
 1.19.2.2  18-Nov-2007  bouyer Sync with HEAD
 1.19.2.1  13-Nov-2007  bouyer Sync with HEAD
 1.20.2.3  27-Dec-2007  mjf Sync with HEAD.
 1.20.2.2  08-Dec-2007  mjf Sync with HEAD.
 1.20.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.22.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.22.2.1  26-Dec-2007  ad Sync with head.
 1.23.6.3  05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.23.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.23.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.26.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.4.4  11-Aug-2010  yamt sync with head.
 1.26.4.3  11-Mar-2010  yamt sync with head
 1.26.4.2  20-Jun-2009  yamt sync with head
 1.26.4.1  04-May-2009  yamt sync with head.
 1.26.2.1  04-Jun-2008  yamt sync with head
 1.27.20.1  07-Jan-2011  matt Allow kernel ticklers to turn themselves on at boot.
 1.27.16.1  15-Feb-2014  matt move sysmon_wdog_setmode prototype to sysmonvar.h
 1.27.12.1  23-Jul-2009  jym Sync with HEAD.
 1.30.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.33.2.3  12-Jun-2011  rmind sync with head
 1.33.2.2  05-Mar-2011  rmind sync with head
 1.33.2.1  30-May-2010  rmind sync with head
 1.40.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.40.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.41.8.1  07-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #1201):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111-1.112 (patch)
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23 (patch)
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28 (patch)

Replace callout_stop with callout_halt and ensure the callout
is not running before destroying it.
 1.41.2.2  16-Jan-2013  yamt sync with (a bit old) head
 1.41.2.1  30-Oct-2012  yamt sync with head
 1.43.2.2  03-Dec-2017  jdolecek update from HEAD
 1.43.2.1  25-Feb-2013  tls resync with head
 1.44.12.2  06-Apr-2015  snj Pull up following revision(s) (requested by hannken in ticket #666):
sys/dev/sysmon/sysmon_envsys.c: revision 1.129
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.114
sys/dev/sysmon/sysmonvar.h: revision 1.46
Add a counter of busy events and stop enqueueing more work if a device =
is busy.
Protect this counter with a new short time lock "sme_work_mtx" and
keep "sme_mtx" as long time lock.
Removes a deadlock where an active event holds "sme_mtx", the callout
"sme_events_check" blocks on "sme_mtx" and callout processing stops.
 1.44.12.1  01-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #279):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.112
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
Discussed with martin@ and riastradh@.
Make it clear that we should use not callout_stop but callout_halt
before callout_destroy
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete.
Reviewed by riastradh@.
Kill sme_callout_mtx and use sme_mtx instead
We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.
Discussed with riastradh@ in
http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete. And also we make sure that SME_CALLOUT_INITIALIZED
is unset before calling callout_halt to prevent the callout from calling
callout_schedule. This is the same as what we did in sys/netinet6/mld6.c@1.61.
Reviewed by riastradh@.
 1.45.2.2  06-Jun-2015  skrll Sync with HEAD
 1.45.2.1  06-Apr-2015  skrll Sync with HEAD
 1.49.10.1  23-Sep-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #281):
sys/dev/sysmon/sysmon_envsys.c: 1.140-1.141
sys/dev/sysmon/sysmon_envsys_events.c: 1.120-1.121
sys/dev/sysmon/sysmonvar.h: 1.50
Fixes a problem that some driver(e.g. acpitz(4) or coretemp(5)) which
use sysmon_envsys sleep waiting at "rndsrc" when "drvctl -d".
Don't call rnd_detach_source() in sme_remove_event() which is called
from sme_event_unregister_all(). Instead, call rnd_detach_source() in
sysmon_envsys_sensor_detach() and call sysmon_envsys_sensor_detach()
before sme_event_unregister_sensor(). Each sensor(envsys_data) has each
rnd_src, but some sme_events point to the same rnd_src in a sensor.
Calling rnd_detach_souce() twice with the same rnd_src brokes a reference
count in rnd_src. OK'd by pgoyette@.
--
Improve tracking of the state of an event's callout, and protect all
queries or modifications of the state with the sme_mtx mutex.
Detach the rndsrc before re-attaching it (with potentially new values).
Clean up some lock-ordering issues.
And a couple of KNF issues for good measure!
Should address PR kern/52533

RSS XML Feed