History log of /netbsd/sys/dev/sysmon/sysmon_envsys_events.c (Results 1 – 25 of 123)
Revision Date Author Comments
# 1bf8e094 31-Dec-2021 riastradh <riastradh@NetBSD.org>

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 no

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

show more ...


# 02b0acbc 31-Dec-2021 riastradh <riastradh@NetBSD.org>

sysmon: Delete trailing whitespace. No functional change intended.


# 6c75b1eb 11-Sep-2017 pgoyette <pgoyette@NetBSD.org>

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 valu

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

show more ...


# 11f94a5e 06-Sep-2017 msaitoh <msaitoh@NetBSD.org>

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 calle

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

show more ...


# d65a6a67 01-Jun-2017 chs <chs@NetBSD.org>

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

al

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.

show more ...


# cfbc0679 15-Oct-2015 bouyer <bouyer@NetBSD.org>

As proposed in
https://mail-index.netbsd.org/tech-kern/2015/10/14/msg019511.html
don't sleep on sme->sme_mtx in the callout but use mutex_tryenter()
and just reschedule the callout if we can't get th

As proposed in
https://mail-index.netbsd.org/tech-kern/2015/10/14/msg019511.html
don't sleep on sme->sme_mtx in the callout but use mutex_tryenter()
and just reschedule the callout if we can't get the mutex now.
This fixes a deadlock which can happen if the backed wants to
sleep with timeout (e.g. cv_timedwait()) as the backed is called with
sme->sme_mtx held.

This is a stopgap measure for netbsd-7; sysmon should be changed to not
sleep (or call a backend which will sleep) with mutexes held.

show more ...


# 74618d2d 23-Jun-2015 pgoyette <pgoyette@NetBSD.org>

Separate the two conditions for the KASSERT, so we can tell which
one occurred.


# aed30b9d 23-Jun-2015 pgoyette <pgoyette@NetBSD.org>

Fix the KASSERT - we want to make sure that _both_ pointers are non-NULL,
n ot just that one or the other is non-NULL!


# 85c6c147 18-Apr-2015 mlelstv <mlelstv@NetBSD.org>

use unsigned type for flag bits.


# 8cd4b4d9 14-Mar-2015 hannken <hannken@NetBSD.org>

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 deadloc

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.

show more ...


# 6b11c45f 23-Nov-2014 ozaki-r <ozaki-r@NetBSD.org>

Pull workqueue_destroy out of sme->sme_mtx

workqueue_destroy may sleep so we shouldn't run it with holding a mutex.

Requested by riastradh@.


# b3935269 22-Nov-2014 ozaki-r <ozaki-r@NetBSD.org>

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 callou

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

show more ...


# 2e5f2f50 22-Nov-2014 ozaki-r <ozaki-r@NetBSD.org>

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 b

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

show more ...


# 85385f40 15-Sep-2013 martin <martin@NetBSD.org>

Remove unused variable


# 7169104b 23-Jan-2013 mbalmer <mbalmer@NetBSD.org>

Fix spelling, grammar, typos.


# fa087f5d 14-Dec-2012 pgoyette <pgoyette@NetBSD.org>

Constify


# ceb1a073 11-Dec-2012 pgoyette <pgoyette@NetBSD.org>

Replace a couple of many-line #define with equivalent code loops.

No functional change intended, and atf tests (using swsensor(4)) still
pass 100%


# cc91eddf 31-Oct-2012 macallan <macallan@NetBSD.org>

in sme_battery_check():
- don't assume that all batteries have exactly one ENVSYS_INDICATOR
- check capacity and charge sensors for ENVSYS_SVALID before using them
now this works on macppc


# 4a1679ff 06-Sep-2012 pgoyette <pgoyette@NetBSD.org>

Remove (commented-out) definitions for debugging - thanks to macallan@
for defflagging these.


# b563ee62 27-Aug-2012 pgoyette <pgoyette@NetBSD.org>

1. Enable use of FMONSTCHANGED events for INDICATOR sensors
2. Update handling of FMONCRITICAL event reporting. The state
transition does not require a corresponding change in value.

With these

1. Enable use of FMONSTCHANGED events for INDICATOR sensors
2. Update handling of FMONCRITICAL event reporting. The state
transition does not require a corresponding change in value.

With these changes, you can now have an INDICATOR sensor that
reports the presence or absence of a device, and (if the device
is present) separately monitor it for proper functioning.

Should address the concerns expressed recently with the commit
of changes to wmi(4) BBU handling.

show more ...


# 04b08ddd 19-Jul-2012 pgoyette <pgoyette@NetBSD.org>

If previously there was only a dummy event entry (to force refresh for
entropy gathering), allow it to be updated for the current request to
add a real entry.


# c8c0bbbd 18-Jul-2012 pgoyette <pgoyette@NetBSD.org>

Release the mutex before taking a quick exit.


# ab95dbb6 16-Jul-2012 pgoyette <pgoyette@NetBSD.org>

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.


# 8f5b32f4 15-Jul-2012 pgoyette <pgoyette@NetBSD.org>

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.


# 0708d85f 15-Jul-2012 pgoyette <pgoyette@NetBSD.org>

When unregistering a sensor device, make sure we unregister and delete
all the associated events.


12345