microsoft/mu_plus

[Feature]: Add prefix for different firmware entities in memory logging

kuqin12 opened this issue · 0 comments

Feature Overview

Currently all firmware entities that supports advanced memory logging will dump messages into the memory buffer, without any distinguishable notations. Once the parsed log is retrieved from target, all prints are mushed together, making it hard to read.

The request is to add prefix for different instances of advance logging parties, making it easier to parse and locate logs.

Solution Overview

Adding an API for each instance that produces AdvancedLoggerGetLoggerInfo, call it AdvancedLoggerGetStringPrefix. This function will return a constant string and its size. This function will be invoked from AdvancedLoggerMemoryLoggerWrite, where the return will be copied to the front of each memory log message.

We should make the prefix string minimal, as it will bloat the memoy usage in the memory logging buffer.

Alternatives Considered

  1. Create a static PCD for the prefix, so that each component type can use that PCD to prefix the messages.
    • This is a simpler solution by offloading the PCD config to platforms. However, the change will require in-depth analysis of the build configuration and could lead to integration errors.
  2. Create a message entry v2. Instead of materializing the prefix into the memory logging buffer, add a field indicating the library instance (i.e. PEI core for 0, PEIM for 1, etc.) so that the parser can handle the prefix.
    • This is a more ideal solution, but the issue is that the parser application will need to be updated accordingly as this is introducing a breaking change, of which the impact is unknown.

Urgency

Medium

Are you going to implement the feature request?

I will implement the feature

Do you need maintainer feedback?

Maintainer feedback requested

Anything else?

No response