Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move arch specific Kvm code into modules #5098

Merged

Conversation

bchalios
Copy link
Contributor

@bchalios bchalios commented Mar 20, 2025

Changes

Follow up of the refactoring we did in the past around vstate/vm.rs, where we separate architecture specific code in modules, keeping only the arch-independent code in 'kvm.rs`

Moreover, move arch-specific code from vmm::vstate module under vmm::arch.

Reason

More readable code. No functional changes intended.

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.

Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 86.36364% with 30 lines in your changes missing coverage. Please review.

Project coverage is 83.13%. Comparing base (83a9a55) to head (97f9b29).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/vmm/src/arch/aarch64/vcpu.rs 83.23% 29 Missing ⚠️
src/vmm/src/arch/x86_64/kvm.rs 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5098      +/-   ##
==========================================
- Coverage   83.14%   83.13%   -0.02%     
==========================================
  Files         248      249       +1     
  Lines       26925    26937      +12     
==========================================
+ Hits        22388    22393       +5     
- Misses       4537     4544       +7     
Flag Coverage Δ
5.10-c5n.metal 83.51% <96.15%> (-0.03%) ⬇️
5.10-m5n.metal 83.51% <96.15%> (-0.01%) ⬇️
5.10-m6a.metal 82.70% <96.15%> (-0.02%) ⬇️
5.10-m6g.metal 79.56% <85.20%> (-0.01%) ⬇️
5.10-m6i.metal 83.50% <96.15%> (-0.02%) ⬇️
5.10-m7a.metal-48xl 82.70% <96.15%> (-0.01%) ⬇️
5.10-m7g.metal 79.56% <85.20%> (-0.01%) ⬇️
6.1-c5n.metal 83.56% <96.15%> (-0.03%) ⬇️
6.1-m5n.metal 83.56% <96.15%> (-0.01%) ⬇️
6.1-m6a.metal 82.75% <96.15%> (-0.01%) ⬇️
6.1-m6g.metal 79.56% <85.20%> (-0.01%) ⬇️
6.1-m6i.metal 83.56% <96.15%> (-0.01%) ⬇️
6.1-m7a.metal-48xl 82.75% <96.15%> (-0.01%) ⬇️
6.1-m7g.metal 79.56% <85.20%> (-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.

@bchalios bchalios force-pushed the arch_specific_code_in_modules branch 4 times, most recently from bff4a55 to 6e9a694 Compare March 20, 2025 13:56
roypat
roypat previously approved these changes Mar 24, 2025
Copy link
Contributor

@roypat roypat left a comment

Choose a reason for hiding this comment

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

would love to pick these commits up for the feature/secret-hiding branch!

@bchalios
Copy link
Contributor Author

bchalios commented Mar 24, 2025

would love to pick these commits up for the feature/secret-hiding branch!

I was planning to add more changes that include builder.rs as well. But, there's a lot of overlap with #4910 and, secondly, there's a lot more complexity there, so I'm happy to format these as a standalone PR.

In the long term, I was envisioning all of the arch specific code to go under vmm::arch. WDYT @roypat?

@roypat
Copy link
Contributor

roypat commented Mar 24, 2025

would love to pick these commits up for the feature/secret-hiding branch!

I was planning to add more changes that include builder.rs as well. But, there's a lot of overlap with #4910 and, secondly, there's a lot more complexity there, so I'm happy to format these as a standalone PR.

I think this on its own makes a lot of sense as a standalone PR :)

In the long term, I was envisioning all of the arch specific code to go under vmm::arch. WDYT @roypat?

Yeah, having them be centralized would be neat indeed

@bchalios bchalios force-pushed the arch_specific_code_in_modules branch 8 times, most recently from cea7cc9 to 236e4f0 Compare March 24, 2025 14:25
@bchalios bchalios marked this pull request as ready for review March 24, 2025 14:37
@bchalios bchalios self-assigned this Mar 24, 2025
@bchalios bchalios added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Mar 24, 2025
Follow up of the refactoring we did in the past around vstate/vm.rs,
where we separate architecture specific code in modules, keeping only
the arch-independent code in 'kvm/mod.rs'.

No functional changes intended.

Signed-off-by: Babis Chalios <[email protected]>
Move KVM architecture-specific code under the `vmm::arch` module, so
that we start having all architecture-specific code under a single
module.

Signed-off-by: Babis Chalios <[email protected]>
@bchalios bchalios force-pushed the arch_specific_code_in_modules branch from 236e4f0 to 2f86e4a Compare March 24, 2025 14:40
@bchalios bchalios enabled auto-merge (rebase) March 24, 2025 14:40
@bchalios bchalios force-pushed the arch_specific_code_in_modules branch 5 times, most recently from 2ce36a8 to b27df01 Compare March 25, 2025 09:58
@bchalios bchalios force-pushed the arch_specific_code_in_modules branch 2 times, most recently from d2448b5 to d70a297 Compare March 25, 2025 10:29
Move the rest of vstate architecture-specific code under `vmm::arch`.

Signed-off-by: Babis Chalios <[email protected]>
@bchalios bchalios force-pushed the arch_specific_code_in_modules branch from d70a297 to 97f9b29 Compare March 25, 2025 11:10
@bchalios bchalios merged commit 0f3e8b3 into firecracker-microvm:main Mar 25, 2025
6 of 7 checks passed
@bchalios bchalios deleted the arch_specific_code_in_modules branch March 25, 2025 12:55
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.

3 participants