diff options
author | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-01-12 03:15:48 +0300 |
---|---|---|
committer | Puli, Apparao <apparao.puli@intel.com> | 2020-01-14 23:01:24 +0300 |
commit | eb211bb378a0f49d949f0db890f91f6966380d31 (patch) | |
tree | e238ecad0851cdcf5c2f73ab8c945ae231f7d979 | |
parent | b6cdb90744eba8680dc0ac6ba6de31ec84cb500a (diff) | |
download | provingground-eb211bb378a0f49d949f0db890f91f6966380d31.tar.xz |
Fix: PFR D-Bus introspect timeout error
Request bus name on connection will do a phosphor-mapper
introspect. If there is delay between io->run and request_name
causes the phosphor-mapper introspect failure. Due to this timing
issue, some times PFR version interfaces are not advertised over
D-Bus resulting in unavailability of version objects.
Moved request_name close to the io->run. Also isolated all signal
matchers from main.
Tested:
No timeout messages observed. Also Refish inventory items
populates all versions properly.
Change-Id: I18003e3ad0f6fa8821a4ec35a80cad017b3208c9
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
-rw-r--r-- | intel-pfr-manager/service/src/mainapp.cpp | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/intel-pfr-manager/service/src/mainapp.cpp b/intel-pfr-manager/service/src/mainapp.cpp index c71e78e..ae80912 100644 --- a/intel-pfr-manager/service/src/mainapp.cpp +++ b/intel-pfr-manager/service/src/mainapp.cpp @@ -329,31 +329,9 @@ void checkAndSetCheckpoint(sdbusplus::asio::object_server& server, "org.freedesktop.systemd1.Manager", "FinishTimestamp"); } -int main() +void monitorSignals(sdbusplus::asio::object_server& server, + std::shared_ptr<sdbusplus::asio::connection>& conn) { - // setup connection to dbus - boost::asio::io_service io; - auto conn = std::make_shared<sdbusplus::asio::connection>(io); - stateTimer = std::make_unique<boost::asio::steady_timer>(io); - initTimer = std::make_unique<boost::asio::steady_timer>(io); - conn->request_name("xyz.openbmc_project.PFR.Manager"); - auto server = sdbusplus::asio::object_server(conn, true); - auto rootInterface = server.add_interface("/xyz/openbmc_project/pfr", ""); - rootInterface->initialize(); - server.add_manager("/xyz/openbmc_project/pfr"); - - // Create PFR attributes object and interface - pfrConfigObject = std::make_unique<intel::pfr::PfrConfig>(server, conn); - - pfrVersionObjects.clear(); - // Create Software objects using Versions interface - for (const auto& entry : verComponentList) - { - pfrVersionObjects.emplace_back(std::make_unique<intel::pfr::PfrVersion>( - server, conn, std::get<0>(entry), std::get<1>(entry), - std::get<2>(entry))); - } - // Monitor Boot finished signal and set the checkpoint 9 to // notify CPLD about BMC boot finish. auto bootFinishedSignal = std::make_unique<sdbusplus::bus::match::match>( @@ -501,10 +479,36 @@ int main() // First time, check and log events if any. checkAndLogEvents(); +} + +int main() +{ + // setup connection to dbus + boost::asio::io_service io; + auto conn = std::make_shared<sdbusplus::asio::connection>(io); + stateTimer = std::make_unique<boost::asio::steady_timer>(io); + initTimer = std::make_unique<boost::asio::steady_timer>(io); + auto server = sdbusplus::asio::object_server(conn, true); + monitorSignals(server, conn); + + auto rootInterface = server.add_interface("/xyz/openbmc_project/pfr", ""); + rootInterface->initialize(); + server.add_manager("/xyz/openbmc_project/pfr"); + // Create PFR attributes object and interface + pfrConfigObject = std::make_unique<intel::pfr::PfrConfig>(server, conn); + + // Create Software objects using Versions interface + for (const auto& entry : verComponentList) + { + pfrVersionObjects.emplace_back(std::make_unique<intel::pfr::PfrVersion>( + server, conn, std::get<0>(entry), std::get<1>(entry), + std::get<2>(entry))); + } + + conn->request_name("xyz.openbmc_project.PFR.Manager"); phosphor::logging::log<phosphor::logging::level::INFO>( "Intel PFR service started successfully"); - io.run(); return 0; |