Add error info to dump on collection failures
There is a possibility that dump collection may fail due to hardware
procedure execution errors or other issues. Modified info.yaml to
store error information along with driver details in case of dump
collection failures.
Change-Id: I74c2fb8ebc31d1c3bd60feffa3f0467faa435d5c
Signed-off-by: Swetha Parasa <parasa.swetha1@ibm.com>
diff --git a/dump/create_pel.cpp b/dump/create_pel.cpp
index 90a7ea7..981fe63 100644
--- a/dump/create_pel.cpp
+++ b/dump/create_pel.cpp
@@ -31,6 +31,8 @@
constexpr auto loggingObjectPath = "/xyz/openbmc_project/logging";
constexpr auto loggingInterface = "xyz.openbmc_project.Logging.Create";
constexpr auto opLoggingInterface = "org.open_power.Logging.PEL";
+constexpr auto entryInterface = "xyz.openbmc_project.Logging.Entry";
+constexpr auto opEntryInterface = "org.open_power.Logging.PEL.Entry";
uint32_t createSbeErrorPEL(const std::string& event, const sbeError_t& sbeError,
const FFDCData& ffdcData, const Severity severity,
@@ -86,7 +88,7 @@
// parse dbus response into reply
response.read(reply);
- plid = std::get<1>(reply); // platform log id is tuple "second"
+ plid = std::get<0>(reply); // dbus entry id is tuple "first"
}
catch (const sdbusplus::exception_t& e)
{
@@ -121,11 +123,12 @@
}
}
-void processFFDCPackets(const openpower::phal::sbeError_t& sbeError,
- const std::string& event,
- openpower::dump::pel::FFDCData& pelAdditionalData)
+std::vector<uint32_t> processFFDCPackets(
+ const openpower::phal::sbeError_t& sbeError, const std::string& event,
+ openpower::dump::pel::FFDCData& pelAdditionalData)
{
const auto& ffdcFileList = sbeError.getFfdcFileList();
+ std::vector<uint32_t> logIdList;
for (const auto& [slid, ffdcTuple] : ffdcFileList)
{
uint8_t severity;
@@ -154,7 +157,54 @@
event, sbeError, pelAdditionalData, logSeverity);
lg2::info("Logged PEL {PELID} for SLID {SLID}", "PELID", logId, "SLID",
slid);
+ logIdList.push_back(logId);
}
+ return logIdList;
+}
+
+std::tuple<uint32_t, std::string> getLogInfo(uint32_t logId)
+{
+ uint32_t pelId;
+ std::string src;
+ try
+ {
+ auto bus = sdbusplus::bus::new_default();
+ const auto loggingEntryObjectPath =
+ std::string(loggingObjectPath) + "/entry/" + std::to_string(logId);
+ auto service =
+ util::getService(bus, entryInterface, loggingEntryObjectPath);
+ auto method =
+ bus.new_method_call(service.c_str(), loggingEntryObjectPath.c_str(),
+ "org.freedesktop.DBus.Properties", "Get");
+ method.append(opEntryInterface);
+ method.append("PlatformLogID");
+ auto response = bus.call(method);
+ std::variant<uint32_t, std::string> v;
+ response.read(v);
+ pelId = std::get<uint32_t>(v);
+ method =
+ bus.new_method_call(service.c_str(), loggingEntryObjectPath.c_str(),
+ "org.freedesktop.DBus.Properties", "Get");
+ method.append(entryInterface);
+ method.append("EventId");
+ response = bus.call(method);
+ response.read(v);
+ std::istringstream iss(std::get<std::string>(v));
+ iss >> src;
+ }
+ catch (const sdbusplus::exception::exception& e)
+ {
+ lg2::error("D-Bus call exception "
+ "EXCEPTION={ERROR}",
+ "ERROR", e);
+ throw;
+ }
+ catch (const std::exception& e)
+ {
+ throw;
+ }
+
+ return std::tuple<uint32_t, std::string>(pelId, src);
}
FFDCFile::FFDCFile(const json& pHALCalloutData) :
diff --git a/dump/create_pel.hpp b/dump/create_pel.hpp
index 3d3b304..82ee418 100644
--- a/dump/create_pel.hpp
+++ b/dump/create_pel.hpp
@@ -56,10 +56,20 @@
* @param[in] event - The event identifier associated with the PELs.
* @param[out] pelAdditionalData - A reference to additional PEL data to be
* included in the PEL.
+ * @return logIdList - List of Errors created
*/
-void processFFDCPackets(const openpower::phal::sbeError_t& sbeError,
- const std::string& event,
- openpower::dump::pel::FFDCData& pelAdditionalData);
+std::vector<uint32_t> processFFDCPackets(
+ const openpower::phal::sbeError_t& sbeError, const std::string& event,
+ openpower::dump::pel::FFDCData& pelAdditionalData);
+
+/**
+ * @brief Get PEL Id and Reason Code for a given logEntry
+ *
+ * @param[in] logId - dbus entry id.
+ *
+ * @return Platform Event Log Id, Reason Code
+ */
+std::tuple<uint32_t, std::string> getLogInfo(uint32_t logId);
/**
* @class FFDCFile
diff --git a/dump/sbe_dump_collector.cpp b/dump/sbe_dump_collector.cpp
index b0b3c75..8beda76 100644
--- a/dump/sbe_dump_collector.cpp
+++ b/dump/sbe_dump_collector.cpp
@@ -59,7 +59,7 @@
// if the dump type is hostboot then call stop instructions
if (type == SBE_DUMP_TYPE_HOSTBOOT)
{
- includeTarget = executeThreadStop(target);
+ includeTarget = executeThreadStop(target, path);
}
if (includeTarget)
{
@@ -188,7 +188,8 @@
bool SbeDumpCollector::logErrorAndCreatePEL(
const openpower::phal::sbeError_t& sbeError, uint64_t chipPos,
- SBETypes sbeType, uint32_t cmdClass, uint32_t cmdType)
+ SBETypes sbeType, uint32_t cmdClass, uint32_t cmdType,
+ const std::filesystem::path& path)
{
namespace fs = std::filesystem;
@@ -247,8 +248,23 @@
"POSITION", chipPos);
}
// Processor FFDC Packets
- openpower::dump::pel::processFFDCPackets(sbeError, event,
- pelAdditionalData);
+ std::vector<uint32_t> logIdList =
+ openpower::dump::pel::processFFDCPackets(sbeError, event,
+ pelAdditionalData);
+ for (auto logId : logIdList)
+ {
+ try
+ {
+ auto logInfo = openpower::dump::pel::getLogInfo(logId);
+ addLogDataToDump(std::get<0>(logInfo), std::get<1>(logInfo),
+ chipName, chipPos, path.parent_path());
+ }
+ catch (const std::exception& e)
+ {
+ lg2::error("Failed to get error Info: {ERROR} ", "ERROR",
+ e);
+ }
+ }
}
// If dump is required, request it
@@ -256,7 +272,19 @@
{
auto logId = openpower::dump::pel::createSbeErrorPEL(
event, sbeError, pelAdditionalData);
- util::requestSBEDump(chipPos, logId, sbeType);
+ try
+ {
+ auto logInfo = openpower::dump::pel::getLogInfo(logId);
+ addLogDataToDump(std::get<0>(logInfo), std::get<1>(logInfo),
+ chipName, chipPos, path.parent_path());
+ util::requestSBEDump(chipPos, std::get<0>(logInfo), sbeType);
+ }
+ catch (const std::exception& e)
+ {
+ lg2::error(
+ "Failed to get error Info, failed to create sbe dump: {ERROR}",
+ "ERROR", e);
+ }
}
}
catch (const std::out_of_range& e)
@@ -316,7 +344,8 @@
// then create PELs with FFDC but write the dump contents to the
// file.
if (logErrorAndCreatePEL(sbeError, chipPos, sbeType,
- SBEFIFO_CMD_CLASS_DUMP, SBEFIFO_CMD_GET_DUMP))
+ SBEFIFO_CMD_CLASS_DUMP, SBEFIFO_CMD_GET_DUMP,
+ path))
{
lg2::error("Error in collecting dump dump type({TYPE}), "
"clockstate({CLOCKSTATE}), chip type({CHIPTYPE}) "
@@ -394,7 +423,8 @@
}
}
-bool SbeDumpCollector::executeThreadStop(struct pdbg_target* target)
+bool SbeDumpCollector::executeThreadStop(struct pdbg_target* target,
+ const std::filesystem::path& path)
{
try
{
@@ -419,7 +449,7 @@
logErrorAndCreatePEL(sbeError, chipPos, SBETypes::PROC,
SBEFIFO_CMD_CLASS_INSTRUCTION,
- SBEFIFO_CMD_CONTROL_INSN);
+ SBEFIFO_CMD_CONTROL_INSN, path);
// For TIMEOUT, log the error and skip adding the processor for dump
// collection
if (sbeError.errType() == openpower::phal::exception::SBE_CMD_TIMEOUT)
@@ -432,4 +462,29 @@
return true;
}
+void SbeDumpCollector::addLogDataToDump(uint32_t pelId, std::string src,
+ std::string chipName, uint64_t chipPos,
+ const std::filesystem::path& path)
+{
+ std::filesystem::path info = path / "errorInfo";
+ auto fileExists = std::filesystem::exists(info);
+ std::ofstream fout;
+ fout.open(info, std::ios::app);
+ if (!fout)
+ {
+ lg2::error("Error: Failed to open the file! {FILE}", "FILE", info);
+ lg2::error("No error Info is added to dump file");
+ return;
+ }
+ if (!fileExists)
+ {
+ fout << "ErrorInfo:" << std::endl;
+ }
+ auto pel = " " + std::format("{:08x}", pelId) + ":";
+ fout << pel << std::endl;
+ fout << " src: " << src << std::endl;
+ auto resource = chipName + " " + std::to_string(chipPos);
+ fout << " Resource: " << resource << std::endl;
+}
+
} // namespace openpower::dump::sbe_chipop
diff --git a/dump/sbe_dump_collector.hpp b/dump/sbe_dump_collector.hpp
index 1cb2348..c8a41cd 100644
--- a/dump/sbe_dump_collector.hpp
+++ b/dump/sbe_dump_collector.hpp
@@ -175,11 +175,13 @@
* message.
* @param cmdClass - The command class associated with the SBE operation.
* @param cmdType - The specific type of command within the command class.
+ * @param path - Dump collection path.
*
*/
bool logErrorAndCreatePEL(const openpower::phal::sbeError_t& sbeError,
uint64_t chipPos, SBETypes sbeType,
- uint32_t cmdClass, uint32_t cmdType);
+ uint32_t cmdClass, uint32_t cmdType,
+ const std::filesystem::path& path);
/**
* Determines the type of SBE for a given chip target.
@@ -208,13 +210,26 @@
*
* @param target Pointer to the pdbg target structure representing the
* processor to perform the thread stop on.
+ * @param path Dump collection path
* @return true If the thread stop was successful or in case of non-critical
* errors where dump collection can proceed.
* @return false If the SBE is not ready for chip-ops or in case of critical
* errors like timeouts, indicating the processor should be
* excluded from the dump collection.
*/
- bool executeThreadStop(struct pdbg_target* target);
+ bool executeThreadStop(struct pdbg_target* target,
+ const std::filesystem::path& path);
+
+ /**
+ * @brief Add Failure log information to info.yaml file
+ * @param logId - Error Log Id
+ * @param src - Reason Code of PEL
+ * @param chipName - Resource Name
+ * @param chipPos - Resource number
+ * @param path - Dump collection path
+ */
+ void addLogDataToDump(uint32_t logId, std::string src, std::string chipName,
+ uint64_t chipPos, const std::filesystem::path& path);
};
} // namespace openpower::dump::sbe_chipop
diff --git a/dump/tools/common/include/gendumpinfo b/dump/tools/common/include/gendumpinfo
index 5067ccf..5ccbea6 100644
--- a/dump/tools/common/include/gendumpinfo
+++ b/dump/tools/common/include/gendumpinfo
@@ -65,6 +65,7 @@
} >> "$YAML_FILE"
dump_time_details
get_addl_data
+ cat "$content_path/errorInfo" >> "$YAML_FILE"
}
# Run main