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

uefi: Drop the panic-on-logger-errors feature #1143

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

nicholasbishop
Copy link
Contributor

This was originally added because of occasional panics when logging quickly on VirtualBox. (Unclear whether this bug is still present, and also as far as I know we haven't observed this behavior on any other UEFI implementations.) The decision was made to panic by default on logger errors, but offer an escape mechanism. However, making this a compile-time choice is not ideal, since most UEFI programs are intended to run on arbitrary UEFI implementations.

We could make it a runtime option instead, but since loggers are usually just informational (i.e. not critical functionality for the application), silently ignoring errors seems like a better choice for most uses.

In the rare case where an application does consider logging critical, they can turn off the logger helper and implement their own logger.

For prior discussion, see:

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

This was originally added because of occasional panics when logging quickly on
VirtualBox. (Unclear whether this bug is still present, and also as far as I
know we haven't observed this behavior on any other UEFI implementations.) The
decision was made to panic by default on logger errors, but offer an escape
mechanism. However, making this a compile-time choice is not ideal, since most
UEFI programs are intended to run on arbitrary UEFI implementations.

We could make it a runtime option instead, but since loggers are usually just
informational (i.e. not critical functionality for the application), silently
ignoring errors seems like a better choice for most uses.

In the rare case where an application does consider logging critical, they can
turn off the `logger` helper and implement their own logger.

For prior discussion, see:
* rust-osdev#121
* rust-osdev#123
// Ignore all errors. Since we're in the logger implementation we
// can't log the error. We also don't want to panic, since logging
// is generally not critical functionality.
let _ = DecoratedLog::write(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We could write it to the serial device and the debugcon device in that case.

@phip1611 phip1611 added this pull request to the merge queue Apr 21, 2024
Merged via the queue into rust-osdev:main with commit 2e5dea4 Apr 21, 2024
12 checks passed
@nicholasbishop nicholasbishop deleted the bishop-drop-panic-log branch April 21, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants