You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
microVM: write back dirty shared-mapping pages of host shares before every capture #555
A restored guest continues with captured memory, including the guest page cache. The microVM virtio-fs device grants shared mappings of direct-I/O files, which the guest kernel requests (Linux 6.6 and newer; the guest kernel is 6.18), so pages of shared memory mappings of files in a live host share are cached in guest RAM and written back to the host through ordinary write requests (section 3.6.1 of the architecture guide in #529).
Only a capture with paired scratch writes dirty pages back before the boundary: guest/common/nvx-snapshot runs sync after it freezes the workload cgroup, and only in that case. A blockless capture or a fresh-scratch capture leaves dirty shared-mapping pages in captured memory. After a restore, the guest kernel writes those pages back to the live host file, overwriting any change that the host made to the same range since the capture. Every restore of one snapshot attaches the same live host files, so every clone writes the same capture-time pages back to one host file.
The architecture guide now describes this exception in 3.6.8 and 3.6.9; this issue tracks removing the hazard.
Intended behavior
Every capture writes back the dirty pages of shared mappings on the host shares before the boundary, so a snapshot carries no unwritten file data for a live host file, and no restore writes capture-time data back to one.
Options
Have the guest agents write back dirty file pages before every capture that has a live host share, for example with syncfs on the host-share mounts, after they stop the workload from dirtying further pages.
Have the device refuse capture while the guest holds dirty shared-mapping pages of a live share; the device cannot observe them, so this needs a guest-side check.
Tasks
Write back dirty shared-mapping pages of the host shares before every capture, not only paired-scratch captures, and define how a workload is kept from dirtying pages between the write-back and the boundary when it is not frozen.
Add coverage: a workload that dirties a shared mapping of a live share before a blockless capture, and a restore that must not write capture-time data back to the host file.
Activity