Skip to content

Conversation

@gudmundur
Copy link
Contributor

@gudmundur gudmundur commented Mar 5, 2025

Changes

Allows the jailer to continue when files in /sys/devices/system/cpu/cpuX/cache/indexY/ are missing.

Reason

Nested virtualization support was added on macOS Sequoia for Apple M3/M4 chips. When using vz with Lima a few of the CPU cache information files are missing, namely size, coherency_line_size, and number_of_sets. firecracker itself handles if these files are missing, while the jailer doesn't . This patch passes whatever is present to the copied cache information, and allows firecracker to determine if it is valid or not.

By making this change, we are able to simplify our development environments drastically by not requiring either GitHub Codespaces or AWS EC2 metal instances.

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 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.

@gudmundur
Copy link
Contributor Author

With this change, the jailer will start firecracker after printing out these lines:

Could not read the size, coherency_line_size, number_of_sets for cache level 0.
Could not read the size, coherency_line_size, number_of_sets for cache level 1.
Could not read the size, coherency_line_size, number_of_sets for cache level 2.

@zulinx86 zulinx86 requested a review from ShadowCurse March 5, 2025 14:37
Copy link
Contributor

@ShadowCurse ShadowCurse left a comment

Choose a reason for hiding this comment

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

Hi @gudmundur, thank you for the PR. Even though Firecracker officially does not support nested virtualization usage, it will be nice to have a consistent behavior between Jailer and Firecracker.

@codecov
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 83.18%. Comparing base (a24bae5) to head (7086897).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/jailer/src/env.rs 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5062      +/-   ##
==========================================
- Coverage   83.19%   83.18%   -0.01%     
==========================================
  Files         247      247              
  Lines       26814    26817       +3     
==========================================
+ Hits        22308    22309       +1     
- Misses       4506     4508       +2     
Flag Coverage Δ
5.10-c5n.metal 83.64% <ø> (ø)
5.10-m5n.metal 83.63% <ø> (ø)
5.10-m6a.metal 82.84% <ø> (-0.01%) ⬇️
5.10-m6g.metal 79.61% <81.81%> (-0.01%) ⬇️
5.10-m6i.metal 83.61% <ø> (-0.01%) ⬇️
5.10-m7g.metal 79.61% <81.81%> (-0.01%) ⬇️
6.1-c5n.metal 83.64% <ø> (-0.01%) ⬇️
6.1-m5n.metal 83.63% <ø> (ø)
6.1-m6a.metal 82.83% <ø> (ø)
6.1-m6g.metal 79.61% <81.81%> (-0.01%) ⬇️
6.1-m6i.metal 83.62% <ø> (+<0.01%) ⬆️
6.1-m7g.metal 79.61% <81.81%> (-0.01%) ⬇️

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.

If CPU caching information is missing, this change allows the jailer to
still continue, and fall through to the validation logic in firecracker.

Signed-off-by: Gudmundur Bjarni Olafsson <[email protected]>
@gudmundur gudmundur force-pushed the fix-jailer-partial-cpu-cache-info-crash branch from f1705c7 to 426b027 Compare March 7, 2025 08:32
@roypat roypat added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Mar 7, 2025
@ShadowCurse ShadowCurse merged commit 8da9fc9 into firecracker-microvm:main Mar 7, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants