Skip to content

Commit 511e78c

Browse files
committed
fix(doc): Improve accurancy of snapshot documentation
Fix various minor errors: - Drop some specifics on the cgroups v1 disclaimer, because all supported host kernel versions are "5.4+" - Do not claim that creating a snapshot has no effect on the running VM, because that's not true. - Cut down on some repeated and confusing information / examples near the end. Signed-off-by: Patrick Roy <[email protected]>
1 parent 3d1fba7 commit 511e78c

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed

docs/snapshotting/snapshot-support.md

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ the feature can be combined with guest_memfd support in Firecracker.
122122

123123
### Limitations
124124

125-
- High snapshot latency on 5.4+ host kernels due to cgroups V1. We strongly
125+
- High snapshot restoration latency when cgroups V1 are in use. We strongly
126126
recommend to deploy snapshots on cgroups V2 enabled hosts for the implied
127127
kernel versions -
128128
[related issue](https://github.com/firecracker-microvm/firecracker/issues/2129).
@@ -145,10 +145,10 @@ the feature can be combined with guest_memfd support in Firecracker.
145145
resumed from snapshot load memory on-demand from the snapshot and
146146
copy-on-write to anonymous memory.
147147
- Resuming from a snapshot is optimized for speed, while taking a snapshot
148-
involves some extra CPU cycles for synchronously writing dirty memory pages to
149-
the memory snapshot file. Taking a snapshot of a fresh microVM, on which dirty
150-
pages tracking is not enabled, results in the full contents of guest memory
151-
being written to the snapshot.
148+
involves some extra CPU cycles for synchronously writing memory pages to the
149+
memory snapshot file. Taking a full snapshot of a microVM results in the full
150+
contents of guest memory being written to the snapshot, and particularly, in
151+
all guest memory being faulted in.
152152
- The _memory file_ and _microVM state file_ are generated by Firecracker on
153153
snapshot creation. The disk contents are _not_ explicitly flushed to their
154154
backing files.
@@ -355,10 +355,12 @@ Enabling this support enables KVM dirty page tracking, so it comes at a cost
355355
(which consists of CPU cycles spent by KVM accounting for dirtied pages); it
356356
should only be used when needed.
357357

358-
Creating a snapshot will **not** influence state, will **not** stop or end the
359-
microVM, it can be used as before, so the microVM can be resumed if you still
360-
want to use it. At this point, in case you plan to continue using the current
361-
microVM, you should make sure to also copy the disk backing files.
358+
Creating a snapshot has some minor effects on the currently running microVM:
359+
360+
- The vsock device is [reset](#vsock-device-reset), causing the driver to
361+
terminate connection on resumption.
362+
- On x86_64, a notification for KVM-clock is injected to notify the guest about
363+
being paused.
362364

363365
### Resuming the microVM
364366

@@ -383,8 +385,8 @@ ignored (microVM remains in the running state). **Effects**:
383385
### Loading snapshots
384386

385387
If you want to load a snapshot, you can do that only **before** the microVM is
386-
configured (the only resources that can be configured prior are the Logger and
387-
the Metrics systems) by sending the following API command:
388+
configured (the only resources that can be configured prior are the logger and
389+
the metrics systems) by sending the following API command:
388390

389391
```bash
390392
curl --unix-socket /tmp/firecracker.socket -i \
@@ -471,28 +473,10 @@ to the new Firecracker process as they were to the original one.
471473
- _on failure_: A specific error is reported and then the current Firecracker
472474
process is ended (as it might be in an invalid state).
473475

474-
*Notes*: Please, keep in mind that only by setting to true
475-
`enable_diff_snapshots`, when loading a snapshot, or `track_dirty_pages`, when
476-
configuring the machine on a fresh microVM, you can then create a `diff`
477-
snapshot. Also, `track_dirty_pages` is not saved when creating a snapshot, so
478-
you need to explicitly set `enable_diff_snapshots` when sending
479-
`LoadSnapshot`command if you want to be able to do diff snapshots from a loaded
480-
microVM. Another thing that you should be aware of is the following: if a fresh
481-
microVM can create diff snapshots, then if you create a **full** snapshot, the
482-
memory file contains the whole guest memory, while if you create a **diff** one,
483-
that file is sparse and only contains the guest dirtied pages. With these in
484-
mind, some possible snapshotting scenarios are the following:
485-
486-
- `Boot from a fresh microVM` -> `Pause` -> `Create snapshot` -> `Resume` ->
487-
`Pause` -> `Create snapshot` -> ... ;
488-
- `Boot from a fresh microVM` -> `Pause` -> `Create snapshot` -> `Resume` ->
489-
`Pause` -> `Resume` -> ... -> `Pause` -> `Create snapshot` -> ... ;
490-
- `Load snapshot` -> `Resume` -> `Pause` -> `Create snapshot` -> `Resume` ->
491-
`Pause` -> `Create snapshot` -> ... ;
492-
- `Load snapshot` -> `Resume` -> `Pause` -> `Create snapshot` -> `Resume` ->
493-
`Pause` -> `Resume` -> ... -> `Pause` -> `Create snapshot` -> ... ; where
494-
`Create snapshot` can refer to either a full or a diff snapshot for all the
495-
aforementioned flows.
476+
*Notes*: The `track_dirty_pages` configuration is not saved when creating a
477+
snapshot, so you need to explicitly set `track_dirty_pages` again when sending
478+
the `LoadSnapshot` command if you want to be able to do dirty page tracking
479+
based diff snapshots from a loaded microVM.
496480

497481
It is also worth knowing, a microVM that is restored from snapshot will be
498482
resumed with the guest OS wall-clock continuing from the moment of the snapshot

0 commit comments

Comments
 (0)