From 9ba0a34356c336f50da00a76b2f7c8174b063d2e Mon Sep 17 00:00:00 2001 From: Peter Yin Date: Thu, 9 Jan 2025 10:08:56 -0800 Subject: [PATCH] dbus-sensors: fixed dbus-sensors crash and can't find sensors issue. Summary: The "0005-Utils-support-powerState-for-multi-node-system.patch" does not align with the previous logic. This leads to a crash in the dbus-sensors daemon because it fails to retrieve the host status. The daemon crash triggers many debug dumps at the same time, using too many resources and causing D-Bus to to hang. As a result, the sensors daemon and PSM daemon also crash, leading to the error xyz.openbmc_project.Common.Error.InternalFailure. The commit move patch 0005 to multi-host and add base on https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/69161to to fix sensor name not match issue. X-link: https://github.com/facebookexternal/openbmc.quanta/pull/4530 Reviewed By: williamspatrick Differential Revision: D67936616 fbshipit-source-id: 40079284dcc218c65ca9b430cb205abd7ffe507e --- ...0003-DeviceMgmt-fix-device-not-found.patch | 221 ++++++++++++++ ...avoid-crash-by-activate-sensor-twice.patch | 284 ------------------ ...ort-powerState-for-multi-node-system.patch | 67 ++--- .../sensors/dbus-sensors_%.bbappend | 7 +- 4 files changed, 247 insertions(+), 332 deletions(-) create mode 100644 common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-DeviceMgmt-fix-device-not-found.patch delete mode 100644 common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-psusensor-avoid-crash-by-activate-sensor-twice.patch diff --git a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-DeviceMgmt-fix-device-not-found.patch b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-DeviceMgmt-fix-device-not-found.patch new file mode 100644 index 000000000000..7fdbe93a3fcc --- /dev/null +++ b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-DeviceMgmt-fix-device-not-found.patch @@ -0,0 +1,221 @@ +From 6cadd4432a0dc24af7f4188c44119a9456c588e2 Mon Sep 17 00:00:00 2001 +From: Cosmo Chou +Date: Tue, 31 Dec 2024 14:39:48 +0800 +Subject: [PATCH 3/3] DeviceMgmt: fix device not found + +Link:https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/69161 + +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There are custom sensor names that do not match with `Name` field in the +configuration. It causes sensors set device is_new to true incorrectly. + +In psusensor, it depends on "is_new" to decide whether to skip sensor +creation and activation for his device. If "is_new" is always true, it +could cause the sensor's activate() called multiple times and cause +program to crash after throwing a system error. + +Take MB_ADC0 in harma_mb.json for example, the "sensorName" in code is +the Name field of config, which is "MB_ADC0". And the "sensor.first" in +code will be the customized name from inX_Name. For example, there are +will have 5 sensors from this config in psusensor as below. + +- Sensor config of MB_ADC0 in harma_mb.json +``` +root@harma:~# busctl introspect xyz.openbmc_project.EntityManager /xyz/openbmc_project/inventory/system/board/Harma_MB/MB_ADC0 xyz.openbmc_project.Configuration.ADC128D818 +NAME TYPE SIGNATURE RESULT/VALUE FLAGS +.Address property t 29 emits-change +.Bus property t 29 emits-change +.Labels property as 5 "in1" "in2" "in3" "in4" "in5" emits-change +.Name property s "MB_ADC0" emits-change +.Type property s "ADC128D818" emits-change +.in1_Name property s "MB_PVDD11_S3_VOLT_V" emits-change +.in2_Name property s "MB_P3V3_STBY_VOLT_V" emits-change +.in2_Scale property t 500 emits-change +.in3_Name property s "MB_PVDD18_S5_VOLT_V" emits-change +.in4_Name property s "MB_P12V_AUX_VOLT_V" emits-change +.in4_Scale property d 151.515 emits-change +.in5_Name property s "MB_P12V_STBY_VOLT_V" emits-change +.in5_Scale property d 151.515 emits-change +``` + +- Actual sensor names of MB_ADC0 + - in1_Name: MB_PVDD11_S3_VOLT_V + - in2_Name: MB_P3V3_STBY_VOLT_V + - in3_Name: MB_PVDD18_S5_VOLT_V + - in4_Name: MB_P12V_AUX_VOLT_V + - in5_Name: MB_P12V_STBY_VOLT_V + +When the snesor name is not matched with Name field in sensor config, +the devices will add a new device base on the config, but the is_new is +set to true. [1] + +psusensor will decide whether to activate the sensor based on the +device list returned by instantiateDevices(). + +- "is_new" equal to false + sensor activated already, so skip the rest sensor setup actions [2] + +- "is_new" equal to true + it means a new sensor or sensor needs activate, then it will calling + "sensor->activate()" again. (PS: activateOnly will be true if it is + the callback from PowerSate change match) [3] + +Take "MB_PVDD11_S3_VOLT_V" sensor as example, "MB_PVDD11_S3_VOLT_V" is +create and activate at psusensor starts, and then a Host PowerState +change (from off to on) triggered, the createSensorsCallback() will be +called, "MB_PVDD11_S3_VOLT_V" will be activate again due to "is_new" is +equal to true (name not match), then causing psusensor crashed. + +- Crashed log when host power on +``` +Clearing out previous instance for /xyz/openbmc_project/inventory/system/board/Harma_MB/MB_ADC0 +Driver name mcp9600 not found in sensor whitelist +Driver name ast2600-adc1 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name ast2600-adc0 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +Driver name mcp9600 not found in sensor whitelist +failed to find match for 29-0045 +Driver name tmp75 not found in sensor whitelist +failed to find match for 28-004f +Driver name tmp75 not found in sensor whitelist +Driver name tmp75 not found in sensor whitelist +failed to find match for 7-003c +failed to find match for 22-0045 +Driver name tmp421 not found in sensor whitelist +failed to find match for 29-001f +Driver name tmp75 not found in sensor whitelist +Driver name tmp75 not found in sensor whitelist +terminate called after throwing an instance of 'boost::wrapexcept' + what(): open: Already open [asio.misc:1 at /usr/include/boost/asio/detail/impl/io_uring_file_service.ipp:53: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&)'] +Aborted (core dumped) +``` + +In parent class "Sensor", the data member configurationPath stores the +corresponding EM configuration object path, so we use direct comparison +of "path.str" and "configurationPath" to replace sensorNameFind(). + +[1] https://github.com/openbmc/dbus-sensors/blob/cafd72f/src/DeviceMgmt.hpp#L154-L157 +[2] https://github.com/openbmc/dbus-sensors/blob/5b3542e/src/PSUSensorMain.cpp#L442-L445 +[3] https://github.com/openbmc/dbus-sensors/blob/5b3542e/src/PSUSensorMain.cpp#L926 + +Tested Result: +psusensor service not crashing after host power cycle. +``` +root@harma:~# systemctl status xyz.openbmc_project.psusensor +● xyz.openbmc_project.psusensor.service - PSU Sensor + Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.psusensor.service; enabled; preset: enabled) + Drop-In: /usr/lib/systemd/system/xyz.openbmc_project.psusensor.service.d + └─psusensor-wait-host-state-ready.conf + Active: active (running) since Mon 2024-02-26 20:27:36 PST; 2min 49s ago + Main PID: 455 (psusensor) + CPU: 16.564s + CGroup: /system.slice/xyz.openbmc_project.psusensor.service + └─455 /usr/bin/psusensor + +Feb 26 20:30:23 harma psusensor[455]: Failure assert +Feb 26 20:30:23 harma psusensor[455]: MB_DIMM_A10_PWR_W read failed +Feb 26 20:30:23 harma psusensor[455]: MB_DIMM_A10_TEMP_C read failed +Feb 26 20:30:24 harma psusensor[455]: MB_DIMM_A10_PWR_W read failed +Feb 26 20:30:24 harma psusensor[455]: MB_DIMM_A10_TEMP_C read failed +Feb 26 20:30:25 harma psusensor[455]: MB_DIMM_A10_PWR_W read failed +Feb 26 20:30:25 harma psusensor[455]: MB_DIMM_A10_TEMP_C read failed +Feb 26 20:30:26 harma psusensor[455]: Failure deassert +Feb 26 20:30:26 harma psusensor[455]: MB_DIMM_A10_PWR_W read failed +Feb 26 20:30:26 harma psusensor[455]: MB_DIMM_A10_TEMP_C read failed +root@harma:~# +root@harma:~# obmcutil poweroff +root@harma:~# sleep 10 +root@harma:~# obmcutil poweron +root@harma:~# sleep 10 +root@harma:~# +root@harma:~# systemctl status xyz.openbmc_project.psusensor +● xyz.openbmc_project.psusensor.service - PSU Sensor + Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.psusensor.service; enabled; preset: enabled) + Drop-In: /usr/lib/systemd/system/xyz.openbmc_project.psusensor.service.d + └─psusensor-wait-host-state-ready.conf + Active: active (running) since Mon 2024-02-26 20:27:36 PST; 4min 11s ago + Main PID: 455 (psusensor) + CPU: 24.262s + CGroup: /system.slice/xyz.openbmc_project.psusensor.service + └─455 /usr/bin/psusensor + +Feb 26 20:31:42 harma psusensor[455]: Failure deassert +Feb 26 20:31:43 harma psusensor[455]: PSUSubEvent asserted by /sys/class/hwmon/hwmon26/in2_alarm +Feb 26 20:31:43 harma psusensor[455]: Failure assert +Feb 26 20:31:44 harma psusensor[455]: Failure deassert +Feb 26 20:31:45 harma psusensor[455]: PSUSubEvent asserted by /sys/class/hwmon/hwmon25/in2_alarm +Feb 26 20:31:45 harma psusensor[455]: Failure assert +Feb 26 20:31:45 harma psusensor[455]: Failure deassert +Feb 26 20:31:46 harma psusensor[455]: PSUSubEvent asserted by /sys/class/hwmon/hwmon34/in2_alarm +Feb 26 20:31:46 harma psusensor[455]: Failure assert +Feb 26 20:31:48 harma psusensor[455]: Failure deassert +``` + +Change-Id: If73c622cdcda50492d6ef3162da0e11966276cdb +Signed-off-by: Potin Lai +--- + src/DeviceMgmt.hpp | 21 +++------------------ + 1 file changed, 3 insertions(+), 18 deletions(-) + +diff --git a/src/DeviceMgmt.hpp b/src/DeviceMgmt.hpp +index 4b4dea8..d2a84fc 100644 +--- a/src/DeviceMgmt.hpp ++++ b/src/DeviceMgmt.hpp +@@ -96,26 +96,10 @@ boost::container::flat_map(&findSensorName->second); +- if (sensorName == nullptr) +- { +- std::cerr << "Unable to find sensor name " << name +- << " on path " << path.str << "\n"; +- continue; +- } +- + std::shared_ptr findSensor(nullptr); + for (const auto& sensor : sensors) + { +- if (sensorNameFind(sensor.first, *sensorName) != +- std::string::npos) ++ if (path.str == sensor.second->configurationPath) + { + findSensor = sensor.second; + break; +@@ -126,7 +110,7 @@ boost::container::flat_mapgetI2CDevice(), false)); +- continue; ++ break; + } + + std::optional params = +@@ -154,6 +138,7 @@ boost::container::flat_map(*params), + true)); ++ break; + } + catch (std::runtime_error&) + { +-- +2.25.1 + diff --git a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-psusensor-avoid-crash-by-activate-sensor-twice.patch b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-psusensor-avoid-crash-by-activate-sensor-twice.patch deleted file mode 100644 index a0aa1bd0cae7..000000000000 --- a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0003-psusensor-avoid-crash-by-activate-sensor-twice.patch +++ /dev/null @@ -1,284 +0,0 @@ -From 5eed4ab802fa52ade5de6a8023d433d72df6eb5b Mon Sep 17 00:00:00 2001 -From: Peter Yin -Date: Tue, 25 Jun 2024 14:57:08 +0800 -Subject: [PATCH 3/5] psusensor: avoid crash by activate sensor twice -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Sensor should just only activate or deactivate when power state change. - -Simplify powerStateChanged(), just do "sensor->activate()" instead of -calling "createSensors()". - -Also add check in activate(), just return if sensor already activated. - -Tested result: -Do a host power cycle and wait until ostate change to "Standby", -psusensor is not crushing and PID remain same. -``` -root@harma:~# systemctl status xyz.openbmc_project.psusensor -● xyz.openbmc_project.psusensor.service - PSU Sensor - Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.psusensor.service; enabled; preset: enabled) - Drop-In: /usr/lib/systemd/system/xyz.openbmc_project.psusensor.service.d - └─psusensor-wait-host-state-ready.conf - Active: active (running) since Mon 2024-02-26 21:42:47 PST; 1min 10s ago - Main PID: 13355 (psusensor) - CPU: 8.344s - CGroup: /system.slice/xyz.openbmc_project.psusensor.service - └─13355 /usr/bin/psusensor - -Feb 26 21:43:54 harma psusensor[13355]: PSUSubEvent asserted by /sys/class/hwmon/hwmon25/in2_alarm -Feb 26 21:43:54 harma psusensor[13355]: Failure assert -Feb 26 21:43:55 harma psusensor[13355]: MB_DIMM_A10_TEMP_C read failed -Feb 26 21:43:55 harma psusensor[13355]: MB_DIMM_A10_PWR_W read failed -Feb 26 21:43:55 harma psusensor[13355]: Failure deassert -Feb 26 21:43:56 harma psusensor[13355]: MB_DIMM_A10_TEMP_C read failed -Feb 26 21:43:56 harma psusensor[13355]: MB_DIMM_A10_PWR_W read failed -Feb 26 21:43:56 harma psusensor[13355]: PSUSubEvent asserted by /sys/class/hwmon/hwmon26/in2_alarm -Feb 26 21:43:56 harma psusensor[13355]: Failure assert -Feb 26 21:43:57 harma psusensor[13355]: MB_DIMM_A10_TEMP_C read failed -root@harma:~# -root@harma:~# obmcutil poweroff -root@harma:~# sleep 10 -root@harma:~# obmcutil poweron -root@harma:~# sleep 60 -root@harma:~# obmcutil osstate -OperatingSystemState: xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby -root@harma:~# -root@harma:~# systemctl status xyz.openbmc_project.psusensor -● xyz.openbmc_project.psusensor.service - PSU Sensor - Loaded: loaded (/usr/lib/systemd/system/xyz.openbmc_project.psusensor.service; enabled; preset: enabled) - Drop-In: /usr/lib/systemd/system/xyz.openbmc_project.psusensor.service.d - └─psusensor-wait-host-state-ready.conf - Active: active (running) since Mon 2024-02-26 21:42:47 PST; 3min 41s ago - Main PID: 13355 (psusensor) - CPU: 22.802s - CGroup: /system.slice/xyz.openbmc_project.psusensor.service - └─13355 /usr/bin/psusensor - -Feb 26 21:46:25 harma psusensor[13355]: MB_DIMM_A10_PWR_W read failed -Feb 26 21:46:26 harma psusensor[13355]: PSUSubEvent asserted by /sys/class/hwmon/hwmon34/in2_alarm -Feb 26 21:46:26 harma psusensor[13355]: Failure assert -Feb 26 21:46:26 harma psusensor[13355]: MB_DIMM_A10_TEMP_C read failed -Feb 26 21:46:26 harma psusensor[13355]: MB_DIMM_A10_PWR_W read failed -Feb 26 21:46:26 harma psusensor[13355]: Failure deassert -Feb 26 21:46:27 harma psusensor[13355]: MB_DIMM_A10_TEMP_C read failed -Feb 26 21:46:27 harma psusensor[13355]: MB_DIMM_A10_PWR_W read failed -Feb 26 21:46:27 harma psusensor[13355]: PSUSubEvent asserted by /sys/class/hwmon/hwmon25/in2_alarm -Feb 26 21:46:27 harma psusensor[13355]: Failure assert -``` - -Change-Id: I3fb55c0f10ad26472470bb783ea5df5498a4c1a8 -Signed-off-by: Potin Lai -Signed-off-by: Peter Yin ---- - src/psu/PSUSensor.cpp | 7 +--- - src/psu/PSUSensor.hpp | 3 +- - src/psu/PSUSensorMain.cpp | 86 ++++++++++++++++----------------------- - 3 files changed, 36 insertions(+), 60 deletions(-) - -diff --git a/src/psu/PSUSensor.cpp b/src/psu/PSUSensor.cpp -index 4d410fe..40d001f 100644 ---- a/src/psu/PSUSensor.cpp -+++ b/src/psu/PSUSensor.cpp -@@ -122,16 +122,13 @@ bool PSUSensor::isActive() - return inputDev.is_open(); - } - --void PSUSensor::activate(const std::string& newPath, -- const std::shared_ptr& newI2CDevice) -+void PSUSensor::activate() - { - if (isActive()) - { - // Avoid activating an active sensor - return; - } -- path = newPath; -- i2cDevice = newI2CDevice; - inputDev.open(path, boost::asio::random_access_file::read_only); - markAvailable(true); - setupRead(); -@@ -143,8 +140,6 @@ void PSUSensor::deactivate() - // close the input dev to cancel async operations - inputDev.close(); - waitTimer.cancel(); -- i2cDevice = nullptr; -- path = ""; - } - - void PSUSensor::setupRead() -diff --git a/src/psu/PSUSensor.hpp b/src/psu/PSUSensor.hpp -index 09601f8..008c632 100644 ---- a/src/psu/PSUSensor.hpp -+++ b/src/psu/PSUSensor.hpp -@@ -28,8 +28,7 @@ class PSUSensor : public Sensor, public std::enable_shared_from_this - const std::shared_ptr& i2cDevice); - ~PSUSensor() override; - void setupRead(); -- void activate(const std::string& newPath, -- const std::shared_ptr& newI2CDevice); -+ void activate(); - void deactivate(); - bool isActive(); - -diff --git a/src/psu/PSUSensorMain.cpp b/src/psu/PSUSensorMain.cpp -index cb8ce63..449bda7 100644 ---- a/src/psu/PSUSensorMain.cpp -+++ b/src/psu/PSUSensorMain.cpp -@@ -302,8 +302,7 @@ static void createSensorsCallback( - std::shared_ptr& dbusConnection, - const ManagedObjectType& sensorConfigs, - const std::shared_ptr>& -- sensorsChanged, -- bool activateOnly) -+ sensorsChanged) - { - int numCreated = 0; - bool firstScan = sensorsChanged == nullptr; -@@ -465,10 +464,6 @@ static void createSensorsCallback( - std::shared_ptr i2cDev; - if (findI2CDev != devices.end()) - { -- if (activateOnly && !findI2CDev->second.second) -- { -- continue; -- } - i2cDev = findI2CDev->second.first; - } - -@@ -946,33 +941,20 @@ static void createSensorsCallback( - << "\"\n"; - } - // destruct existing one first if already created -- -- auto& sensor = sensors[sensorName]; -- if (!activateOnly) -- { -- sensor = nullptr; -- } -- -- if (sensor != nullptr) -- { -- sensor->activate(sensorPathStr, i2cDev); -- } -- else -+ sensors[sensorName] = nullptr; -+ sensors[sensorName] = std::make_shared( -+ sensorPathStr, sensorType, objectServer, dbusConnection, io, -+ sensorName, std::move(sensorThresholds), *interfacePath, -+ readState, findSensorUnit->second, factor, -+ psuProperty.maxReading, psuProperty.minReading, -+ psuProperty.sensorOffset, labelHead, thresholdConfSize, -+ pollRate, i2cDev); -+ sensors[sensorName]->setupRead(); -+ ++numCreated; -+ if constexpr (debug) - { -- sensors[sensorName] = std::make_shared( -- sensorPathStr, sensorType, objectServer, dbusConnection, io, -- sensorName, std::move(sensorThresholds), *interfacePath, -- readState, findSensorUnit->second, factor, -- psuProperty.maxReading, psuProperty.minReading, -- psuProperty.sensorOffset, labelHead, thresholdConfSize, -- pollRate, i2cDev); -- sensors[sensorName]->setupRead(); -- ++numCreated; -- if constexpr (debug) -- { -- std::cerr -- << "Created " << numCreated << " sensors so far\n"; -- } -+ std::cerr -+ << "Created " << numCreated << " sensors so far\n"; - } - } - -@@ -1067,15 +1049,14 @@ void createSensors( - boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer, - std::shared_ptr& dbusConnection, - const std::shared_ptr>& -- sensorsChanged, -- bool activateOnly) -+ sensorsChanged) - { - auto getter = std::make_shared( -- dbusConnection, [&io, &objectServer, &dbusConnection, sensorsChanged, -- activateOnly](const ManagedObjectType& sensorConfigs) { -- createSensorsCallback(io, objectServer, dbusConnection, -- sensorConfigs, sensorsChanged, activateOnly); -- }); -+ dbusConnection, [&io, &objectServer, &dbusConnection, sensorsChanged]( -+ const ManagedObjectType& sensorConfigs) { -+ createSensorsCallback(io, objectServer, dbusConnection, sensorConfigs, -+ sensorsChanged); -+ }); - std::vector types(sensorTypes.size()); - for (const auto& [type, dt] : sensorTypes) - { -@@ -1130,13 +1111,17 @@ void propertyInitialize() - static void powerStateChanged( - PowerState type, bool newState, - boost::container::flat_map>& -- sensors, -- boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer, -- std::shared_ptr& dbusConnection) -+ sensors) - { - if (newState) - { -- createSensors(io, objectServer, dbusConnection, nullptr, true); -+ for (auto& [path, sensor] : sensors) -+ { -+ if (sensor != nullptr && sensor->readState == type) -+ { -+ sensor->activate(); -+ } -+ } - } - else - { -@@ -1164,16 +1149,14 @@ int main() - - propertyInitialize(); - -- auto powerCallBack = [&io, &objectServer, -- &systemBus](PowerState type, bool state) { -- powerStateChanged(type, state, sensors, io, objectServer, systemBus); -+ auto powerCallBack = [](PowerState type, bool state) { -+ powerStateChanged(type, state, sensors); - }; - - setupPowerMatchCallback(systemBus, powerCallBack); - -- boost::asio::post(io, [&]() { -- createSensors(io, objectServer, systemBus, nullptr, false); -- }); -+ boost::asio::post( -+ io, [&]() { createSensors(io, objectServer, systemBus, nullptr); }); - boost::asio::steady_timer filterTimer(io); - std::function eventHandler = - [&](sdbusplus::message_t& message) { -@@ -1193,8 +1176,7 @@ int main() - { - std::cerr << "timer error\n"; - } -- createSensors(io, objectServer, systemBus, sensorsChanged, -- false); -+ createSensors(io, objectServer, systemBus, sensorsChanged); - }); - }; - -@@ -1253,7 +1235,7 @@ int main() - std::cerr << "timer error\n"; - return; - } -- createSensors(io, objectServer, systemBus, nullptr, false); -+ createSensors(io, objectServer, systemBus, nullptr); - }); - }; - --- -2.43.5 - diff --git a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0005-Utils-support-powerState-for-multi-node-system.patch b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0005-Utils-support-powerState-for-multi-node-system.patch index ab5a1120fe14..de79d9a9cc36 100644 --- a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0005-Utils-support-powerState-for-multi-node-system.patch +++ b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors/0005-Utils-support-powerState-for-multi-node-system.patch @@ -55,9 +55,9 @@ d 12.209 src/hwmon-temp/HwmonTempMain.cpp | 6 +- src/psu/PSUSensor.cpp | 25 +- src/psu/PSUSensor.hpp | 9 +- - src/psu/PSUSensorMain.cpp | 21 +- + src/psu/PSUSensorMain.cpp | 10 +- src/sensor.hpp | 7 +- - 7 files changed, 349 insertions(+), 178 deletions(-) + 7 files changed, 342 insertions(+), 174 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index ac0778d..59e989e 100644 @@ -746,7 +746,7 @@ index f7ccb4f..82ec61b 100644 } } diff --git a/src/psu/PSUSensor.cpp b/src/psu/PSUSensor.cpp -index a2913cf..7ce3430 100644 +index ca77edf..3c7c6f1 100644 --- a/src/psu/PSUSensor.cpp +++ b/src/psu/PSUSensor.cpp @@ -44,23 +44,22 @@ static constexpr const char* sensorPathPrefix = "/xyz/openbmc_project/sensors/"; @@ -786,7 +786,7 @@ index a2913cf..7ce3430 100644 buffer = std::make_shared>(); std::string unitPath = sensor_paths::getPathForUnits(sensorUnits); diff --git a/src/psu/PSUSensor.hpp b/src/psu/PSUSensor.hpp -index cebe730..27609be 100644 +index 7dbd15b..c2afe4a 100644 --- a/src/psu/PSUSensor.hpp +++ b/src/psu/PSUSensor.hpp @@ -25,7 +25,8 @@ class PSUSensor : public Sensor, public std::enable_shared_from_this @@ -798,8 +798,8 @@ index cebe730..27609be 100644 + const size_t& slotId); ~PSUSensor() override; void setupRead(); - void activate(); -@@ -61,6 +62,7 @@ class PSUSensor : public Sensor, public std::enable_shared_from_this + void activate(const std::string& newPath, +@@ -62,6 +63,7 @@ class PSUSensor : public Sensor, public std::enable_shared_from_this static constexpr double defaultSensorPoll = 1.0; static constexpr unsigned int defaultSensorPollMs = static_cast(defaultSensorPoll * 1000); @@ -807,7 +807,7 @@ index cebe730..27609be 100644 }; class PSUProperty -@@ -68,8 +70,9 @@ class PSUProperty +@@ -69,8 +71,9 @@ class PSUProperty public: PSUProperty(std::string name, double max, double min, double factor, double offset) : @@ -820,10 +820,10 @@ index cebe730..27609be 100644 ~PSUProperty() = default; diff --git a/src/psu/PSUSensorMain.cpp b/src/psu/PSUSensorMain.cpp -index fec80ef..d452704 100644 +index e64b1cc..c45aff6 100644 --- a/src/psu/PSUSensorMain.cpp +++ b/src/psu/PSUSensorMain.cpp -@@ -513,6 +513,7 @@ static void createSensorsCallback( +@@ -518,6 +518,7 @@ static void createSensorsCallback( checkGroupEvent(directory.string(), groupEventPathList); PowerState readState = getPowerState(*baseConfig); @@ -831,42 +831,17 @@ index fec80ef..d452704 100644 /* Check if there are more sensors in the same interface */ int i = 1; -@@ -953,7 +954,7 @@ static void createSensorsCallback( - readState, findSensorUnit->second, factor, - psuProperty.maxReading, psuProperty.minReading, - psuProperty.sensorOffset, labelHead, thresholdConfSize, -- pollRate, i2cDev); -+ pollRate, i2cDev, readSlot); - sensors[sensorName]->setupRead(); - ++numCreated; - if constexpr (debug) -@@ -1059,9 +1060,9 @@ void createSensors( - auto getter = std::make_shared( - dbusConnection, [&io, &objectServer, &dbusConnection, sensorsChanged]( - const ManagedObjectType& sensorConfigs) { -- createSensorsCallback(io, objectServer, dbusConnection, sensorConfigs, -- sensorsChanged); -- }); -+ createSensorsCallback(io, objectServer, dbusConnection, -+ sensorConfigs, sensorsChanged); -+ }); - std::vector types(sensorTypes.size()); - for (const auto& [type, dt] : sensorTypes) - { -@@ -1124,7 +1125,11 @@ static void powerStateChanged( - { - if (sensor != nullptr && sensor->readState == type) - { -- sensor->activate(); -+ if ((type == PowerState::chassisOn) && -+ (isChassisOn(sensor->slotId))) -+ { -+ sensor->activate(); -+ } - } - } - } -@@ -1134,7 +1139,11 @@ static void powerStateChanged( +@@ -970,7 +971,8 @@ static void createSensorsCallback( + readState, findSensorUnit->second, factor, + psuProperty.maxReading, psuProperty.minReading, + psuProperty.sensorOffset, labelHead, thresholdConfSize, +- pollRate, i2cDev); ++ pollRate, i2cDev, readSlot); ++ + sensors[sensorName]->setupRead(); + ++numCreated; + if constexpr (debug) +@@ -1149,7 +1151,11 @@ static void powerStateChanged( { if (sensor != nullptr && sensor->readState == type) { @@ -919,5 +894,5 @@ index 82798dc..be25504 100644 void markFunctional(bool isFunctional) -- -2.43.5 +2.25.1 diff --git a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors_%.bbappend index e875b6877db5..5024906ab4b4 100644 --- a/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/common/lfopenbmc/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -3,7 +3,10 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI:append = " \ file://0001-PSUSensor-add-ina233-support.patch \ file://0002-PSUSensor-add-adm1281-support.patch \ - file://0003-psusensor-avoid-crash-by-activate-sensor-twice.patch \ + file://0003-DeviceMgmt-fix-device-not-found.patch \ file://0004-PSUSensor-Fix-error-for-decimal-part-of-scalefactor.patch \ - file://0005-Utils-support-powerState-for-multi-node-system.patch \ +" + +SRC_URI:append:fb-compute-multihost = " \ + file://0005-Utils-support-powerState-for-multi-node-system.patch \ "