commit | 03f93acdcd1ffe9a2f03d6509a59d857017b3074 | [log] [tgz] |
---|---|---|
author | Jeff Lin <JeffLin2@quantatw.com> | Tue Mar 21 14:36:53 2023 +0800 |
committer | Zhikui Ren <zhikui.ren@intel.com> | Fri Apr 07 20:13:30 2023 +0000 |
tree | 93f72823c2a408b13300f243d8f53902e0b0b22a | |
parent | 3fce1bf44e13b339d2d13eb0063858761cb512ed [diff] |
IntelCPUSensor: Fix threshold hysteresis is nan Threshold's hysteresis is set to nan as default in constructor, the function parseThresholdsFromAttr will forcely update threshold's hysteresis as nan[1]. Because IntelCPUSensor will run parseThresholdsFromAttr in IntelCPUSensor::handleResponse, this nan will not be updated by hysteresisTrigger in function setInitialProperties[2]. When the threshold's hysteresis is always nan, the condition of deassert will never be satisfied. Update theshold's hysteresis to be 0 base on max/min chosed in IntelCPUSensor[3] because the function parseThresholdsFromAttr is only used by IntelCPUSensor for now. Refs: ``` [1] https://github.com/openbmc/dbus-sensors/blob/master/src/Thresholds.cpp#L519 [2] https://github.com/openbmc/dbus-sensors/blob/master/src/sensor.hpp#L277 [3] https://github.com/openbmc/dbus-sensors/blob/master/src/IntelCPUSensor.cpp#L46 ``` Tested: DIMM_B0_CPU0 sensor with threshold 93/95 as UWT/UCT, respectively. Enable flag 'insecure-sensor-override' and then set sensor value to 100 on dbus and then set sensor value to 50 on dbus. Before change: ``` root@qbmc:~# busctl introspect xyz.openbmc_project.IntelCPUSensor /xyz/openbmc_project/sensors/temperature/DIMM_B0_CPU0 NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.freedesktop.DBus.Introspectable interface - - - .Introspect method - s - org.freedesktop.DBus.Peer interface - - - .GetMachineId method - s - .Ping method - - - org.freedesktop.DBus.Properties interface - - - .Get method ss v - .GetAll method s a{sv} - .Set method ssv - - .PropertiesChanged signal sa{sv}as - - xyz.openbmc_project.Association.Definitions interface - - - .Associations property a(sss) 1 "chassis" "all_sensors" "/xyz/openb... emits-change xyz.openbmc_project.Sensor.Threshold.Critical interface - - - .CriticalAlarmHigh property b true emits-change .CriticalAlarmLow property b false emits-change .CriticalHigh property d 95 emits-change writable .CriticalLow property d nan emits-change writable xyz.openbmc_project.Sensor.Threshold.Warning interface - - - .WarningAlarmHigh property b true emits-change .WarningAlarmLow property b false emits-change .WarningHigh property d 93 emits-change writable .WarningLow property d nan emits-change writable xyz.openbmc_project.Sensor.Value interface - - - .MaxValue property d 127 emits-change .MinValue property d -128 emits-change .Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change .Value property d 50 emits-change writable xyz.openbmc_project.State.Decorator.Availability interface - - - .Available property b true emits-change writable xyz.openbmc_project.State.Decorator.OperationalStatus interface - - - .Functional property b true emits-change ``` After: ``` root@qbmc:~# busctl introspect xyz.openbmc_project.IntelCPUSensor /xyz/openbmc_project/sensors/temperature/DIMM_B0_CPU0 NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.freedesktop.DBus.Introspectable interface - - - .Introspect method - s - org.freedesktop.DBus.Peer interface - - - .GetMachineId method - s - .Ping method - - - org.freedesktop.DBus.Properties interface - - - .Get method ss v - .GetAll method s a{sv} - .Set method ssv - - .PropertiesChanged signal sa{sv}as - - xyz.openbmc_project.Association.Definitions interface - - - .Associations property a(sss) 1 "chassis" "all_sensors" "/xyz/openb... emits-change xyz.openbmc_project.Sensor.Threshold.Critical interface - - - .CriticalAlarmHigh property b false emits-change .CriticalAlarmLow property b false emits-change .CriticalHigh property d 95 emits-change writable .CriticalLow property d nan emits-change writable xyz.openbmc_project.Sensor.Threshold.Warning interface - - - .WarningAlarmHigh property b false emits-change .WarningAlarmLow property b false emits-change .WarningHigh property d 93 emits-change writable .WarningLow property d nan emits-change writable xyz.openbmc_project.Sensor.Value interface - - - .MaxValue property d 127 emits-change .MinValue property d -128 emits-change .Unit property s "xyz.openbmc_project.Sensor.Value.Uni... emits-change .Value property d 50 emits-change writable xyz.openbmc_project.State.Decorator.Availability interface - - - .Available property b true emits-change writable xyz.openbmc_project.State.Decorator.OperationalStatus interface - - - .Functional property b true emits-change ``` and the signal "ThresholdAsserted" for deassert is triggered. Change-Id: I107a2ac587f5791c47b9e7fd5a7c06ef4a312941 Signed-off-by: Jeff Lin <JeffLin2@quantatw.com>
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.