Skip to content

Commit 5603145

Browse files
author
Babis Chalios
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 <bchalios@amazon.es>
1 parent 0ef5e92 commit 5603145

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,23 @@ 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): Add
16+
support for the
17+
[VMClock device](https://uapi-group.org/specifications/specs/vmclock). The
18+
implementation supports the snapshot safety features proposed
19+
[here](https://lore.kernel.org/lkml/20260107132514.437-1-bchalios@amazon.es/).
20+
More information can be found in
21+
[docs](docs/snapshotting/snapshot-support.md#userspace-notifications-of-loading-virtual-machine-snapshots).
22+
1323
### Changed
1424

25+
- [#5564](https://github.com/firecracker-microvm/firecracker/pull/5564): which
26+
added support for VMClock, uses one extra GSI for the VMClock device itself
27+
which reduces the available GSIs for VirtIO devices. New maximum values is 93
28+
devices on Aarch64 and 17 devices on x86.
29+
1530
### Deprecated
1631

1732
### Removed

docs/snapshotting/snapshot-support.md

Lines changed: 36 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,41 @@ 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
597+
([specification](https://uapi-group.org/specifications/specs/vmclock/)) is a
598+
device that enables efficient application clock synchronization against real
599+
wallclock time, for applications running inside Virtual Machines. VMCLock also
600+
takes care situations where there is some sort disruption happens to the clock.
601+
It handles these through fields in the
602+
[`vmlcock_abi`](https://uapi-group.org/specifications/specs/vmclock/#the-vmclock_abi-structure).
603+
Currently, it handles two cases:
604+
605+
1. Live migration through the `disruption_marker` field.
606+
1. Virtual machine snapshots through the `vm_generation_counter`.
607+
608+
Whenever a VM starts from a snapshot VMClock will present a new (different that
609+
what was previously stored) value in the `vm_generation_counter`. This happens
610+
in an atomic way, i.e. `vm_generation_counter` will include the new value as
611+
soon as vCPUs are resumed post snapshot loading.
612+
613+
User space libraries, e.g. userspace PRNGs can mmap() `vmclock_abi` and monitor
614+
changes in `vm_generation_counter` to observe when they need to adapt and/or
615+
recreate state.
616+
617+
Moreover, VMClock allows processes to call poll() on the VMClock device and get
618+
notified about changes through an event loop.
619+
620+
> [!IMPORTANT] Support for `vm_generation_counter` and `poll()` is implemented
621+
> in Linux through the patches
622+
> [here](https://lore.kernel.org/lkml/20260107132514.437-1-bchalios@amazon.es/).
623+
> We have backported these patches for AL kernels
624+
> [here](../../resources/patches/vmclock) 5.10 and 6.1 kernels. Using the
625+
> kernels suggested from the [Getting Started Guide](../getting-started.md)
626+
> includes these patches. When using mainline kernels users need to make sure
627+
> that they apply the linked patches, until these get merged upstream.
628+
593629
## Vsock device reset
594630
595631
The vsock device is reset across snapshot/restore to avoid inconsistent state

0 commit comments

Comments
 (0)