cpusensor: access inventoryIfaces by reference instead of by value

Previously this lookup was copying the value out of the map instead of
taking a reference to it, so the subsequent reassignment didn't actually
update the contents of the map.

In certain unusual situations involving repeated sensor discovery
attempts (the case in question being a host CPU whose PECI
implementation doesn't support reading DIMM temperatures, preventing the
sensor from ever reaching the READY state and thus PECI pings continuing
indefinitely), this can lead to a host reboot causing the cpusensor
daemon to attempt to re-register a dbus interface it had already
registered previously, followed shortly by a crash:

  terminate called after throwing an instance of 'sdbusplus::exception::SdBusError'
    what():  sd_bus_add_object_vtable: org.freedesktop.DBus.Error.FileExists: File exists

With this patch in place, cpusensor runs smoothly across a host reboot.

Change-Id: Ie4ceb9e42db2237a8a08e7c52953b016d1e8b56e
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Suggested-by: Ed Tanous <ed@tanous.net>
1 file changed
tree: 1e6117c1e9704ff84d93f621e8347a23413ec4c7
  1. include/
  2. service_files/
  3. src/
  4. tests/
  5. .clang-format
  6. .clang-ignore
  7. .clang-tidy
  8. .gitignore
  9. Jenkinsfile
  10. LICENSE
  11. MAINTAINERS
  12. meson.build
  13. meson_options.txt
  14. 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