Skip to content

Commit 659ee91

Browse files
committed
docs: add documentation and CHANGELOG entry for VMClock
Mention support for VMClock and give pointers that required patches for snapshot safety support. Signed-off-by: Babis Chalios <[email protected]>
1 parent 7e9ee11 commit 659ee91

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ and this project adheres to
1010

1111
### Added
1212

13+
- [#5510](https://github.com/firecracker-microvm/firecracker/pull/5510),
14+
[#5593](https://github.com/firecracker-microvm/firecracker/pull/5593),
15+
[#5564](https://github.com/firecracker-microvm/firecracker/pull/5564):
16+
Add support for the [VMClock device](https://uapi-group.org/specifications/specs/vmclock).
17+
The implementation supports the snapshot safety features proposed
18+
[here](https://lore.kernel.org/lkml/[email protected]/).
19+
More information can be found in [docs](docs/snapshotting/snapshot-support.md#userspace-notifications-of-loading-virtual-machine-snapshots).
20+
1321
### Changed
1422

1523
### Deprecated

docs/snapshotting/snapshot-support.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- [Snapshot security and uniqueness](#snapshot-security-and-uniqueness)
2525
- [Secure and insecure usage examples](#usage-examples)
2626
- [Reusing snapshotted states securely](#reusing-snapshotted-states-securely)
27+
- [Userspace notifications of loading Virtual Machine snapshots](#userspace-notifications-of-loading-virtual-machine-snapshots)
2728
- [Vsock device limitation](#vsock-device-limitation)
2829
- [VMGenID device limitation](#vmgenid-device-limitation)
2930
- [Where can I resume my snapshots?](#where-can-i-resume-my-snapshots)
@@ -590,6 +591,38 @@ identifiers, cached random numbers, cryptographic tokens, etc **will** still be
590591
replicated across multiple microVMs resumed from the same snapshot. Users need
591592
to implement mechanisms for ensuring de-duplication of such state, where needed.
592593
594+
## Userspace notifications of loading Virtual Machine snapshots
595+
596+
VMClock device ([specification](https://uapi-group.org/specifications/specs/vmclock/))
597+
is a device that enables efficient application clock synchronization against
598+
real wallclock time, for applications running inside Virtual Machines. VMCLock
599+
also takes care situations where there is some sort disruption happens to the
600+
clock. It handles these through fields in the
601+
[`vmlcock_abi`](https://uapi-group.org/specifications/specs/vmclock/#the-vmclock_abi-structure).
602+
Currently, it handles two cases:
603+
1. Live migration through the `disruption_marker` field.
604+
1. Virtual machine snapshots through the `vm_generation_counter`.
605+
606+
Whenever a VM starts from a snapshot VMClock will present a new (different that
607+
what was previously stored) value in the `vm_generation_counter`. This happens
608+
in an atomic way, i.e. `vm_generation_counter` will include the new value as
609+
soon as vCPUs are resumed post snapshot loading.
610+
611+
User space libraries, e.g. userspace PRNGs can mmap() `vmclock_abi` and monitor
612+
changes in `vm_generation_counter` to observe when they need to adapt and/or
613+
recreate state.
614+
615+
Moreover, VMClock allows processes to call poll() on the VMClock device and get
616+
notified about changes through an event loop.
617+
618+
> [!IMPORTANT]
619+
> Support for `vm_generation_counter` and `poll()` is implemented in Linux through
620+
> the patches [here](https://lore.kernel.org/lkml/[email protected]/).
621+
> We have backported these patches for AL kernels [here](../../resources/patches/vmclock)
622+
> 5.10 and 6.1 kernels. Using the kernels suggested from the [Getting Started Guide](../getting-started.md)
623+
> includes these patches. When using mainline kernels users need to make sure that
624+
> they apply the linked patches, until these get merged upstream.
625+
593626
## Vsock device reset
594627
595628
The vsock device is reset across snapshot/restore to avoid inconsistent state

0 commit comments

Comments
 (0)