Skip to content

AdvLoggerPkg/AdvancedFileLogger: Flush logs only once per reset - #923

Open
Liqi Qi (liqiqiii) wants to merge 1 commit into
microsoft:release/202511from
liqiqiii:advlogger-fix-nvme-timeout-on-nested-reset
Open

AdvLoggerPkg/AdvancedFileLogger: Flush logs only once per reset#923
Liqi Qi (liqiqiii) wants to merge 1 commit into
microsoft:release/202511from
liqiqiii:advlogger-fix-nvme-timeout-on-nested-reset

Conversation

@liqiqiii

@liqiqiii Liqi Qi (liqiqiii) commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

A capsule-armed reset converts a warm reset into a cold reset by issuing a second, nested ResetSystem() call. NvmExpressDxe shuts its controller down on the first reset notification (via the reset notification protocol, which fires after this platform-specific reset filter) and does not re-initialize it, so re-writing the logs on the nested reset issues I/O to a powered-down NVMe controller. This stalls for the full NVMe command timeout (~5 seconds) and logs a fatal NVMe WHEA telemetry record (EFI_IO_BUS_SCSI | EFI_IOB_EC_INTERFACE_ERROR, 0x02070005), and the log write ultimately fails with a timeout.

Add a module-static latch so the in-memory log is flushed to media only once per reset sequence. Nested reset notifications early-return instead of re-writing to the already-shut-down controller. The normal ReadyToBoot / ExitBootServices / sync flush paths are unaffected.

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

Tested with hardware, work as expected.

A capsule-armed reset converts a warm reset into a cold reset by issuing a
second, nested ResetSystem() call. NvmExpressDxe shuts its controller down on
the first reset notification (via the reset notification protocol, which fires
after this platform-specific reset filter) and does not re-initialize it, so
re-writing the logs on the nested reset issues I/O to a powered-down NVMe
controller. This stalls for the full NVMe command timeout (~5 seconds) and logs
a fatal NVMe WHEA telemetry record (EFI_IO_BUS_SCSI | EFI_IOB_EC_INTERFACE_ERROR,
0x02070005), and the log write ultimately fails with a timeout.

Add a module-static latch so the in-memory log is flushed to media only once per
reset sequence. Nested reset notifications early-return instead of re-writing to
the already-shut-down controller. The normal ReadyToBoot / ExitBootServices /
sync flush paths are unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cccd4451-999f-4caf-bdb4-da35fd5bef85
@mu-automation

mu-automation Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

✅ QEMU Validation Passed

Source Dependencies

Repository Commit
mu_plus 7fbb4c8
mu_tiano_platforms 5fe0377

Results

Platform Target Build Boot Overall Boot Time Build Logs Boot Logs
Q35 DEBUG ✅ success ✅ success 0m 20s Build Logs Boot Logs
ArmVirt DEBUG ✅ success ✅ success 0m 14s Build Logs Boot Logs

Workflow run: https://github.com/microsoft/mu_plus/actions/runs/29968504342

This comment was automatically generated by the Mu QEMU PR Validation workflow.

@mu-automation mu-automation Bot added the impact:non-functional Does not have a functional impact label Jul 23, 2026
@apop5

Copy link
Copy Markdown
Collaborator

Has the unregister path been tested? What if, after the log was written, the notification function was unregistered?

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202511@fcb7c70). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...vLoggerPkg/AdvancedFileLogger/AdvancedFileLogger.c 0.00% 26 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             release/202511    #923   +/-   ##
================================================
  Coverage                  ?   3.02%           
================================================
  Files                     ?      37           
  Lines                     ?    4332           
  Branches                  ?      73           
================================================
  Hits                      ?     131           
  Misses                    ?    4195           
  Partials                  ?       6           
Flag Coverage Δ
AdvLoggerPkg 3.02% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liqiqiii

Copy link
Copy Markdown
Contributor Author

Has the unregister path been tested? What if, after the log was written, the notification function was unregistered?

Good catch Aaron, I will get some Intel secured core/non secured core devices tested as well. The secured core could be highly influence by this.

@apop5

Copy link
Copy Markdown
Collaborator

Liqi Qi (@liqiqiii)

Is this still needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:non-functional Does not have a functional impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants