Skip to content

OvmfPkg/PlatformDxe: register log buffer as efi config table #11223

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

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

kraxel
Copy link
Member

@kraxel kraxel commented Jun 24, 2025

If a memory debug log buffer is present, register the buffer location as
config table so the OS can find and show it.

Signed-off-by: Gerd Hoffmann [email protected]

@kraxel kraxel marked this pull request as ready for review June 24, 2025 09:06
@kraxel
Copy link
Member Author

kraxel commented Jun 24, 2025

@ajyoung-oracle

@kraxel
Copy link
Member Author

kraxel commented Jun 24, 2025

@ajyoung-oracle
Copy link
Contributor

linux kernel side of this: https://gitlab.com/kraxel/linux/-/commit/4d049a97f751355eb7e4065cf36beedddb733442

Hi Gerd, Looking the ovmf_log_read() function for this patch, it seems it's not quite complete.
The algorithm to display (or in this case copy) the memory debug log messages in time order is (copied from from the EDK2 code):
//
// Maintain a circular (wrap around) log buffer
// NOTES:
// tail always points to next available slot to populate
// Algorithm to process/display strings from buffer in time order:
// 1. head==tail indicates empty buffer
// 2. if (head < tail), process from head (tail-head) bytes
// 3. if (head > tail), process from head (bufend-head) bytes
// process from bufstart (tail-bufstart) bytes

In case#3, where the buffer has wrapped (due to being circular), I believe (if I am reading the code right) ovmf_log_read() is not doing the second part - i.e. "process from bufstart (tail-bufstart) bytes". I think you will need a second memcpy() call for this wrapped case to get the last messages (from the start of the buffer through the tail). You can double check me of course.

@kraxel
Copy link
Member Author

kraxel commented Jun 25, 2025

I think you will need a second memcpy() call for this wrapped case to get the last messages (from the start of the buffer through the tail). You can double check me of course.

Nope. ovmf_read_log() is called repeatedly (with page-sized buffer) until it returns 0 to indicate it has no more data. That'll also takes care of the wrapping case.

@kraxel kraxel force-pushed the devel/memlog-table branch from 4f8ea88 to 0f4886b Compare June 25, 2025 09:16
@ardbiesheuvel ardbiesheuvel added the push Auto push patch series in PR if all checks pass label Jul 8, 2025
If a memory debug log buffer is present, register the buffer location as
config table so the OS can find and show it.

Signed-off-by: Gerd Hoffmann <[email protected]>
@kraxel kraxel force-pushed the devel/memlog-table branch from 0f4886b to a57e0ef Compare July 8, 2025 07:39
@mergify mergify bot merged commit 5090c39 into tianocore:master Jul 8, 2025
130 checks passed
@kraxel kraxel deleted the devel/memlog-table branch July 8, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants