summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-03-15 11:48:41 -0700
committerWilliam A. Kennington III <wak@google.com>2018-04-02 23:35:10 +0000
commit25bc7ac647ce216b1d6a4f4dcb55beadb064ced6 (patch)
tree04c9582744494741e9a9035fdee3eff49d9ff857
parent7f2d7c90a27aacb45fa5ccc18c777593e007d2a7 (diff)
downloadphosphor-host-ipmid-25bc7ac647ce216b1d6a4f4dcb55beadb064ced6.tar.gz
phosphor-host-ipmid-25bc7ac647ce216b1d6a4f4dcb55beadb064ced6.zip
watchdog: Cache service name
We have occasionally noticed that the watchdog will be enabled and then immediately trip upon booting of the BMC. This happens if the host is still running when the BMC is coming up. Digging into the issue we notice that the phosphor-mapper can be under very heavy load responding to all of the initial mapping requests from BMC daemons starting. This causes a delay in the phosphor-watchdog service name lookup during an attempt to reset the watchdog countdown. The lookup delay is so long that the watchdog ends up tripping before the reset is actually issued, causing the BMC to reset the host. Since we know that the watchdog will not be armed until the service resolves for the first time, we can reduce the dependence and pressure on the service mapper by caching the service name. Since it is the case that we want to keep issuing resets to the same daemon that was initially configured, we should have no worries about invalidating the cached service name. The name will be invalidated any time we encounter a dbus level error issuing a watchdog commmand. Change-Id: I303a39be997c2e57050b71efc8ef2e2cb27f8cf7 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--app/watchdog_service.cpp14
-rw-r--r--app/watchdog_service.hpp4
2 files changed, 10 insertions, 8 deletions
diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp
index f11c4bf..d3fa3ad 100644
--- a/app/watchdog_service.cpp
+++ b/app/watchdog_service.cpp
@@ -6,7 +6,6 @@
#include <xyz/openbmc_project/State/Watchdog/server.hpp>
#include "host-ipmid/ipmid-api.h"
-#include "utils.hpp"
using sdbusplus::message::variant_ns::get;
using sdbusplus::message::variant_ns::variant;
@@ -17,20 +16,21 @@ static constexpr char wd_path[] = "/xyz/openbmc_project/watchdog/host0";
static constexpr char wd_intf[] = "xyz.openbmc_project.State.Watchdog";
static constexpr char prop_intf[] = "org.freedesktop.DBus.Properties";
+ipmi::ServiceCache WatchdogService::wd_service(wd_intf, wd_path);
+
WatchdogService::WatchdogService()
- : bus(ipmid_get_sd_bus_connection()),
- wd_service(ipmi::getService(bus, wd_intf, wd_path))
+ : bus(ipmid_get_sd_bus_connection())
{
}
WatchdogService::Properties WatchdogService::getProperties()
{
- auto request = bus.new_method_call(wd_service.c_str(), wd_path,
- prop_intf, "GetAll");
+ auto request = wd_service.newMethodCall(bus, prop_intf, "GetAll");
request.append(wd_intf);
auto response = bus.call(request);
if (response.is_method_error())
{
+ wd_service.invalidate();
throw std::runtime_error("Failed to get watchdog properties");
}
@@ -49,12 +49,12 @@ WatchdogService::Properties WatchdogService::getProperties()
template <typename T>
void WatchdogService::setProperty(const std::string& key, const T& val)
{
- auto request = bus.new_method_call(wd_service.c_str(), wd_path,
- prop_intf, "Set");
+ auto request = wd_service.newMethodCall(bus, prop_intf, "Set");
request.append(wd_intf, key, variant<T>(val));
auto response = bus.call(request);
if (response.is_method_error())
{
+ wd_service.invalidate();
throw std::runtime_error(std::string("Failed to set property: ") + key);
}
}
diff --git a/app/watchdog_service.hpp b/app/watchdog_service.hpp
index 432c7ce..e93b7f3 100644
--- a/app/watchdog_service.hpp
+++ b/app/watchdog_service.hpp
@@ -2,6 +2,8 @@
#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/State/Watchdog/server.hpp>
+#include "utils.hpp"
+
/** @class WatchdogService
* @brief Access to the running OpenBMC watchdog implementation.
* @details Easy accessor for servers that implement the
@@ -67,7 +69,7 @@ class WatchdogService {
/** @brief sdbusplus handle */
sdbusplus::bus::bus bus;
/** @brief The name of the mapped host watchdog service */
- const std::string wd_service;
+ static ipmi::ServiceCache wd_service;
/** @brief Sets the value of the property on the host watchdog
*
OpenPOWER on IntegriCloud