Ensure PSU sensor values are refreshed

A server managed by OpenBMC may have more than a single power
supply. In the event that one or more PSU's have AC removed, or are
removed from the system, the PSU sensors should reflect the loss of
the input power from the PSU. This condition was not being reflected
when using the current PSU sensor code. AC loss from a single PSU
resulted in the output power value remaining greater than zero. This
was due to the use of the ASIO async_read_until function.

The ASIO async_read_until function can only be used on well behaved
interfaces that will not fail. The hwmon files being read do not
conform. Reads can result in an EAGAIN error code. The
async_read_until documentation states EAGAIN is not handled.

The code changes in this commit are lifted from the IPMB bridge
source. The hwmon file containing the sensor reading is opened so that
it is non-blocking. The sensors are read when the kernel indicates a
change has been made. Subsequent reads occur only after a delay time
has expired in order to prevent too many reads from being performed,
and thus consuming CPU time.

Tested:
The SUT is a dual PSU system.
Both PSU's are enabled at the beginning of the test.
Run 'ipmitool sensor list' and inspect the PSU state
  * All input/output voltages/currents are presented
Remove AC from PSU1
Run the ipmitool command again, and see that the values for PSU1
change state, reflecting the power loss.
  * Prior to this change the output power values stalled
Restore AC to PSU1
Run the ipmitool command again, and see that the values for PSU1
are restored.
Remove AC from PSU2
The ipmitool values will reflect the loss of voltage/current/power
  * Prior to this change the output power values stalled
Restore AC to PSU2
The sensor values for PSU2 will be present again.

Change-Id: Id3fea32722044f3e3b106cd0be11f6f43c038011
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
2 files changed
tree: 42485abdfef6a054205869980279d05077479e21
  1. include/
  2. service_files/
  3. src/
  4. subprojects/
  5. tests/
  6. .clang-format
  7. .clang-ignore
  8. .clang-tidy
  9. .gitignore
  10. Jenkinsfile
  11. LICENSE
  12. MAINTAINERS
  13. meson.build
  14. meson_options.txt
  15. README.md
README.md

dbus-sensors

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.

key features

  • 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

sensor documentation