-
Notifications
You must be signed in to change notification settings - Fork 123
feat: Add KVM Nested State support and upgrade to Rust edition 2024 #331
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
Open
SteelCrab
wants to merge
8
commits into
rust-vmm:main
Choose a base branch
from
SteelCrab:nested-state
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This type is a helper, making the use of get_nested_state() and set_nested_state(), which are added in a following commit, much more convenient. Note that this type's name uses UpperCamelCase as it is not just a plain old data type but actually contains some logic: the `size` field is properly initialized. Effectively, KVM expects a dynamic buffer with a header reporting the size to either store the nested state in or load it from. As such data structures with a certain alignment are challenging to work with (note that Vec<u8> always have an alignment of 1 but we need 4), this type sacrifices a little memory overhead in some cases for better UX; copying 8K once is cheap anyway. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
More info: https://docs.kernel.org/virt/kvm/api.html#capabilities-that-can-be-enabled-on-vcpus Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
These calls are relevant for live-migration and state save/resume when nested virtualization is used. I tested everything with a nested guest in Cloud Hypervisor, but these patches are not yet upstream. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit upgrades kvm-bindings from the default Rust edition 2015 to edition 2024, addressing the need for explicit unsafe blocks and proper module path resolution. Changes: - Add \`edition = \"2024\"\` to kvm-bindings/Cargo.toml - Wrap unsafe function calls in explicit unsafe blocks in bindings.rs - from_raw_parts, from_raw_parts_mut, transmute calls - Fix import paths in fam_wrappers.rs and nested.rs: - \`use x86_64::bindings::*\` → \`use crate::x86_64::bindings::*\` - Add explicit \`crate::\` prefix for module imports - Remove \`extern crate core;\` (automatic in edition 2024) All tests pass with no warnings. Fixes rust-vmm#329 Signed-off-by: SteelCrab <pyh5523@gmail.com>
- Fix import paths: use bindings:: → use crate::bindings:: - Resolve zerocopy trait conflicts for union types - Add comprehensive serde support for KVM structures - Fix cross-platform compilation for x86_64, ARM64, RISC-V64 - Ensure MUSL compatibility Signed-off-by: SteelCrab <pyh5523@gmail.com>
- Add safety comments for unsafe blocks to satisfy clippy - Fix test module imports with crate:: prefix Signed-off-by: SteelCrab <pyh5523@gmail.com>
Signed-off-by: SteelCrab <pyh5523@gmail.com>
- Add safety comments for unsafe blocks to satisfy clippy Signed-off-by: SteelCrab <pyh5523@gmail.com>
Hey @SteelCrab, sorrry, this isn't quite what I had in mind. The nested state stuff we'll merge through #322, so please don't include them in your PR. Instead please just start with the current |
Hey @SteelCrab, now that #322 is merged, can you rebase this on top of main? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds KVM Nested State functionality and upgrades the project to Rust edition 2024.
Changes
New Features
Infrastructure
Modified Components
Testing
Breaking Changes
None - all changes are additive and maintain backward compatibility.