commit | 7627c860fa551663436416aa12f5afe2f7136930 | [log] [tgz] |
---|---|---|
author | Zev Weiss <zev@bewilderbeest.net> | Thu Nov 17 14:23:04 2022 -0800 |
committer | Zev Weiss <zev@bewilderbeest.net> | Tue Nov 22 14:12:59 2022 -0800 |
tree | 2fdc049d14ddf50a384933997024f7cfcc74b41b | |
parent | ece5c86a1260185f5fffd469ea8e994f8b39655c [diff] |
hwmontempsensor: Fix crash on eventHandler signal callback Previously the device-management logic didn't handle the eventHandler() case quite right, leading to crashes like the following when eventHandler()'s call to createSensors() ends up spuriously trying to re-create sensor devices: hwmontempsensor[455]: terminate called after throwing an instance of 'boost::wrapexcept<boost::system::system_error>' hwmontempsensor[455]: what(): open: No such file or directory [system:2 at /usr/include/boost/asio/detail/impl/io_uring_file_service.ipp:61:5 in function 'boost::system::error_code boost::asio::detail::io_uring_file_service::open(implementation_type&, const char*, boost::asio::file_base::flags, boost::system::error_code&)'] To fix this we have instantiateDevices() augment the map it returns to include all sensor devices (not just newly created ones) and adding a bool to indicate whether each one was newly instantiated or already existed. This allows createSensors() to reuse existing I2CDevices when called by eventHandler() instead of needlessly trying to destroy & re-create them. Tested: On romed8hm3 ran hwmontempsensor by hand (to keep systemd from restarting it) and restarted E-M to trigger an eventHandler() call, verified that hwmontempsensor didn't crash and kept all sensors instantiated. Also tested powering the host on and off to verify that host-power-domain sensors were still torn down and re-created as appropriate. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Change-Id: I576ff6238f45d8e2885790a624fb5c838648c897
dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.
runtime re-configurable from d-bus (entity-manager or the like)
isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible
async single-threaded: uses sdbusplus/asio bindings
multiple data inputs: hwmon, d-bus, direct driver access
A typical dbus-sensors object support the following dbus interfaces:
Path /xyz/openbmc_project/sensors/<type>/<sensor_name> Interfaces xyz.openbmc_project.Sensor.Value xyz.openbmc_project.Sensor.Threshold.Critical xyz.openbmc_project.Sensor.Threshold.Warning xyz.openbmc_project.State.Decorator.Availability xyz.openbmc_project.State.Decorator.OperationalStatus xyz.openbmc_project.Association.Definitions
Sensor interfaces collection are described here.
Consumer examples of these interfaces are Redfish, Phosphor-Pid-Control, IPMI SDR.
dbus-sensor daemons are reactors that dynamically create and update sensors configuration when system configuration gets updated.
Using asio timers and async calls, dbus-sensor daemons read sensor values and check thresholds periodically. PropertiesChanged signals will be broadcasted for other services to consume when value or threshold status change. OperationStatus is set to false if the sensor is determined to be faulty.
A simple sensor example can be found here.
Sensor devices are described using Exposes records in configuration file. Name and Type fields are required. Different sensor types have different fields. Refer to entity manager schema for complete list.