You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
petri: openhcl logs now at appropriate level with HyperV backend (#1690)
The OpenHCL logs in TDX HyperV tests were appearing as INFO level
regardless of their actual kernel log level, making debugging difficult
when viewing test results.
## Problem
In `petri/src/tracing.rs`, the `kmsg_log_task` function was hardcoding
all OpenHCL log entries as `Level::INFO` when calling
`log_file.write_entry()`. This meant that kernel emergency, alert,
critical, error, warning, and debug messages all appeared with the same
severity level in test results.
## Solution
1. **Added kernel level mapping function**: Created
`kernel_level_to_tracing_level()` that properly maps Linux kernel log
levels to tracing levels:
- Kernel 0-3 (Emergency, Alert, Critical, Error) → `Level::ERROR`
- Kernel 4 (Warning) → `Level::WARN`
- Kernel 5-6 (Notice, Info) → `Level::INFO`
- Kernel 7 (Debug) → `Level::DEBUG`
- Unknown levels → `Level::INFO` (fallback)
2. **Updated kmsg_log_task**: Modified the function to use the actual
log level from kmsg entries via `write_entry_fmt()` instead of hardcoded
INFO:
```rust
// Before
log_file.write_entry(message.display(false));
// After
let level = kernel_level_to_tracing_level(message.level);
log_file.write_entry_fmt(None, level, format_args!("{}",
message.display(false)));
```
3. **Added comprehensive tests**: Included unit tests to verify the
mapping works correctly for all kernel log levels.
## Impact
TDX HyperV tests like
`hyperv_openhcl_uefi_x64[tdx](vhd(windows_datacenter_core_2025_x64))`
will now show proper log levels in test results:
- 🔴 **ERROR** for critical issues that need immediate attention
- 🟡 **WARN** for warnings that should be investigated
- 🔵 **INFO** for normal informational messages
- 🟢 **DEBUG** for debug-level diagnostics
This makes debugging test failures much easier by allowing developers to
quickly identify and prioritize issues based on their actual severity.
Fixes#1686.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to
start the survey.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
Co-authored-by: Matt LaFayette (Kurjanowicz) <mattkur@microsoft.com>
0 commit comments