Skip to content

fix(nested): handle CPU features and microcode for nested cmr8i#5850

Draft
JamesC1305 wants to merge 2 commits intofirecracker-microvm:mainfrom
JamesC1305:fix-nv-cpu-features
Draft

fix(nested): handle CPU features and microcode for nested cmr8i#5850
JamesC1305 wants to merge 2 commits intofirecracker-microvm:mainfrom
JamesC1305:fix-nv-cpu-features

Conversation

@JamesC1305
Copy link
Copy Markdown
Contributor

@JamesC1305 JamesC1305 commented Apr 21, 2026

Reason

When running Firecracker as a nested virtual machine on virt cmr8i instances, we were encountering failures related to the CPU features being a smaller subset on L1, and microcode not being available to L1.

To fix this, check for nested via /proc/cpinfo, and change tests to expect a subset of CPU features as well as microcode not being available when running nested.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.

PR Checklist

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

EC2 virtualised instances don't expose microcode to the L1 guest. Make
it so microcode not being present is an allowed condition for virt
instances only. (Metals w/o microcode will still return an Error).

Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
Detect whether an instance is running in nested virt (by checking the
host's features). This can then be used throughout our tests to change/
filter certain aspects of the tests that we don't expect to work the
same as on metal instances.

Signed-off-by: James Curtis <jxcurtis@amazon.co.uk>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 72.22222% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.05%. Comparing base (636f7fa) to head (f262b87).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/cpu-template-helper/src/fingerprint/dump.rs 41.17% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5850      +/-   ##
==========================================
- Coverage   83.07%   83.05%   -0.03%     
==========================================
  Files         276      276              
  Lines       29541    29558      +17     
==========================================
+ Hits        24541    24548       +7     
- Misses       5000     5010      +10     
Flag Coverage Δ
5.10-m5n.metal 83.37% <71.42%> (-0.03%) ⬇️
5.10-m6a.metal 82.70% <71.42%> (-0.03%) ⬇️
5.10-m6g.metal 79.97% <72.72%> (-0.03%) ⬇️
5.10-m6i.metal 83.37% <71.42%> (-0.04%) ⬇️
5.10-m7a.metal-48xl 82.69% <71.42%> (-0.03%) ⬇️
5.10-m7g.metal 79.97% <72.72%> (-0.03%) ⬇️
5.10-m7i.metal-24xl 83.34% <71.42%> (-0.03%) ⬇️
5.10-m7i.metal-48xl 83.35% <71.42%> (-0.02%) ⬇️
5.10-m8g.metal-24xl 79.97% <72.72%> (-0.02%) ⬇️
5.10-m8g.metal-48xl 79.97% <72.72%> (-0.02%) ⬇️
5.10-m8i.metal-48xl 83.34% <71.42%> (-0.03%) ⬇️
5.10-m8i.metal-96xl 83.35% <71.42%> (-0.02%) ⬇️
6.1-m5n.metal 83.39% <71.42%> (-0.03%) ⬇️
6.1-m6a.metal 82.73% <71.42%> (-0.03%) ⬇️
6.1-m6g.metal 79.97% <72.72%> (-0.03%) ⬇️
6.1-m6i.metal 83.40% <71.42%> (-0.03%) ⬇️
6.1-m7a.metal-48xl 82.72% <71.42%> (-0.03%) ⬇️
6.1-m7g.metal 79.97% <72.72%> (-0.03%) ⬇️
6.1-m7i.metal-24xl 83.40% <71.42%> (-0.03%) ⬇️
6.1-m7i.metal-48xl 83.41% <71.42%> (-0.03%) ⬇️
6.1-m8g.metal-24xl 79.97% <72.72%> (-0.03%) ⬇️
6.1-m8g.metal-48xl 79.97% <72.72%> (-0.03%) ⬇️
6.1-m8i.metal-48xl 83.41% <71.42%> (-0.03%) ⬇️
6.1-m8i.metal-96xl 83.41% <71.42%> (-0.03%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@JamesC1305 JamesC1305 marked this pull request as draft April 22, 2026 12:57
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.

1 participant