ibm-openbmc / dev

Product Development Project Mgmt and Tracking
16 stars 2 forks source link

Python version of peltool #3526

Closed spinler closed 2 years ago

spinler commented 2 years ago

From #1161, we have to deliver a peltool application to parse PEL files to many different users, including at the minimum:

RHEL 7.7 on x86 (eblis) RHEL 7.9 using Fedora 35 containers on ppc64le (ISDW - call home databases) RHEL 7.9 on ppc64le (STELA) RHEL 7.9 on x86 ECUREP (decode PELs from BMC dumps coming back from the field)

We decided the best way forward is to write a python version of peltool that just needs to be able to parse a PEL file, so that we don't have to continually deal with all the C++ related dependencies. It would need to use the message_registry.json file to get some SRC descriptions, as well as call the SRC and UserData parsers provided by hostboot-pel-arsers.bb and openpower-pel-parsers.bb (and probably more).

We would like to deliver this as an RPM, similar to how openbmctool.py is (https://github.com/openbmc/openbmc-tools/blob/master/openbmctool/build-scripts/openbmctool-rhel7.spec).

A PEL is made up of sections, such as UserData, PrivateHeader, SRC, etc. Today, each of those sections is represented by a C++ class, in https://github.com/openbmc/phosphor-logging/tree/master/extensions/openpower-pels. Those classes are derived from a Section base class that has a getJSON() pure virtual function that the derived classes implement.

The complete PEL is represented by a PEL class, which has a toJSON() function: https://github.com/openbmc/phosphor-logging/blob/master/extensions/openpower-pels/pel.cpp#L438. That basically just loops on the sections it contains and calls getJSON() on them.

The PEL sections we support are:

Use:

I think we'll also need an RPM spec file to built the RPM out of, as I mentioned above. I'm not sure if we'd deliver the parser modules in the same RPM, or also make RPMs out of those and add a dependency into the peltool RPM?

BMC based PEL parser modules: https://github.com/ibm-openbmc/openpower-pel-parsers Hostboot PEL parser modules: https://github.com/open-power/hostboot/blob/master-p10/setup.py

I will try to make a publicly available PEL spec, but hopefully the code can be used mostly for reference.

spinler commented 2 years ago

The example from #1161:

With the follow PEL data, (base64 encoded here so it can be shown):

EgAMAEANQAgIgMIGEAnGSAiAwgYQCcpTwAACgAAEZwAAAAAAAAAAFAAX9hQAF/YVUgAGAEAIAAS
A0AAAAAAAAAAqAAAAAMCUFMAUAEBNQACAAAJAA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":          "1",
    "Sub-section type":         "0",
    "Created by":               "0x3500",
    "Created at":               "03/08/2022 18:40:27",
    "Committed at":             "03/08/2022 18:40:27",
    "Creator Subsystem":        "BMC",
    "CSSVER":                   "",
    "Platform Log Id":          "0x50005FD8",
    "Entry Id":                 "0x50005FD8",
    "BMC Event Log Id":         "4508"
},
"User Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Log Committed by":         "0x2000",
    "Subsystem":                "Processor Chip Cache",
    "Event Scope":              "Entire Platform",
    "Event Severity":           "Unrecoverable Error",
    "Event Type":               "Not Applicable",
    "Action Flags": [
                                "Service Action Required",
                                "Report Externally",
                                "HMC Call Home"
    ],
    "Host Transmission":        "Sent",
    "HMC Transmission":         "Acked"
},
"Primary SRC": {
    "Section Version":          "1",
    "Sub-section type":         "1",
    "Created by":               "0x3500",
    "SRC Version":              "0x02",
    "SRC Format":               "0x55",
    "Virtual Progress SRC":     "False",
    "I5/OS Service Event Bit":  "False",
    "Hypervisor Dump Initiated":"False",
    "Power Control Net Fault":  "False",
    "Backplane CCIN":           "2E2D",
    "Terminate FW Error":       "False",
    "Deconfigured":             "False",
    "Guarded":                  "False",
    "Valid Word Count":         "0x09",
    "Reference Code":           "BD123500",
    "Hex Word 2":               "00080055",
    "Hex Word 3":               "2E2D0010",
    "Hex Word 4":               "00000000",
    "Hex Word 5":               "00000000",
    "Hex Word 6":               "0000A404",
    "Hex Word 7":               "00000000",
    "Hex Word 8":               "00000000",
    "Hex Word 9":               "00000000"
},
"Extended User Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "0x2000",
    "Reporting Machine Type":   "9105-22A",
    "Reporting Serial Number":  "139F0B0",
    "FW Released Ver":          "NL1020_022",
    "FW SubSys Version":        "fw1020.00-43.1",
    "Common Ref Time":          "00/00/0000 00:00:00",
    "Symptom Id Len":           "20",
    "Symptom Id":               "BD123500_2E2D0010"
},
"Failing MTMS": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "0x2000",
    "Machine Type Model":       "9105-22A",
    "Serial Number":            "139F0B0"
},
"User Data 0": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "0x2000",
    "BMCState": "Ready",
    "BootState": "SystemInitComplete",
    "ChassisState": "On",
    "FW Version ID": "fw1020.00-43.1-1020.2208.20220225a (NL1020_022)",
    "HostState": "Running",
    "Process Name": "/usr/bin/openpower-occ-control",
    "System IM": "50001001"
},
"User Data 1": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "0x2000",
    "SBE_ERR_MSG": "SBE command reported error",
    "SRC6": "41988",
    "_PID": "2109"
},
"User Data 2": {
    "Section Version":          "1",
    "Sub-section type":         "203",
    "Created by":               "0x3500",
    "Data": [
        "FF DC 00 09 00 00 A4 04  00 DD B2 81 00 00 00 04  |  ................",
        "00 00 00 00 00 06 D0 35  00 00 00 01 00 00 00 00  |  .......5........",
        "00 00 00 04                                       |  ...."
    ]
},
"User Data 3": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "0x2000",
    "Data": []
},
"User Data 4": {
    "Section Version": "1",
    "Sub-section type": "3",
    "Created by": "0x2000",
    "Data": [
        "HWP_RC = RC_SBE_PIB_ADDRESS_ERROR",
        "HWP_RC_DESC = SBE SCOM failure - SCOM address failure",
        "HWP_FFDC_Failed SCOM address = 1917775928885248",
        "HWP_FFDC_PIB RC = 67133286",
        "."
    ]
}
}
lxwinspur commented 2 years ago

@spinler @mzipse Could we close this issue?

spinler commented 2 years ago

yep, thanks.