feat(migtd): route warn/error/fatal logs to COM1 serial port#838
Draft
MichalTarnacki wants to merge 1 commit into
Draft
feat(migtd): route warn/error/fatal logs to COM1 serial port#838MichalTarnacki wants to merge 1 commit into
MichalTarnacki wants to merge 1 commit into
Conversation
MigTD debugging has historically required ad-hoc TDVMCALL.IO writes
inserted by hand, because failure paths often did not call any of
the `log::*` macros and there was no guarantee that fatal exits
reached the host console.
td-logger is already initialised with `LevelFilter::Trace` and, with
the `tdx` feature, writes each byte to COM1 (0x3F8) via TDVMCALL.IO,
which QEMU forwards through `-serial mon:stdio`. This change makes
that serial path the canonical debugging channel:
* Add `release_max_level_info` to the `log` dependency so release
builds compile out `debug!`/`trace!` while keeping `info!`,
`warn!` and `error!` on the serial line. No VMM changes, no
shared buffer and no extra TDVMCALL are required.
* Emit `log::error!` from `panic_with_guest_crash_reg_report` with
the error code, message and caller `file:line` so every fatal
exit is visible on the serial port even when the surrounding
code forgot to log.
Signed-off-by: Michal Tarnacki <michal.tarnacki@intel.com>
Co-authored-by: GitHub Copilot <noreply@github.com>
Comment on lines
+30
to
+36
| log::error!( | ||
| "MigTD fatal (code=0x{:x}): {} at {}:{}\n", | ||
| errorcode, | ||
| panic_message, | ||
| file, | ||
| line | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MigTD debugging has historically required ad-hoc TDVMCALL.IO writes inserted by hand, because failure paths often did not call any of the
log::*macros and there was no guarantee that fatal exits reached the host console.td-logger is already initialised with
LevelFilter::Traceand, with thetdxfeature, writes each byte to COM1 (0x3F8) via TDVMCALL.IO, which QEMU forwards through-serial mon:stdio. This change makes that serial path the canonical debugging channel:release_max_level_infoto thelogdependency so release builds compile outdebug!/trace!while keepinginfo!,warn!anderror!on the serial line. No VMM changes, no shared buffer and no extra TDVMCALL are required.log::error!frompanic_with_guest_crash_reg_reportwith the error code, message and callerfile:lineso every fatal exit is visible on the serial port even when the surrounding code forgot to log.Fixes #430