-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade kvm-bindings to 0.8.0
Upgrade kvm-bindings to 0.8.0 to make use of upstream serialization support. New kvm-bindings no longer derives `Clone` on `kvm_xsave` (since this is not correct to do for all use cases post Linux 5.17, due to the structure now having a flexible array members). While Firecracker does not make use of this flexible array members (according to KVM documentation, it will only be present if `arch_prctl` is used [1]), meaning our usage of `Clone` was not problematic, it's easier for now to just clean up our use-sites of `kvm_xsave::clone` (which was only used in test code) - turns out they were either dead code, or should be replaced with successive calls to `save_state()`. Additionally, `VcpuFd::run` now takes `self` by mutable reference, which is the reason for the preceding refactors. The result of `run` holds references into the `kvm_run` structure contained by `VcpuFd`, meaning the mutable borrow on `Vcpu::fd` will stay alive until the return value is dropped. However, if the call to `run` is behind a function call that takes the entirety of `Vcpu` by mutable reference, this means that we cannot borrow any other fields of `Vcpu` mutably until we drop the `VcpuExit` - yet we need to do exactly this to actually handle the KVM_EXIT. So, instead inline the call to `run` so that the borrow checker understand we only borrow `Vcpu::fd` instead of the entire `Vcpu` object, meaning it allows us to access the _other_ fields of the `Vcpu` struct during handling. [1]: https://docs.kernel.org/virt/kvm/api.html#kvm-get-xsave2 Signed-off-by: Patrick Roy <[email protected]>
- Loading branch information
Showing
8 changed files
with
19 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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