lib: implement reference TSC enlightenment#856
Conversation
jordanhendricks
left a comment
There was a problem hiding this comment.
initial pass; want to learn a bit more about this feature in depth and I'll take another one
78057ac to
2e8e741
Compare
24be46e to
c450002
Compare
a5dd761 to
9b3c294
Compare
|
I've rebased this to the latest master. This was unfortunately a bit of a mess, because #861 obsoleted a fair amount of the migration logic that was present previously. It may help to look at just the last five commits to get a sense of what's actually changed (beyond merge conflict resolutions during the rebase). Now that the Hyper-V stack doesn't migrate overlay page contents directly, it needs to be more careful to ensure that it generates TSC overlays that are based on the correct guest frequency. The challenges here are
Most of the new code involves a new EDIT: Things that blessedly did not change are the reference TSC page's contents (and the math we use to compute them) and the new PHD tests. |
hawkw
left a comment
There was a problem hiding this comment.
Hm, the introduction of the Uninitialized state etc is not my favorite thing, but I agree that this is necessary due to the changes to how we migrate overlays, and I can't think up a solution that avoids it. This seems good to me!
iximeow
left a comment
There was a problem hiding this comment.
more nits about the panics :) seems good, very excited for this!
9b3c294 to
736e595
Compare
|
Thanks for re-reviewing! ae5cfac should take care of the latest batch of comments. |
hawkw
left a comment
There was a problem hiding this comment.
new commentary looks lovely, thank you!
| /// The caller must call [`attach`] to finish initializing this | ||
| /// enlightenment stack before starting any VM components that depend on it. | ||
| /// Otherwise the stack may panic while the VM is running. |
There was a problem hiding this comment.
mmmmmaybe this ought to have a big leading "WARNING:" on it? not a big deal though.
| self.vmm_hdl.get().unwrap() | ||
| self.vmm_hdl.get().expect( | ||
| "a fully-initialized Hyper-V enlightenment always has a \ | ||
| VMM handle (did the library user remember to call `attach`?)", |
Add a Hyper-V reference time enlightenment to the Hyper-V stack. See the new
tscmodule's doc comment for details about how the enlightenment operates.Add PHD tests that try to verify both that the enlightenment is present (by querying the current clocksource) and that it keeps time roughly correctly (by comparing host and guest time readings). The latter test also takes readings over a migration to help get some coverage of the time data phase of live migration (though the migration is not currently cross-machine, so this is a little less interesting than it might otherwise be).
Tests: cargo test; PHD w/Alpine, Debian 11, WS2022 guests.
Fixes #328.