Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing error log ID or PEL ID as meta data #39

Open
wants to merge 1 commit into
base: 1060
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions dump/dump_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ constexpr auto SBEFIFO_CMD_CONTROL_INSN = 0x01;

void writeDumpFile(const std::filesystem::path& path, const uint32_t id,
const uint8_t clockState, const uint8_t chipPos,
util::DumpDataPtr& dataPtr, const uint32_t len)
util::DumpDataPtr& dataPtr, const uint32_t len,
const uint32_t pelIDForChipOpFailure)
{
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
Expand Down Expand Up @@ -68,7 +69,21 @@ void writeDumpFile(const std::filesystem::path& path, const uint32_t id,
std::ifstream::eofbit);
try
{
outfile.write(reinterpret_cast<char*>(dataPtr.getData()), len);
if (pelIDForChipOpFailure != 0)
{
std::string errLogID = "ELog ID: ";
std::stringstream ss;
ss << std::setw(8) << std::setfill('0') << pelIDForChipOpFailure;
errLogID += ss.str();
std::string metadata(reinterpret_cast<char*>(dataPtr.getData()));
metadata += errLogID;
uint32_t totalLen = len + static_cast<uint32_t>(errLogID.length());
outfile.write(metadata.c_str(), totalLen);
}
else
{
outfile.write(reinterpret_cast<char*>(dataPtr.getData()), len);
}
}
catch (std::ofstream::failure& oe)
{
Expand All @@ -90,7 +105,8 @@ void writeDumpFile(const std::filesystem::path& path, const uint32_t id,
void collectDumpFromSBE(struct pdbg_target* proc,
const std::filesystem::path& path, const uint32_t id,
const uint8_t type, const uint8_t clockState,
const uint64_t failingUnit)
const uint64_t failingUnit,
const uint32_t pelIDForChipOpFailure)
{
using namespace phosphor::logging;
auto chipPos = pdbg_target_index(proc);
Expand Down Expand Up @@ -193,7 +209,8 @@ void collectDumpFromSBE(struct pdbg_target* proc,
}
return;
}
writeDumpFile(path, id, clockState, chipPos, dataPtr, len);
writeDumpFile(path, id, clockState, chipPos, dataPtr, len,
pelIDForChipOpFailure);
}

void collectDump(const uint8_t type, const uint32_t id,
Expand All @@ -211,6 +228,7 @@ void collectDump(const uint8_t type, const uint32_t id,
openpower::phal::pdbg::init();

std::vector<struct pdbg_target*> procList;
uint32_t pelIDForChipOpFailure = 0;

pdbg_for_each_class_target("proc", target)
{
Expand Down Expand Up @@ -265,10 +283,11 @@ void collectDump(const uint8_t type, const uint32_t id,
"SRC6", std::to_string((index << 16) | cmd));

// Create error log.
openpower::dump::pel::createSbeErrorPEL(
"org.open_power.Processor.Error.SbeChipOpFailure",
sbeError, pelAdditionalData,
openpower::dump::pel::Severity::Informational);
pelIDForChipOpFailure =
openpower::dump::pel::createSbeErrorPEL(
"org.open_power.Processor.Error.SbeChipOpFailure",
sbeError, pelAdditionalData,
openpower::dump::pel::Severity::Informational);
}
else
{
Expand Down Expand Up @@ -314,7 +333,7 @@ void collectDump(const uint8_t type, const uint32_t id,
try
{
collectDumpFromSBE(procTarget, path, id, type, cstate,
failingUnit);
failingUnit, pelIDForChipOpFailure);
}
catch (const std::runtime_error& error)
{
Expand Down
10 changes: 8 additions & 2 deletions dump/dump_collect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ namespace sbe_chipop
* @param chipPos - Chip position of the failing unit
* @param dataPtr - Content to write to file
* @param len - Length of the content
* @param[in] pelIDForChipOpFailure - PEL ID if there is any chip op failure
* while collecting dump
*/
void writeDumpFile(const std::filesystem::path& path, const uint32_t id,
const uint8_t clockState, const uint8_t chipPos,
util::DumpDataPtr& dataPtr, const uint32_t len);
util::DumpDataPtr& dataPtr, const uint32_t len,
const uint32_t pelIDForChipOpFailure);

/** @brief The function to orchestrate dump collection from different
* SBEs
Expand All @@ -42,11 +45,14 @@ void collectDump(const uint8_t type, const uint32_t id,
* @param[in] clockState - State of the clock while collecting.
* @param[in] chipPos - Position of the chip
* @param[in] failingUnit - Chip position of the failing unit
* @param[in] pelIDForChipOpFailure - PEL ID if there is any chip op failure
* while collecting dump
*/
void collectDumpFromSBE(struct pdbg_target* proc,
const std::filesystem::path& path, const uint32_t id,
const uint8_t type, const uint8_t clockState,
const uint8_t chipPos, const uint64_t failingUnit);
const uint8_t chipPos, const uint64_t failingUnit,
const uint32_t pelIDForChipOpFailure);

} // namespace sbe_chipop
} // namespace dump
Expand Down