phosphor-pid-control: Updating patch for upstream
Upstream has removed the old Makefile files, standardizing on Meson, so
correspondingly removing them from this patch also.
Upstream has merged the Association-Definitions and reuse-the-code
patches, so their local patch files can be safely deleted:
https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/60580
https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/58664
Tested: It now builds again, when using the latest upstream
phosphor-pid-control version.
Change-Id: I9be384fb4bf851b2dafb31dcd532a3ed45a00792
Google-Bug-Id: 267556082
Google-Bug-Id: 269669082
Signed-off-by: Josh Lehan <krellan@google.com>
diff --git a/recipes-phosphor/fans/phosphor-pid-control/0001-Implementing-the-TempToMargin-feature.patch b/recipes-phosphor/fans/phosphor-pid-control/0001-Implementing-the-TempToMargin-feature.patch
index 651ea32..2e9a3bd 100644
--- a/recipes-phosphor/fans/phosphor-pid-control/0001-Implementing-the-TempToMargin-feature.patch
+++ b/recipes-phosphor/fans/phosphor-pid-control/0001-Implementing-the-TempToMargin-feature.patch
@@ -34,13 +34,12 @@
pid/pidcontroller.hpp | 1 +
pid/thermalcontroller.cpp | 39 ++++++++++++-
pid/thermalcontroller.hpp | 14 ++---
- test/Makefile.am | 3 +-
test/meson.build | 3 +-
test/pid_json_unittest.cpp | 73 +++++++++++++++++++++++--
test/pid_thermalcontroller_unittest.cpp | 47 ++++++++++++----
util.cpp | 54 +++++++++++++++++-
util.hpp | 14 +++++
- 14 files changed, 309 insertions(+), 53 deletions(-)
+ 13 files changed, 307 insertions(+), 52 deletions(-)
diff --git a/conf.hpp b/conf.hpp
index d7d34f5..486e2e5 100644
@@ -94,10 +93,10 @@
+
} // namespace pid_control
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
-index 66ef7f8..f02b79f 100644
+index 96d2b4b..c20f1e0 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
-@@ -312,7 +312,13 @@ void populatePidInfo(
+@@ -326,7 +326,13 @@ void populatePidInfo(
{
interface = thresholds::criticalInterface;
}
@@ -112,7 +111,7 @@
DbusHelper helper(sdbusplus::bus::new_system());
std::string service = helper.getService(interface, path);
-@@ -816,20 +822,33 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
+@@ -830,20 +836,33 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
}
}
@@ -149,7 +148,7 @@
info.inputs.emplace_back(input);
populatePidInfo(bus, base, info, &offsetType,
sensorConfig);
-@@ -900,7 +919,17 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
+@@ -914,7 +933,17 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
}
conf::ControllerInfo& info =
conf[std::get<std::string>(base.at("Name"))];
@@ -462,20 +461,6 @@
ThermalType type;
};
-diff --git a/test/Makefile.am b/test/Makefile.am
-index d7d4d9d..e749f8c 100644
---- a/test/Makefile.am
-+++ b/test/Makefile.am
-@@ -79,7 +79,8 @@ sensors_json_unittest_SOURCES = sensors_json_unittest.cpp
- sensors_json_unittest_LDADD = $(top_builddir)/sensors/buildjson.o
-
- pid_json_unittest_SOURCES = pid_json_unittest.cpp
--pid_json_unittest_LDADD = $(top_builddir)/pid/buildjson.o
-+pid_json_unittest_LDADD = $(top_builddir)/pid/buildjson.o \
-+ $(top_builddir)/util.o
-
- json_parse_unittest_SOURCES = json_parse_unittest.cpp
- json_parse_unittest_LDADD = $(top_builddir)/buildjson/buildjson.o
diff --git a/test/meson.build b/test/meson.build
index 966334e..2513278 100644
--- a/test/meson.build
@@ -811,5 +796,5 @@
* Dump active configuration.
*/
--
-2.39.0.246.g2a6d74b583-goog
+2.40.0.348.gf938b09366-goog
diff --git a/recipes-phosphor/fans/phosphor-pid-control/0001-Skipping-over-Association-Definitions-messages.patch b/recipes-phosphor/fans/phosphor-pid-control/0001-Skipping-over-Association-Definitions-messages.patch
deleted file mode 100644
index d62f7a8..0000000
--- a/recipes-phosphor/fans/phosphor-pid-control/0001-Skipping-over-Association-Definitions-messages.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 10e46efabf262d99cd457e97bd8c9ad6f90f834a Mon Sep 17 00:00:00 2001
-From: Josh Lehan <krellan@google.com>
-Date: Wed, 1 Feb 2023 18:25:58 -0800
-Subject: [PATCH] Skipping over Association Definitions messages
-
-Patch Tracking Bug: b/267556082
-Upstream info / review: https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/60580
-Upstream-Status: Submitted
-Justification: Awaiting upstream review and merging
-
-These incoming messages cause problems, for the same reason Assocation
-is skipped over. They are not relevant to PID control, because they
-are maintained by Object Mapper for another purpose. Treating
-Association Definitions similarly to Associations, namely, skipping
-them over. It looks like this was simply omitted in the past, perhaps
-Definitions did not exist then, only Associations.
-Also adding some optional logging.
-
-Thanks to Chu Lin for originally discovering this bug and creating
-this fix.
-
-Tested: It works, and avoids the problem of unwanted messages causing
-swampd to needlessly restart itself internally.
-
-Change-Id: I2f9cb123990d240b515d08138dd919312aac5a30
-Signed-off-by: Josh Lehan <krellan@google.com>
----
- dbus/dbusconfiguration.cpp | 18 ++++++++++++++++--
- 1 file changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
-index 66ef7f8..96d2b4b 100644
---- a/dbus/dbusconfiguration.cpp
-+++ b/dbus/dbusconfiguration.cpp
-@@ -158,8 +158,9 @@ int eventHandler(sd_bus_message* m, void* context, sd_bus_error*)
- }
-
- // we skip associations because the mapper populates these, not the sensors
-- const std::array<const char*, 1> skipList = {
-- "xyz.openbmc_project.Association"};
-+ const std::array<const char*, 2> skipList = {
-+ "xyz.openbmc_project.Association",
-+ "xyz.openbmc_project.Association.Definitions"};
-
- sdbusplus::message_t message(m);
- if (std::string(message.get_member()) == "InterfacesAdded")
-@@ -184,6 +185,19 @@ int eventHandler(sd_bus_message* m, void* context, sd_bus_error*)
- }
- }
- }
-+
-+ if constexpr (pid_control::conf::DEBUG)
-+ {
-+ std::cout << "New config detected: " << path.str << std::endl;
-+ for (auto& d : data)
-+ {
-+ std::cout << "\tdata is " << d.first << std::endl;
-+ for (auto& second : d.second)
-+ {
-+ std::cout << "\t\tdata is " << second.first << std::endl;
-+ }
-+ }
-+ }
- }
-
- boost::asio::steady_timer* timer =
---
-2.39.1.519.gcb327c4b5f-goog
-
diff --git a/recipes-phosphor/fans/phosphor-pid-control/0001-pid-reuse-the-code-for-processing-sensors-input.patch b/recipes-phosphor/fans/phosphor-pid-control/0001-pid-reuse-the-code-for-processing-sensors-input.patch
deleted file mode 100644
index c01ba60..0000000
--- a/recipes-phosphor/fans/phosphor-pid-control/0001-pid-reuse-the-code-for-processing-sensors-input.patch
+++ /dev/null
@@ -1,266 +0,0 @@
-From df1f183fb4c850c71abb6ea940a9ed2e9c7b9d23 Mon Sep 17 00:00:00 2001
-From: Tom Tung <shes050117@gmail.com>
-Date: Mon, 14 Nov 2022 19:26:52 +0800
-Subject: [PATCH] pid: reuse the code for processing sensors input
-
-The code for processing sensors' inputs are the same in updateFanTelemetry() and
-updateSensors(). This patch extract the similar code out as a private
-function and make it be called in these two functions.
-
-Tested:
-- Can still build phosphor-pid-control.
-- Copy built image to the system and it works fine.
-
-Change-Id: I6249053e788bfa14bb7bdf2a880be5403c20029b
-Signed-off-by: Tom Tung <shes050117@gmail.com>
-
-Patch Tracking Bug: b/269669082
-Upstream info / review:
-https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/58664
-Upstream-Status: Accepted.
-Justification: cherry-pick the patch before the next rebase gets pulled
-in.
-
----
- pid/zone.cpp | 119 ++-------------------------------------------------
- pid/zone.hpp | 73 +++++++++++++++++++++++++++++++
- 2 files changed, 77 insertions(+), 115 deletions(-)
-
-diff --git a/pid/zone.cpp b/pid/zone.cpp
-index e9aaafc..c88f41b 100644
---- a/pid/zone.cpp
-+++ b/pid/zone.cpp
-@@ -348,7 +348,7 @@ void DbusPidZone::updateFanTelemetry(void)
- * is disabled? I think it's a waste to try and log things even if the
- * data is just being dropped though.
- */
-- tstamp now = std::chrono::high_resolution_clock::now();
-+ const auto now = std::chrono::high_resolution_clock::now();
- if (loggingEnabled)
- {
- _log << std::chrono::duration_cast<std::chrono::milliseconds>(
-@@ -358,67 +358,7 @@ void DbusPidZone::updateFanTelemetry(void)
- _log << "," << _maximumSetPointName;
- }
-
-- for (const auto& f : _fanInputs)
-- {
-- auto sensor = _mgr.getSensor(f);
-- ReadReturn r = sensor->read();
-- _cachedValuesByName[f] = {r.value, r.unscaled};
-- int64_t timeout = sensor->getTimeout();
-- tstamp then = r.updated;
--
-- auto duration =
-- std::chrono::duration_cast<std::chrono::seconds>(now - then)
-- .count();
-- auto period = std::chrono::seconds(timeout).count();
-- /*
-- * TODO(venture): We should check when these were last read.
-- * However, these are the fans, so if I'm not getting updated values
-- * for them... what should I do?
-- */
-- if (loggingEnabled)
-- {
-- const auto& v = _cachedValuesByName[f];
-- _log << "," << v.scaled << "," << v.unscaled;
-- const auto& p = _cachedFanOutputs[f];
-- _log << "," << p.scaled << "," << p.unscaled;
-- }
--
-- if (debugEnabled)
-- {
-- std::cerr << f << " fan sensor reading: " << r.value << "\n";
-- }
--
-- // check if fan fail.
-- if (sensor->getFailed())
-- {
-- _failSafeSensors.insert(f);
-- if (debugEnabled)
-- {
-- std::cerr << f << " fan sensor get failed\n";
-- }
-- }
-- else if (timeout != 0 && duration >= period)
-- {
-- _failSafeSensors.insert(f);
-- if (debugEnabled)
-- {
-- std::cerr << f << " fan sensor timeout\n";
-- }
-- }
-- else
-- {
-- // Check if it's in there: remove it.
-- auto kt = _failSafeSensors.find(f);
-- if (kt != _failSafeSensors.end())
-- {
-- if (debugEnabled)
-- {
-- std::cerr << f << " is erased from failsafe sensor set\n";
-- }
-- _failSafeSensors.erase(kt);
-- }
-- }
-- }
-+ processSensorInputs</* fanSensorLogging */ true>(_fanInputs, now);
-
- if (loggingEnabled)
- {
-@@ -434,59 +374,8 @@ void DbusPidZone::updateFanTelemetry(void)
-
- void DbusPidZone::updateSensors(void)
- {
-- using namespace std::chrono;
-- /* margin and temp are stored as temp */
-- tstamp now = high_resolution_clock::now();
--
-- for (const auto& t : _thermalInputs)
-- {
-- auto sensor = _mgr.getSensor(t);
-- ReadReturn r = sensor->read();
-- int64_t timeout = sensor->getTimeout();
--
-- _cachedValuesByName[t] = {r.value, r.unscaled};
-- tstamp then = r.updated;
--
-- auto duration = duration_cast<std::chrono::seconds>(now - then).count();
-- auto period = std::chrono::seconds(timeout).count();
--
-- if (debugEnabled)
-- {
-- std::cerr << t << " temperature sensor reading: " << r.value
-- << "\n";
-- }
--
-- if (sensor->getFailed())
-- {
-- _failSafeSensors.insert(t);
-- if (debugEnabled)
-- {
-- std::cerr << t << " temperature sensor get failed\n";
-- }
-- }
-- else if (timeout != 0 && duration >= period)
-- {
-- // std::cerr << "Entering fail safe mode.\n";
-- _failSafeSensors.insert(t);
-- if (debugEnabled)
-- {
-- std::cerr << t << " temperature sensor get timeout\n";
-- }
-- }
-- else
-- {
-- // Check if it's in there: remove it.
-- auto kt = _failSafeSensors.find(t);
-- if (kt != _failSafeSensors.end())
-- {
-- if (debugEnabled)
-- {
-- std::cerr << t << " is erased from failsafe sensor set\n";
-- }
-- _failSafeSensors.erase(kt);
-- }
-- }
-- }
-+ processSensorInputs</* fanSensorLogging */ false>(
-+ _thermalInputs, std::chrono::high_resolution_clock::now());
-
- return;
- }
-diff --git a/pid/zone.hpp b/pid/zone.hpp
-index 0504a6d..b985f5f 100644
---- a/pid/zone.hpp
-+++ b/pid/zone.hpp
-@@ -13,6 +13,7 @@
- #include <xyz/openbmc_project/Control/Mode/server.hpp>
-
- #include <fstream>
-+#include <iostream>
- #include <map>
- #include <memory>
- #include <set>
-@@ -99,6 +100,78 @@ class DbusPidZone : public ZoneInterface, public ModeObject
- bool failSafe() const override;
-
- private:
-+ template <bool fanSensorLogging>
-+ void processSensorInputs(const std::vector<std::string>& sensorInputs,
-+ std::chrono::high_resolution_clock::time_point now)
-+ {
-+ for (const auto& sensorInput : sensorInputs)
-+ {
-+ auto sensor = _mgr.getSensor(sensorInput);
-+ ReadReturn r = sensor->read();
-+ _cachedValuesByName[sensorInput] = {r.value, r.unscaled};
-+ int64_t timeout = sensor->getTimeout();
-+ std::chrono::high_resolution_clock::time_point then = r.updated;
-+
-+ auto duration =
-+ std::chrono::duration_cast<std::chrono::seconds>(now - then)
-+ .count();
-+ auto period = std::chrono::seconds(timeout).count();
-+ /*
-+ * TODO(venture): We should check when these were last read.
-+ * However, these are the fans, so if I'm not getting updated values
-+ * for them... what should I do?
-+ */
-+ if constexpr (fanSensorLogging)
-+ {
-+ if (loggingEnabled)
-+ {
-+ const auto& v = _cachedValuesByName[sensorInput];
-+ _log << "," << v.scaled << "," << v.unscaled;
-+ const auto& p = _cachedFanOutputs[sensorInput];
-+ _log << "," << p.scaled << "," << p.unscaled;
-+ }
-+ }
-+
-+ if (debugEnabled)
-+ {
-+ std::cerr << sensorInput << " sensor reading: " << r.value
-+ << "\n";
-+ }
-+
-+ // check if fan fail.
-+ if (sensor->getFailed())
-+ {
-+ _failSafeSensors.insert(sensorInput);
-+ if (debugEnabled)
-+ {
-+ std::cerr << sensorInput << " sensor get failed\n";
-+ }
-+ }
-+ else if (timeout != 0 && duration >= period)
-+ {
-+ _failSafeSensors.insert(sensorInput);
-+ if (debugEnabled)
-+ {
-+ std::cerr << sensorInput << " sensor timeout\n";
-+ }
-+ }
-+ else
-+ {
-+ // Check if it's in there: remove it.
-+ auto kt = _failSafeSensors.find(sensorInput);
-+ if (kt != _failSafeSensors.end())
-+ {
-+ if (debugEnabled)
-+ {
-+ std::cerr << sensorInput
-+ << " is erased from failsafe sensor set\n";
-+ }
-+ _failSafeSensors.erase(kt);
-+ }
-+ }
-+ }
-+ }
-+
- std::ofstream _log;
-
- const int64_t _zoneId;
---
-2.39.1.581.gbfd45094c4-goog
-
diff --git a/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
index 6ed8f0f..6019858 100644
--- a/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
+++ b/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -2,7 +2,5 @@
SRC_URI:append:gbmc = " \
file://0001-Implementing-the-TempToMargin-feature.patch \
- file://0001-Skipping-over-Association-Definitions-messages.patch \
- file://0001-pid-reuse-the-code-for-processing-sensors-input.patch \
file://0002-Add-MissingIsAcceptable-feature-to-avoid-failsafe.patch \
"