summaryrefslogtreecommitdiff
path: root/sys/dev/sysmon
AgeCommit message (Collapse)Author
2008-11-11Fix typo in previous, and wrap a panic with #ifdef DIAGNOSTICpgoyette
2008-11-11Initialize event's "previous sent state" based on the event monitor type,pgoyette
regardless of sensor type. Fixes spurious "device: normal state on 'sensor-name' messages (reported by ad@) which interfere with sysinst.
2008-11-04Fix cut&paste error in prevpgoyette
2008-11-04Restore previous behavior concerning CRITICAL events. Send an eventpgoyette
whenever state enters or exits CRITICAL, or whenever value of sensor changes while the state is CRITICAL.
2008-09-07Only report new sensor state values if the new value is valid for thepgoyette
particular event being monitored. This avoids duplicate reporting for sensors that monitor both a normal/critical state and value-within-limits state as reported by Simon Burge on current-users. While we're here, clean-up some stair-stepping if's. OK garbled@
2008-09-05Rearrange code in the sysmon queue execution thread to simplify locking logic.gmcgarry
Removes unreachable code warning.
2008-09-05Rearrange sysmonread_power() to have a single exit point, which simplifiesgmcgarry
the locking and fixes -Wunreachable-code warning.
2008-09-04Initialize event's sent-state appropriately to avoid unnecessary start-uppgoyette
time messages that report a "transition" to the Normal state.
2008-08-221. provide for warning-min and warning-max alarm levels in addition topgoyette
critical-min and critical-max; also, a battery warning-capacity is added in addition to a critical-capacity. 2. usr.sbin/envstat is modified to introduce a -W command line switch to display the warning-* values instead of the critical-* values, and envstat(8) and envsys.conf(5) man pages are updated appropriately. 3. Treat user-defined limits as a single continuum and generate a single event regardless of how many boundaries a change in sensor value crosses; ditto for driver-defined limits. Fixes my PR/39021 Fixes my PR/39022 OK'd by christos@ bouyer@ cube@
2008-06-11in sme_battery_check(), explicitely check whether the battery isdrochner
present before using the values read, and clean up the logics a bit to make it more understandable
2008-06-03Add SME_POLL_ONLY flag, which informs sme to only refresh the sensor whenjmcneill
it is polled (and not from GTREDATA).
2008-05-10Use aprint when reporting AC adapter status.jmcneill
2008-04-06Pass KTHREAD_MPSAFE to kthread_create(). I've been testing this forxtraeme
some weeks in both UP and SMP without any issue so far.
2008-04-04Update includes. Builds again on sparc64.hannken
Ok: Juan Romero Pardines <xtraeme@netbsd.org>
2008-04-02Initialize and destroy the callout in sme_events_init() andxtraeme
sme_events_destroy() respectively. And don't stop twice the callout when calling sysmon_envsys_unregister().
2008-04-01Also fix a memleak when the event is already in dictionaryxtraeme
and has been updated.
2008-04-01sme_event_register: fix a memory leaks in two error paths.rmind
2008-04-01Introduce per-device locking/synchronization and maintain only axtraeme
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
2008-03-23Fix some problems reported by <drochner> a while ago on tech-kern:xtraeme
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.
2008-03-03Pass D_MPSAFE to d_flag in the cdevsw struct, so that the kernel_lockxtraeme
is not taken in the driver methods. I've been running with this for some days without any effect.
2008-03-01Welcome to 4.99.55:rmind
- Add a lot of missing selinit() and seldestroy() calls. - Merge selwakeup() and selnotify() calls into a single selnotify(). - Add an additional 'events' argument to selnotify() call. It will indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown, zero may be used. Note: please pass appropriate value of 'events' where possible. Proposed on: <tech-kern>
2008-02-29Added a missing break that was bothering me.xtraeme
2008-02-29Only check sysmon_low_power if the event comes fromxtraeme
ENVSYS_BATTERY_CAPACITY sensors.
2008-02-28Add three new values for ENVSYS_DRIVE units:xtraeme
* ENVSYS_DRIVE_OFFLINE, ENVSYS_DRIVE_CHECK and ENVSYS_DRIVE_BUILD
2008-02-02Destroy the callout via sysmon_envsys_destroy() now that it'sxtraeme
initialized in sysmon_envsys_create().
2008-01-04Start detangling lock.h from intr.h. This is likely to cause short termad
breakage, but the mess of dependencies has been regularly breaking the build recently anyhow.
2008-01-02- Initialize the callout with CALLOUT_MPSAFE, like it was done beforextraeme
in sysmon_envsys_events.c. - Separate sme_event_check_low_power() into sme_battery_check(), sme_acadapter_check() and sme_battery_critical() (no functional changes).
2008-01-02In sysmon_envsys_create(), initialize the callout structure. Stopsdyoung
panics with a DIAGNOSTIC kernel. In sysmon_envsys_find_40(), wait until an envsys is not busy before settings its busy flag, in the pattern of sysmon_envsys_find().
2008-01-02Use LIST_FOREACH().dyoung
2008-01-02Use TAILQ_FOREACH().dyoung
2007-12-22Handle hotkey events using /etc/powerd/scripts/hotkey_button, ok xtraemejmcneill
2007-12-16In sysmon_wdog_unregister(), do not return until all of the watchdogdyoung
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.
2007-12-15Use LIST_FOREACH().dyoung
2007-12-09Add missing <sys/device.h> include.martin
2007-12-09Merge jmcneill-pm branch.jmcneill
2007-12-07Add ENVSYS_DRIVE_MIGRATING for ENVSYS_DRIVE sensors, this is for RAIDxtraeme
volumes that are migrating such as when you change the stripe size. While I'm here use the same string than we had in the old framework to report status "online" vs "drive is online", because the sensor might be a RAID volume and not just a drive.
2007-12-05Do not "return 1" from kqfilter for errors. That value is passedpooka
directly to the userland caller and results in a mysterious EPERM. Instead, return EINVAL or something else sensible depending on the case.
2007-12-05Match the docs: MUTEX_DRIVER/SPIN are now only for porting code writtenad
for Solaris.
2007-12-05MUTEX_SPIN -> MUTEX_DEFAULT.ad
2007-11-20Update a comment.xtraeme
2007-11-20After comments from Andrew Doran:xtraeme
- 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.
2007-11-16Remove duplicate sme_events_list.xtraeme
2007-11-16Extend the envsys2 API (one more time, sorry) as defined in:xtraeme
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.
2007-11-10Add another flag that is set only when the event was enqueuedxtraeme
(and its dictionary created) successfully and use it in the POWER_EVENT_RECVDICT ioctl to check if the dictionary is ready before calling prop_dictionary_copyout_ioctl(). This fixes a rare condition when too many events are enqueued and there wasn't time to create the dictionary, so prop_dictionary_copyout_ioctl() fails with a NULL pointer dereference.
2007-11-03Remove sysmon_envsys_find() proto, it's defined on sysmon_envsysvar.h.xtraeme
2007-11-03- Rename ENVSYS_BATTERY_STATE units to ENVSYS_BATTERY_CAPACITY andxtraeme
introduce ENVSYS_BATTERY_CHARGE, which is the same than an Indicator and it's used to know if the battery is currently charging or discharging. - Require two sensors at least for SME_CLASS_BATTERY to make the low-power condition work: a ENVSYS_BATTERY_CAPACITY plus ENVSYS_BATTERY_CHARGE. - Simplify sme_event_check_lowpower() and make it check the required sensors in the SME_CLASS_ACADAPTER and SME_CLASS_BATTERY classes. If the acadapter is not ready, trust the state returned by the battery device. Based on suggestion from joerg@.
2007-11-02do not embed acpi device names in the sensor namesplunky
fake it in the compat code for the old envsys API
2007-10-23Use a flag for see_flags to know when the sensor has been refreshedxtraeme
rather than using a boolean. Suggested by rmind.
2007-10-20performance fix: in the workqueue handler only refresh the sensor once,xtraeme
not multiple times for the same sensor and clear its state after all events were processed.
2007-10-13sme_event_drvadd: there's no need to acquire the mutex only whenxtraeme
setting the object on its dictionary.