-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add snapsafety features to VMClock device #5564
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
10a46fd
vmclock ABI: add snapshot safety features
bchalios 4edbaa6
vmclock: add snapshot safety features
bchalios d98a6db
vmclock: test snapshot safety features
bchalios cc3c484
vmclock: add support for Aarch64
bchalios 22cf4c2
test(vmclock): enable skipped tests
bchalios 750a496
docs: add documentation and CHANGELOG entry for VMClock
bchalios File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,24 @@ and this project adheres to | |
|
|
||
| ### Added | ||
|
|
||
| - [#5510](https://github.com/firecracker-microvm/firecracker/pull/5510), | ||
| [#5593](https://github.com/firecracker-microvm/firecracker/pull/5593), | ||
| [#5564](https://github.com/firecracker-microvm/firecracker/pull/5564): Add | ||
| support for the | ||
| [VMClock device](https://uapi-group.org/specifications/specs/vmclock). The | ||
| implementation supports the snapshot safety features proposed | ||
| [here](https://lore.kernel.org/lkml/[email protected]/), | ||
| but doesn't provide currently any clock-specific information for helping the | ||
| guest synchronize its clocks. More information can be found in | ||
| [docs](docs/snapshotting/snapshot-support.md#userspace-notifications-of-loading-virtual-machine-snapshots). | ||
|
|
||
| ### Changed | ||
|
|
||
| - [#5564](https://github.com/firecracker-microvm/firecracker/pull/5564): which | ||
| added support for VMClock, uses one extra GSI for the VMClock device itself | ||
| which reduces the available GSIs for VirtIO devices. New maximum values is 92 | ||
| devices on Aarch64 and 17 devices on x86. | ||
|
|
||
| ### Deprecated | ||
|
|
||
| ### Removed | ||
|
|
||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| - [Snapshot security and uniqueness](#snapshot-security-and-uniqueness) | ||
| - [Secure and insecure usage examples](#usage-examples) | ||
| - [Reusing snapshotted states securely](#reusing-snapshotted-states-securely) | ||
| - [Userspace notifications of loading Virtual Machine snapshots](#userspace-notifications-of-loading-virtual-machine-snapshots) | ||
| - [Vsock device limitation](#vsock-device-limitation) | ||
| - [VMGenID device limitation](#vmgenid-device-limitation) | ||
| - [Where can I resume my snapshots?](#where-can-i-resume-my-snapshots) | ||
|
|
@@ -590,6 +591,41 @@ identifiers, cached random numbers, cryptographic tokens, etc **will** still be | |
| replicated across multiple microVMs resumed from the same snapshot. Users need | ||
| to implement mechanisms for ensuring de-duplication of such state, where needed. | ||
|
|
||
| ## Userspace notifications of loading Virtual Machine snapshots | ||
|
|
||
| VMClock device | ||
| ([specification](https://uapi-group.org/specifications/specs/vmclock/)) is a | ||
| device that enables efficient application clock synchronization against real | ||
| wallclock time, for applications running inside Virtual Machines. VMCLock also | ||
| takes care situations where there is some sort disruption happens to the clock. | ||
| It handles these through fields in the | ||
| [`vmlcock_abi`](https://uapi-group.org/specifications/specs/vmclock/#the-vmclock_abi-structure). | ||
| Currently, it handles two cases: | ||
|
|
||
| 1. Live migration through the `disruption_marker` field. | ||
| 1. Virtual machine snapshots through the `vm_generation_counter`. | ||
|
|
||
| Whenever a VM starts from a snapshot VMClock will present a new (different that | ||
| what was previously stored) value in the `vm_generation_counter`. This happens | ||
| in an atomic way, i.e. `vm_generation_counter` will include the new value as | ||
| soon as vCPUs are resumed post snapshot loading. | ||
|
|
||
| User space libraries, e.g. userspace PRNGs can mmap() `vmclock_abi` and monitor | ||
| changes in `vm_generation_counter` to observe when they need to adapt and/or | ||
| recreate state. | ||
|
|
||
| Moreover, VMClock allows processes to call poll() on the VMClock device and get | ||
| notified about changes through an event loop. | ||
|
|
||
| > [!IMPORTANT] Support for `vm_generation_counter` and `poll()` is implemented | ||
| > in Linux through the patches | ||
| > [here](https://lore.kernel.org/lkml/[email protected]/). | ||
| > We have backported these patches for AL kernels | ||
| > [here](../../resources/patches/vmclock) 5.10 and 6.1 kernels. Using the | ||
| > kernels suggested from the [Getting Started Guide](../getting-started.md) | ||
| > includes these patches. When using mainline kernels users need to make sure | ||
| > that they apply the linked patches, until these get merged upstream. | ||
|
|
||
| ## Vsock device reset | ||
|
|
||
| The vsock device is reset across snapshot/restore to avoid inconsistent state | ||
|
|
||
This file contains hidden or 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
Binary file not shown.
Binary file not shown.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.