hypervisor, vmm: Add dynamic control of logging dirty pages

This patch extends slightly the current live-migration code path with
the ability to dynamically start and stop logging dirty-pages, which
relies on two new methods added to the `hypervisor::vm::Vm` Trait. This
patch also contains a complete implementation of the two new methods
based on `kvm` and placeholders for `mshv` in the `hypervisor` crate.

Fixes: #2858

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2021-07-21 19:16:30 -07:00
committed by Bo Chen
parent a33280b8ad
commit 5e0d498582
6 changed files with 144 additions and 5 deletions

View File

@@ -877,6 +877,34 @@ impl vm::Vm for MshvVm {
Ok(())
}
///
/// Start logging dirty pages
///
fn start_dirty_log(
&self,
_slot: u32,
_guest_phys_addr: u64,
_memory_size: u64,
_userspace_addr: u64,
) -> vm::Result<()> {
Err(vm::HypervisorVmError::StartDirtyLog(anyhow!(
"functionality not implemented"
)))
}
///
/// Stop logging dirty pages
///
fn stop_dirty_log(
&self,
_slot: u32,
_guest_phys_addr: u64,
_memory_size: u64,
_userspace_addr: u64,
) -> vm::Result<()> {
Err(vm::HypervisorVmError::StopDirtyLog(anyhow!(
"functionality not implemented"
)))
}
///
/// Get dirty pages bitmap (one bit per page)
///
fn get_dirty_log(&self, _slot: u32, _memory_size: u64) -> vm::Result<Vec<u64>> {