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

[RFC] Save/restore state design proposal #118

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lauralt
Copy link
Contributor

@lauralt lauralt commented Sep 1, 2021

No description provided.

@lauralt lauralt changed the title Save/restore state design proposal [RFC] Save/restore state design proposal Sep 1, 2021
@jiangliu
Copy link
Member

jiangliu commented Sep 7, 2021

That means we need to move versionize crate to rust vmm, and get an agreement about data structures versions?

@lauralt
Copy link
Contributor Author

lauralt commented Sep 7, 2021

Moving the versionize crate to rust-vmm shouldn't be required, but yes we will need to get an agreement on the structures versions. Other option would be to not have the explicit versionize support in rust-vmm crates, and let the VMMs define their own Versionize structures.

@jiangliu
Copy link
Member

jiangliu commented Sep 9, 2021

Moving the versionize crate to rust-vmm shouldn't be required, but yes we will need to get an agreement on the structures versions. Other option would be to not have the explicit versionize support in rust-vmm crates, and let the VMMs define their own Versionize structures.

It's not easy to cooperate several vmms about the data structure versioning.

@jiangliu
Copy link
Member

As we have offline discussed with @lauralt, the major challenge is to cooperate on the data structure version numbering. One possible solution is:

  1. Each library crate defines version numbers for its data structures
  2. the app consolidates all data version numbers of library crates into an app version number
  3. create companion xxx-state crate library crate xxx. The clients may choose to use the upstream xxx-state crate or implement its own version. This also avoids dependency explosion for clients not using the capability.
  4. it would be better to move versionize crate into rust-vmm project.

lauralt added a commit to lauralt/vm-superio that referenced this pull request Sep 13, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
@lauralt
Copy link
Contributor Author

lauralt commented Sep 13, 2021

@jiangliu thanks! I just opened a PR with the RtcState implementation to better showcase the proposal.

lauralt added a commit to lauralt/vm-superio that referenced this pull request Sep 15, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
lauralt added a commit to lauralt/vm-superio that referenced this pull request Sep 16, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
lauralt added a commit to lauralt/vm-superio that referenced this pull request Sep 16, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
@liuw
Copy link
Member

liuw commented Sep 17, 2021

How do you plan to enforce this standard to all the components? Is there a way to mechanically generate the required code snippets?

I was hoping you introduced some traits that all components must implement to conform to the standard, which also enables programmatically dealing with states from VMM's point of view, like looping through a list of trait objects to retrieve or set their states. But looking at the example PR it looks manual and bespoke to each component.

@russell-islam
Copy link

What happens if the contents in the states are different across hypervisors for example KVM states are a little bit different than Microsoft Hypervisor?

@lauralt
Copy link
Contributor Author

lauralt commented Sep 20, 2021

How do you plan to enforce this standard to all the components? Is there a way to mechanically generate the required code snippets?

I was hoping you introduced some traits that all components must implement to conform to the standard, which also enables programmatically dealing with states from VMM's point of view, like looping through a list of trait objects to retrieve or set their states. But looking at the example PR it looks manual and bespoke to each component.

I'm not sure it is possible to programmatically enforce this standard, I assume even if we'd add a trait, the component would still not be forced to implement it.
We didn't start with adding a state trait for simplicity reasons. But we can do that later when we find it necessary/useful (maybe for virtio objects). The current proposal is just a starting point.

@liuw
Copy link
Member

liuw commented Sep 20, 2021

How do you plan to enforce this standard to all the components? Is there a way to mechanically generate the required code snippets?
I was hoping you introduced some traits that all components must implement to conform to the standard, which also enables programmatically dealing with states from VMM's point of view, like looping through a list of trait objects to retrieve or set their states. But looking at the example PR it looks manual and bespoke to each component.

I'm not sure it is possible to programmatically enforce this standard, I assume even if we'd add a trait, the component would still not be forced to implement it.

Exactly. I think the only way to "force" the adoption is to have a nice framework that provides a lot of goodies when you implement those traits.

We didn't start with adding a state trait for simplicity reasons. But we can do that later when we find it necessary/useful (maybe for virtio objects). The current proposal is just a starting point.

Sure. This sounds fair.

@lauralt
Copy link
Contributor Author

lauralt commented Sep 20, 2021

What happens if the contents in the states are different across hypervisors for example KVM states are a little bit different than Microsoft Hypervisor?

Hmm, I think this one belongs to the broader discussion of how the interfaces will look like in vm-vcpu. We can decide at that point where/how to define the state and the setter/getter for it. I can't think of any blocker with the current proposal for the vcpu use case, but maybe I am missing something.

lauralt added a commit to lauralt/vm-superio that referenced this pull request Sep 24, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
lauralt added a commit to lauralt/vm-superio that referenced this pull request Sep 24, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
lauralt added a commit to lauralt/vm-superio that referenced this pull request Oct 4, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
lauralt added a commit to lauralt/vm-superio that referenced this pull request Oct 4, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
lauralt added a commit to rust-vmm/vm-superio that referenced this pull request Oct 5, 2021
RtcState represents the state of the Rtc device, and
is storing the state needed for restoring the device
(no implementation detailis). The generic `events`
object is not stored due to complexity reasons.
More details in the design proposal:
rust-vmm/community#118.

Signed-off-by: Laura Loghin <[email protected]>
@lauralt lauralt mentioned this pull request Mar 4, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants