mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
offload_daemon: Add --ondemand restore mode
Add an --ondemand flag to the offload daemon's restore subcommand to support the post-copy mechanism from the live migration protocol. In on-demand mode, the daemon creates empty memfds to back the guest memory and sends them over to the VMM. This lets the VM start quickly, right after the memfds are mapped into CH's address space. At runtime, when the guest accesses a page (or the prefault handler requests it), the daemon faults it in by copying the page content into its shared memory mapping, then replies to the PageFault request so the VMM can consider the page present. Signed-off-by: Sebastien Boeuf <sboeuf@meta.com> Assisted-by: Claude:claude-opus-4-7
This commit is contained in:
@@ -213,6 +213,25 @@ migration today.
|
||||
--resume
|
||||
```
|
||||
|
||||
### On demand restore usage
|
||||
|
||||
For speeding up a VM restore, the daemon's `--ondemand` mode hands CH
|
||||
empty memfds and serves page contents on demand via userfaultfd.
|
||||
|
||||
This requires `memory_mode=postcopy` on the receive-migration call so CH
|
||||
registers userfaultfd on the memfds before resuming vCPUs and keeps
|
||||
the daemon's socket open for `PageFault` requests:
|
||||
|
||||
```bash
|
||||
./ch-remote --api-socket /tmp/cloud-hypervisor.sock \
|
||||
receive-migration receiver_url=unix:/tmp/restore.sock,memory_mode=postcopy &
|
||||
|
||||
./offload_daemon restore \
|
||||
--socket /tmp/restore.sock \
|
||||
--input-dir /var/snapshots/vm1 \
|
||||
--resume --ondemand
|
||||
```
|
||||
|
||||
### The daemon protocol
|
||||
|
||||
The daemon implements the local live-migration wire protocol defined in
|
||||
|
||||
Reference in New Issue
Block a user