You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 our 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]>
0 commit comments