summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* PEL: Receive a 'bad PEL' indication from hostMatt Spinler2020-01-273-0/+92
| | | | | | | | | | | | | | | | | | | | If the code somehow sent the host a malformed PEL, it will respond with the 'Ack PEL' PLDM command with a special value that indicates this, and the PLDM daemon will relay it to this daemon. In this case, change the host transmission state to 'bad' so it doesn't get sent again. This should never happen as the Repository class already validates PELs and removes bad ones, though maybe the host and Repository have different ideas about what constitutes a malformed PEL. In the future, if event logging support is added to the PEL code running inside the logging daemon, it may be a good idea to create a new PEL for this case. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Id6f9fd37764bf5b5d09b4277a1e36b1f26b3e9a5
* PEL: Notifier support for 'host full'Matt Spinler2020-01-274-4/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | The host firmware may have a limited size for its staging area before it passes the PELs through to the OS, and this area may fill up with PELs it can't send if there are too many or the OS isn't up yet. In this case, it will send down an 'Ack PEL' PLDM command with a special response indicating this host full condition. The PLDM daemon will then call a method on this daemon to let it know. This command handles the host full condition on the HostNotifier class. When this is set: * The PEL that hit this condition will be put back on the queue to be sent again. * No new PELs will be sent up, except as noted below * A 60s timer will be started at the end of which another attempt will be made to send a PEL, in the hopes the condition went away. - If it didn't go away, this process will repeat. - If it did go away, a successful ack will be received and things will proceed as normal. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Iaeb38f43f7acc595bcff234ba50cedf8188b3d9b
* PEL: Support for the host acking a PELMatt Spinler2020-01-273-0/+93
| | | | | | | | | | | | | After the host firmware successfully transfers a PEL to the OS, it will respond with an 'Ack' command that the PLDM daemon sends over to this daemon via a D-Bus method call. Add support to the HostNotifier class for this. It will change the state field in the PEL to 'acked' so that it doesn't get sent up again. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Id2a9985965017d9431419c1375d5374a2d0ae00b
* PEL: On new PEL, send to host if necessaryMatt Spinler2020-01-273-1/+351
| | | | | | | | | | | | | | | | When a new PEL comes in, send it to the host now if the host is up and the class is currently idle. The PLDM command will be dispatched in a standalone function called from the event loop so that this function, which may be part of the 'Create new log' D-Bus method response, can return first. Also added testcases to start verifying these paths now that there is a full mock of the HostInterface class. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ib30a99cc61be9205122287ba310bc315d762e863
* PEL: Mock the new PEL available cmdMatt Spinler2020-01-271-1/+155
| | | | | | | | | | | | Instead of using PLDM, just write to a FIFO in the filesystem where what is written can be asynchronously read back from an event callback just like how PLDM commands behave. There is just a single byte written to the FIFO - a zero if the command is considered successful, something nonzero to indicate it should be a failure. Change-Id: I1fd79782126a6b1555597a4642b9ca3bfd030a79
* PEL: Take a PEL off the queue and send to hostMatt Spinler2020-01-273-2/+149
| | | | | | | | | | | | | Fill in the code that looks for the first PEL on the queue that still needs to be sent up, and send it. If the failure retry timer is active, or it has already retried the max number of times, then don't send anything. In the former case the timer callback will do the send, and in the latter the next time a log comes in it will start trying again. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ibb9692ca83b23e5e021db8b8a89b5549fb979df1
* PEL: Fill in host state change callbackMatt Spinler2020-01-272-0/+53
| | | | | | | | | | If the host is up, start sending PELs. If the host is off, move all of the PELs that are sent but not acked back to the queue to be sent again next time. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I66d382a85afc88f6b23367fb515df4dbe5326be1
* PEL: Fill in host command response handlerMatt Spinler2020-01-273-3/+81
| | | | | | | | | | | | If notifying the host of a new PEL was successful, then it will modify the PEL's host transmission state to 'sent' and add it to the list of sent PELs. If there was a failure, then a timer will be started so a retry can be done. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I77000c603a18726d4cdbb3920ca349e69198fb7f
* PEL: Logic to enqueue a PEL to send to hostMatt Spinler2020-01-274-6/+155
| | | | | | | | | Fill in the function to determine if a PEL needs to be placed on the qeueue to be sent up to the host. It involves checking both the host and HMC transmission states, as well as the PEL action flags field. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I9f1a9fba1b7e6dc7a167f1c7e9dfd6c40d90883f
* PEL: Add HostNotifier classMatt Spinler2020-01-277-6/+462
| | | | | | | | | | | | | This class will watch for new PELs being created, and handle sending them up to the host. This first commit for this class mostly just fills in the constructor to set up the various callbacks it will use. It is only instantiated in the Manager class if the Manager constructor used is the one that passes in the HostInterface object, to allow for configurations that don't need PELs passed up. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I0ddcf94d047979eb78209d396c2351566c634dbe
* PEL: Add HostInterface base classMatt Spinler2020-01-271-0/+211
| | | | | | | | | | | | This is an abstract base class that is overridden to send a command to the host (such as a hypervisor) to notify it of new PELs. The only concrete implementation is using the 'New File Available' PLDM command. Using this base class allows the PLDM aspects to be mocked in testcases that involve queuing and sending PELs. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I830298d0fd949b4268c31c83acafe2afd90dd4cb
* PEL: Print the JSON formatted UserDataMatt Spinler2020-01-228-8/+269
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Override the getJSON() function in the UserData section so it will support peltool pretty printing when the data has been stored as JSON (component phosphor-logging, subtype 1 as defined in user_data_formats.hpp). It first converts the original JSON string to a nlohmann::json object to validate it is valid JSON and then uses nlohmann::json's stream << operator to convert it into a pretty string. This also sets up a framework where other UserData parsing functions can be called from, and it is all only compiled into peltool, and not into phosphor-log-manager. The UserData section created out of the OpenBMC event log's AdditionalData property already makes use of this format. Here are some example outputs. Note that the 'Data' key is added by this code for JSON that isn't already an object (dict) to make it one. "User Data": { "OPERATION": "something", "REGISTER_FFDC": "REG1=0x8|REG2=0x9|REG3=0x55", "RETURN_VALUE": "-12", "TIMEOUT_IN_MSEC": "100", "_PID": "993" }, "User Data": { "Data": [ "OPERATION", "REGISTER_FFDC", "RETURN_VALUE", "TIMEOUT_IN_MSEC", "_PID" ] }, "User Data": { "Data": "This is a string" } Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I7b034ac24339b5b019db3b57d8e71cb03559363e
* PEL: Print OBMC event log ID in peltoolMatt Spinler2020-01-211-0/+2
| | | | | | | | | | | In the PrivateHeader section, add an entry into peltool's JSON output for the OpenBMC event log ID. This is a reserved field in the PEL spec, but we are using it to associate the PEL to the BMC event log it came from. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Id347aa67f79d7f5fac1e572de100755df7b29e6e
* PEL: Print host trans state in peltoolMatt Spinler2020-01-214-0/+27
| | | | | | | | In the UserHeader section, add an entry into peltool's JSON output for the host transmission state. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ie906a447859e30175652d291ef2f929e8a7077f6
* PEL: API for getting if system is HMC managedMatt Spinler2020-01-151-0/+16
| | | | | | | | | | | | | | | Add an API to the DataInterface class for determining if the system is HMC (hardware management console, which usually reference to a specific set of software and hardware that connects to IBM servers) managed. As of now there is no way to determine this, so just return the default of false. This status impacts which PELs are sent to the host. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I803bc71c271dec6d68821dd36089e7a46461aac6
* PEL: Trace when event logs don't create PELsMatt Spinler2020-01-151-3/+22
| | | | | | | | | | | | | | To help show which events are missing from the PEL message registry, add a journal entry for when an OpenBMC event log name isn't found in the registry and a PEL won't be created. Eventually, this will be replaced with creating a brand new PEL that contains the event log info. In addition, add a journal entry displaying the SRC ASCII string of newly created PELs. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I1228339cfa7d1d5aa60ef3b3ce2b2c0424ab0bf4
* PEL: Print Private Header into JSON alignedHarisuddin Mohamed Isa2020-01-141-11/+12
| | | | | | | | | | | | | | | | | | "Private Header": { "Section Version": "1", "Sub-section type": "0", "Created by": "0x1000", "Created at": "12/05/2019 18:32:42", "Committed at": "12/05/2019 18:32:42", "Creator Subsystem": "BMC", "CSSVER": "", "Platform Log Id": "0x50000C00", "Entry Id": "0x50000C00" } Testing: Manually run peltool and verified output Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com> Change-Id: Ib6ef49f1b29486a97e86700b19ac982e43bede37
* PEL: Taking regex calls out of PEL listing functionAatir2020-01-141-20/+17
| | | | | | | Taking out regex calls to improve time complexity Change-Id: Id0ca32bf78b006b3c8e03ac95206c670f92d4002 Signed-off-by: Aatir <aatrapps@gmail.com>
* PEL: PEL listing time fixAatir2020-01-141-96/+196
| | | | | | | | Previously PELs were being flattened twice before being listed. This commit brings it down to one. Change-Id: I027d1e22e8d6d793c30c6f26a06178a448a6c301 Signed-off-by: Aatir <aatrapps@gmail.com>
* PEL: Display PEL by IDAatir2020-01-141-6/+74
| | | | | | | This command displays a PEL by id. Change-Id: I26b8d30b886f47c02dd8cf648e6a261a6867a048 Signed-off-by: Aatir <aatrapps@gmail.com>
* PEL: Print action flags into JSON alignedHarisuddin Mohamed Isa2020-01-099-55/+167
| | | | | | | | | | | | | | | | | | | "User Header": { "Section Version": "1", "Sub-section type": "0", "Log Committed by": "0x4552", "Subsystem": "System Hypervisor Firmware", "Event Scope": "Entire Platform", "Event Severity": "Informational Event", "Event Type": "Miscellaneous, Informational Only", "Action Flags": [ "Report Externally" ] } Testing: Manually run peltool and verified output Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com> Change-Id: Ie8376953b5f1baa093fc0aa9564d50cd4208564e
* PEL: Add API to get the PLDM instance IDMatt Spinler2019-12-172-2/+47
| | | | | | | | | | | | | In order to send a PLDM command, one must get the instance ID parameter to use for that command from the PLDM daemon via a D-Bus method. Implement this API in the DataInterface class, though leave the body of it stubbed out until the PLDM daemon switches to using async D-Bus operations as right now the logging daemon and PLDM daemon can deadlock with each calling into the other. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I592e7bad922c725edee67003e9957388df5f195c
* PEL: Add repo function to get a PEL FDMatt Spinler2019-12-173-0/+81
| | | | | | | | | | | Add Repository::getPELFD() to return a file descriptor to a PEL data file based on its ID. This will be used by a future D-Bus method to return the descriptor to the PLDM daemon. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I1110a514e30a9387d9672e42862139b988717c53
* PEL: Filled in PEL value descriptionsHarisuddin Mohamed Isa2019-12-122-133/+158
| | | | | | | | | | | Updated getValue to return value description instead of registry name. Updated unit test to add checking of value description. Testing: Ran unit test successfully on QEMU and also verified peltool output Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com> Change-Id: Icf64f51a467c3bd4dd9bbcd78aea3df966b20eb7
* PEL: Fix message registry schema typoMatt Spinler2019-12-111-1/+1
| | | | Change-Id: Ic20d6560a79dc8cc871ebc1ab64ce5aefc2ccfe6
* PEL: Put back in the default error log capsMatt Spinler2019-12-101-2/+0
| | | | | | | | | | Since there is no code in place yet to purge old logs after some amount of total space is consumed, it will be safest to put back in the default cap of 200. If more than 200 is needed in the short term, we can use the currently available configure option to increase the cap. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ide1af5432271817f30bfaf0b065c35906aaa05cf
* PEL: Add ExtendedUserHeader section classMatt Spinler2019-12-099-21/+813
| | | | | | | | | | | | | | This is a required PEL section. The section contains: * The machine type/model/SN * The server firmware version * The BMC firmware version * The 'Event Common Reference Time' (not used yet) * The symptom ID (a unique event signature) Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I223041f85965195fccf69542dbe86ce856073b36
* PEL: Add APIs to read the FW versionsMatt Spinler2019-12-093-0/+71
| | | | | | | | | | | | | Add methods to the DataInterface class to read the BMC and server firmware versions. The server firmware version represents the version of all firmware images that are in the flash image, not just the BMC. There is nowhere to get that version yet, so this commit just has a placeholder. These will be used by the ExtendedUserHeader section. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I47389714c987337cb96c72b6bf2b270c78003357
* PEL: Add constructors to BCDTimeMatt Spinler2019-12-091-0/+15
| | | | | | | | Add constructors to set all members to zero initially or pass them all in. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ic28cee19014c739f331fd0498229dfb503b0df88
* PEL: Add Repo API to update transmission statesMatt Spinler2019-12-093-0/+197
| | | | | | | | | Provided APIs for the Repository class to update the host and HMC transmission states on a PEL it contains. It saves the updated PEL data in the filesystem. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Iadbc589ee85d4408339e1171c36b8324910f4f0a
* PEL: Reset host transmission state on restartMatt Spinler2019-12-091-0/+17
| | | | | | | | | | When the Repository class starts up, if it finds any existing PELs with a host transmission state of 'sent', set it back to 'new' so that it will get sent again, as the BMC restarted or the daemon crashed before the host could ack it. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ieeca2c1a92eabc0a22051be6b87cecbe0b1d519d
* PEL: Set tran states when PELs are added to repoMatt Spinler2019-12-091-0/+3
| | | | | | | | When a PEL is added to the repository, ensure that the host and HMC transmission states are set to 'new'. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I9edb9d388a61742c28c1df1552b9678d10b9fcc4
* PEL: Save tran states in the repo attributesMatt Spinler2019-12-092-5/+12
| | | | | | | | | Save the host and HMC (Hardware Management Console) transmission states in the PEL attributes map so that external callers can get to them without having to unflatten a PEL from the filesystem. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: If8b396d3c342af2c7a3c34f4f1bb0a7da075e47c
* PEL: Repository: Add write() functionMatt Spinler2019-12-092-12/+26
| | | | | | | | Pull the code that writes a PEL object to a file into a separate function so that it can be called in multiple places. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ic5701fdfb03cca915520222bbbd8bb92a9c47c49
* PEL: Add enums for transmission statesMatt Spinler2019-12-092-0/+51
| | | | | | | | | | So far, the states are new, sent, and acked. Also added PEL object access to getting and setting these on the User Header section object. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I0dfb2d1a39fe69b2a47bf7d461f08e92039a3e03
* PEL: Store transmission states in UserHeaderMatt Spinler2019-12-092-6/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use a reserved word in the UserHeader section to store some PEL states: * Host Transmission State: - States involving the progression of a PEL being sent to the operating system. * HMC Transmission State: - States involving the progression of a PEL being sent to the hardware management console, if there is one attached. - Usually, an HMC refers to a specific set of hardware and software sold by IBM that connects to OpenPower systems which has specific software to deal with receiving PELs. It is possible that there is an implementation that won't need to send PELs to either of these entities, in which case these states will just be unused and left at zero. This is the same location that other service processor implementations have stored transmission states. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I6a2bfee15336dbd564aeaded88effa55ede0d6c4
* PEL: Remove userHeader::getValueAatir2019-12-092-29/+7
| | | | | | | | | getValue function is now being used to get field values for all the different sections. Therefore, it makes sense to remove the older implementation of this function from userHeader class. Change-Id: I041b8c5e0548e9f7ee354f21d2e248ed946df5ec Signed-off-by: Aatir <aatrapps@gmail.com>
* PEL: Print list of PELsAatir2019-12-094-10/+215
| | | | | | | | | | | | | | | | | | | | | | PelTool commands for printing a list of PELs. PEL list sample: { "0x50000004": { "SRC": "BD8D1001", "PLID": "0x50000004", "CreatorID": "BMC", "Subsystem": "bmc_firmware", "Commit Time": "10/24/2019 15:50:08", "Sev": "unrecoverable", "CompID": "0x1000" } } Change-Id: Ifd864a6561c09de098689195edcf107b3fe550e3 Signed-off-by: Aatir <aatrapps@gmail.com>
* PEL: private header in JSONAatir2019-12-094-1/+68
| | | | | | | | | | | | | | | | | | | | | | The PELTool application is able to convert sections to JSON. This commit takes care of converting the private header section to JSON. private header section in JSON sample: "Private Header":[ {"Section Version": "1"}, {"Sub-section type": "0"}, {"Log Committed by": "0x1000"}, {"Entry Creation": "10/24/2019 15:50:08"}, {"Entry Commit": "10/24/2019 15:50:08"}, {"Creator ID": "BMC"}, {"Creator Implementation": ""}, {"Platform Log ID": "0x50000004"}, {"Log Entry ID": "0x50000004"} ] Signed-off-by: Aatir <aatrapps@gmail.com> Change-Id: I8b0d7dc7b70cd2a03f67f7c9a48755803634005d
* Resource leakage on opened file.Troy Lee2019-12-091-2/+2
| | | | | | | | | | The opened file descriptor and inotify won't be released, if the synced file generate in time. This happens occasionally, but the leakage will lead to journal log failure and will not able to use inotify after a long period run. Change-Id: I09cca72c88091ebcf1bb7ddb7df04ee1d2b2d7d6 Signed-off-by: Troy Lee <troy.lee@vertiv.com>
* PEL: Keep PEL attributes in Repository mapMatt Spinler2019-12-033-24/+113
| | | | | | | | | | | | Instead of the Repository class only storing the path to a PEL file for a corresponding PEL ID, change it to a structure that includes the PEL's size and action flags as well as the path. This way, a PEL won't have to be read from the filesystem to find these values every time someone needs them. These new fields will be needed by the code that sends PELs to the host. Change-Id: I7650b6cbad12cc120426854767403f5cba2ee572
* PEL: Add subscriptions for new and deleted PELsMatt Spinler2019-12-033-0/+167
| | | | | | | | | | | Add functionality to the Repository class to be able to call functions provided by others when PELs are added or removed from the repository. This will be used in the future for things like knowing when a new PEL is added so it can be sent to the host. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I2effc9d5fa9a38890311a88bcfb07eed1292a453
* PEL: Keep track of if host is runningMatt Spinler2019-12-032-0/+198
| | | | | | | | | | | | | | | | | Use the DataInterface class to keep track of if the host is up and running by keeping track of the OperatingSystemState property on the xyz.openbmc_project.State.OperatingSystem.Status interface on the /xyz/openbmc_project/state/host0 object path. Added a isHostUp() function as well as a subscribeToHostStateChange() function to allow a user to pass in a function to be run when the host changes state. Property values of 'BootComplete' or 'Standby' mean that the host is running, anything else is considered not running. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I096b2bc4014dff9be85a4bbd74ef27193fd338fb
* PEL: Move some functionality into DataIfaceBaseMatt Spinler2019-11-251-36/+23
| | | | | | | | | | | Refactor DataInterface to hold the data members in the base class, and use the derived class for calculating them. This will make it consistent with functionality that will be added in the future. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: If6f2ba1890df296cb612c8a64dd60db72c70c46d
* PEL: Create registry directory for testMatt Spinler2019-11-191-1/+4
| | | | | | | | | The PEL manager test wasn't creating the message registry directory before writing into it, and seemed to have just been lucking out that a previous test had created it. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I122242d65db02d8b80864c938cc28be434774304
* PEL: Support UserData padding in the testcasesMatt Spinler2019-11-192-4/+11
| | | | | | | | Some testcase updates were missed when the fix was made to pad the UserData section to 4 byte boundaries as required by the spec. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I8129a70cfd740155ca05089563dfc5d7e63bdc81
* PEL: Hex dump bug fixAatir2019-11-181-0/+3
| | | | | | | | Hex dump function had a bug where the last line was getting printed incorrectly. Signed-off-by: Aatir <aatrapps@gmail.com> Change-Id: I6acab7b57baf376b66b461c31f91a07377a7354a
* PEL: Pad UserData section to 4 byte boundaryMatt Spinler2019-11-181-0/+6
| | | | | | | | | The spec says that all section sizes must be a multiple of 4 bytes, so pad the User Data section that contains the AdditionalData JSON out to that. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I30b46a34604ee10d67755f51fd7d9c41b2f75c9f
* PEL: Validate the message registry during CIMatt Spinler2019-11-181-0/+3
| | | | | | | | | CI will run any files called run-ci.sh it finds in a repo, so add a script of that name to run process_registry.py against the message registry to check it for errors. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I35da7c1454696b90ec88b3545992414160ae920b
* PEL: user header in JSONAatir Manzur2019-11-154-14/+96
| | | | | | | | | | | | | | | | | | | | The PELTool application is able to convert sections to JSON. This commit takes care of converting the user header section to JSON. user header section in JSON sample: "User Header":[ {"Section Version": "1"}, {"Sub-section type": "0"}, {"Log Committed by": "0x2000"}, {"Subsystem": "bmc_firmware"}, {"Event Scope": "entire_platform"}, {"Event Severity":"unrecoverable"}, {"Event Type": "na"} ] Signed-off-by: Aatir Manzur <aatrapps@gmail.com> Change-Id: I0dca1d87019b9e62d711ee6d034f2e8bc0574c2e
OpenPOWER on IntegriCloud