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/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