-
Notifications
You must be signed in to change notification settings - Fork 74
Support for serializing/deserializing KVM state #24
Comments
@alexandruag can you talk about the proxy solution you had in mind for handling serialization? |
This can be simply tackled through a Rust feature gate. This way, any project which does not expect to serialize these structures does not have to pay the price.
The point for a consumer of this crate is to go entirely through it, so that it does not have to manage any of the "real" structures. Globally, I'm not a fan of growing more and more crates. I'd be in favor of actually merging |
This can have an easy fix by creating a kvm workspace with both kvm-bindings and kvm-ioctls in there. In any case, kvm-ioctls only supports one version of kvm-bindings, so having them both in the same repository makes sense to me.
I don't think that separating state from the serialization of the state is fixing problems for every possible project. Again, I think it is better to look at how the proxy would work in practice before we go on the path with having serialization directly on structures. |
Cool :)
In a way it is because looking only at the current consumers, they all expect serialization and to rely on
Problem with this approach is that everything takes time. I'm sure @alexandruag will come up with a nice idea, but how long will it take until we can get this merged and actually used. It's okay if everything's not perfect at first, the improvement with this proxy crate can come later, but again the most important is that all project can share the kvm-bindings crate as soon as possible. |
I just created an issue to track this: rust-vmm/community#98 |
@andreeaflorescu @alexandruag One more thing, (when) are you planning to push |
Hi everyone! Sorry for being late in the day to the discussion. I also support the separation point of view, and the thing I'm working on should be ready for review (or I'll be convinced it doesn't work :D) by Monday. Let's have a look then and see what everybody thinks. Does that sound good? Regarding the last question from Sebastien, I consider |
Sounds good!
I think until the crate stays under the firecracker organization, it's gonna be hard to get |
Hi all! I've completed a prototype for the versionize-by-proxy approach. It's available as a PR (so it's easier to comment etc.) in a Firecracker fork for now. Here's a quick rundown of the three commits in there:
I like the approach where the conversion is done using a separate crate because it completely separates any serialization-related concerns from the main bindings crate. In particular, it prevents feature creep (library crates that depend on bindings - i.e. something like cpuid in the future - would most likely have to have additional features themselves to control the way the import the bindings). It's interesting to discuss the implications of each approach, but for now I am looking forward to any first impressions related to the above. In terms of initial measurements, the |
Hi all, I've looked at the versionize-by-proxy approach and it looks good, cool engineering, but I might be missing some info to understand the big picture and why it is necessary (at least in the case of The PR brings ~3k new lines to maintain with the sole purpose to shadow/redefine existing structs and define subtle mechanisms with arguably brittle safety to transform between the From my (limited) point of view the two options and their trade-offs for
The same question should be asked for all crates that define any data required to be serialized/versioned. For example. in high-level crates that implement mostly functionality and very little state the data above might be seen differently. From my understanding Firecracker, Cloud-Hypervisor and Alibaba's project all want versioned serialization and they're all interested in/committed to using While this PoC is great, I want to understand the trade-offs we're considering here and what is the ultimate goal we're pursuing. |
I'm not gonna repeat what @acatangiu said, cause I agree with everything :) /cc @rbradford |
@alexandruag It's very cool what you've demonstrated from a technical perspective I think we should be put the serialization/versionization inside kvm-bindings as all current users want it. If a future, hypothetical user doesn't want it then they can turn it off, fork or regenerate the bindings. The added cost of maintaining the extra crate and size/complexity impact is not worthwhile for a hypothetical situation. |
The PoC looks good @alexandruag . I understand the point you want to make by keeping the bindings/ioctls crates clean to work around "feature creep". So I am thinking about what is gained and what is lost for both rust-vmm and it's users if we choose to use the proxy or not. With everything else being fine I am not sure that adding extra complexity/maintenance requirements is the right thing to do this early. Looking at the comments of other people it looks like they want to keep things simple and incrementally evolve the current implementation by working backwards from future usecases/issues as they come up. |
Hi folks! Apologies for the delayed reply, and thanks for looking at the proposal. We're all looking at some options & next steps and will circle back to the thread. |
Taking into consideration the discussions on this thread, it looks that folks are inclined towards an approach that fixes the problem for the immediately interested users as opposed to considering the additional steps to achieve separation of concerns. With this in mind, we would like to propose the following course of action and focus on two directions aiming at solving the needs of current customers (Alibaba, CH, Firecracker) in the short term, while finding the best approach for the rust-vmm project in the long run.
From a separation perspective, kvm-bindings is what we consider a low level API, while serialization is an application specific concern. I believe this is not so easy to see due to the current dynamics of rust-vmm, as the active community consists mainly of developers from Firecracker, Cloud Hypervisor, and Alibaba, products that all plan to use a similar form of serialization. Are people onboard with the general idea and the course of action? |
Apology for the delay:( And eventually I have time to go over the versionize and the "Dummy PR for proxy bindings" PR. Last year we have tried a similar way as the proxy binding solution as a generic way to support live-upgrade. We have encountered several challenges.
Now we are planning to refactor based on the versionize crate due to the capability to support multiple versions of data structs. And we hope we could add a feature to the versionize crate to enable/disable generating versionized serde. But that way, we could avoid the cost to maintain separate proxy crates. FYI: |
Hi Gerry! Like you mention, for Having |
Sounds good!
We talked about adding rust feature to gate
Based on @alexandruag's PR and based on his feedback the major concerns are:
I totally get it, but the point is to be pragmatic by solving real problems first. It's very hard and time consuming to try to handle potential users and use cases that might never happen.
Yes :) |
Serialization support via an optional |
This issue can be used for discussing the approach we take when serializing kvm-bindings.
Some other discussion points here: #7
The text was updated successfully, but these errors were encountered: