On checkstop request dump and transition host
After checkstop analyses completes attention handler will request a dump
and the transition the host. The type of dump requested is dependent on
the results of the isolator.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I1116be8f8d045a4916d3321f461c22345fecf274
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index 68babfe..c8de857 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -4,6 +4,7 @@
#include <analyzer/ras-data/ras-data-parser.hpp>
#include <analyzer/service_data.hpp>
+#include <attn/attn_dump.hpp>
#include <hei_main.hpp>
#include <phosphor-logging/log.hpp>
#include <util/pdbg.hpp>
@@ -32,9 +33,10 @@
* @brief Will create and submit a PEL using the given data.
* @param i_isoData The data gathered during isolation (for FFDC).
* @param i_servData Data regarding service actions gathered during analysis.
+ * @return Tuple of BMC log id, platform log id
*/
-void createPel(const libhei::IsolationData& i_isoData,
- const ServiceData& i_servData);
+std::tuple<uint32_t, uint32_t> createPel(const libhei::IsolationData& i_isoData,
+ const ServiceData& i_servData);
//------------------------------------------------------------------------------
@@ -120,7 +122,7 @@
//------------------------------------------------------------------------------
-bool analyzeHardware()
+bool analyzeHardware(attn::DumpParameters& o_dumpParameters)
{
bool attnFound = false;
@@ -166,7 +168,12 @@
rasData.getResolution(rootCause)->resolve(servData);
// Create and commit a PEL.
- createPel(isoData, servData);
+ uint32_t logId = std::get<1>(createPel(isoData, servData));
+
+ // Populate dump parameters
+ o_dumpParameters.logId = logId;
+ o_dumpParameters.unitId = 0;
+ o_dumpParameters.dumpType = attn::DumpType::Hardware;
}
// All done, clean up the isolator.
diff --git a/analyzer/analyzer_main.hpp b/analyzer/analyzer_main.hpp
index e0c9f47..5619ba3 100644
--- a/analyzer/analyzer_main.hpp
+++ b/analyzer/analyzer_main.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <attn/attn_dump.hpp>
+
namespace analyzer
{
@@ -8,6 +10,7 @@
* chip. Then it performs all approriate RAS actions based on the active
* attentions.
*
+ * @param[out] o_dumpParameters Dump request parameters
* @return True if an active attenion was successfully analyzed, false
* otherwise.
* For system checkstop handling:
@@ -19,7 +22,7 @@
* analysis could fail to find an attention and it should not be
* treated as a defect.
*/
-bool analyzeHardware();
+bool analyzeHardware(attn::DumpParameters& o_dumpParameters);
/**
* @brief Get error analyzer build information
diff --git a/analyzer/create_pel.cpp b/analyzer/create_pel.cpp
index e9835c5..38a7d5f 100644
--- a/analyzer/create_pel.cpp
+++ b/analyzer/create_pel.cpp
@@ -6,6 +6,7 @@
#include <phosphor-logging/elog.hpp>
#include <sdbusplus/bus.hpp>
#include <util/bin_stream.hpp>
+#include <util/dbus.hpp>
#include <util/ffdc_file.hpp>
#include <util/pdbg.hpp>
#include <util/trace.hpp>
@@ -263,8 +264,8 @@
//------------------------------------------------------------------------------
-void createPel(const libhei::IsolationData& i_isoData,
- const ServiceData& i_servData)
+std::tuple<uint32_t, uint32_t> createPel(const libhei::IsolationData& i_isoData,
+ const ServiceData& i_servData)
{
// The message registry will require additional log data to fill in keywords
// and additional log data.
@@ -300,28 +301,58 @@
std::vector<util::FFDCTuple> userData;
util::transformFFDC(userDataFiles, userData);
- // Get access to logging interface and method for creating log.
- auto bus = sdbusplus::bus::new_default_system();
+ // Response will be a tuple containing bmc-log-id, pel-log-id
+ std::tuple<uint32_t, uint32_t> response = {0, 0};
- // Using direct create method (for additional data).
- auto method = bus.new_method_call(
- "xyz.openbmc_project.Logging", "/xyz/openbmc_project/logging",
- "xyz.openbmc_project.Logging.Create", "CreateWithFFDCFiles");
+ try
+ {
+ // We want to use the logging interface that returns the event log
+ // id's of the newly created logs (org.open_power.Logging.PEL) so
+ // find the service that implements this interface.
+ constexpr auto interface = "org.open_power.Logging.PEL";
+ constexpr auto path = "/xyz/openbmc_project/logging";
+ std::string service;
- // The "Create" method requires manually adding the process ID.
- logData["_PID"] = std::to_string(getpid());
+ if (0 == util::dbus::findService(interface, path, service))
+ {
+ // Use function that returns log id's
+ constexpr auto function = "CreatePELWithFFDCFiles";
- // Get the message registry entry for this failure.
- auto message = __getMessageRegistry(isCheckstop);
+ // Get access to logging interface and method for creating log.
+ auto bus = sdbusplus::bus::new_default_system();
- // Get the message severity for this failure.
- auto severity = __getMessageSeverity(isCheckstop);
+ // Using direct create method (for additional data).
+ auto method =
+ bus.new_method_call(service.c_str(), path, interface, function);
- // Add the message, with additional log and user data.
- method.append(message, severity, logData, userData);
+ // The "Create" method requires manually adding the process ID.
+ logData["_PID"] = std::to_string(getpid());
- // Log the event.
- bus.call_noreply(method);
+ // Get the message registry entry for this failure.
+ auto message = __getMessageRegistry(isCheckstop);
+
+ // Get the message severity for this failure.
+ auto severity = __getMessageSeverity(isCheckstop);
+
+ // Add the message, with additional log and user data.
+ method.append(message, severity, logData, userData);
+
+ // Log the event.
+ auto reply = bus.call(method);
+
+ // Parse reply for response
+ reply.read(response);
+ }
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
+ {
+ trace::err("Exception while creating event log entry");
+ std::string exceptionString = std::string(e.what());
+ trace::err(exceptionString.c_str());
+ }
+
+ // return tuple of {bmc-log-id, pel-log-id} or {0, 0} on error
+ return response;
}
} // namespace analyzer