hypervisor, vmm: Abstract the interfaces to start/stop dirty log

Following KVM interfaces, the `hypervisor` crate now provides interfaces
to start/stop the dirty pages logging on a per region basis, and asks
its users (e.g. the `vmm` crate) to iterate over the regions that needs
dirty pages log. MSHV only has a global control to start/stop dirty
pages log on all regions at once.

This patch refactors related APIs from the `hypervisor` crate to provide
a global control to start/stop dirty pages log (following MSHV's
behaviors), and keeps tracking the regions need dirty pages log for
KVM. It avoids leaking hypervisor-specific behaviors out of the
`hypervisor` crate.

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2021-07-26 12:33:02 -07:00
committed by Bo Chen
parent 2723995cfa
commit e7c9954dc1
4 changed files with 89 additions and 96 deletions

View File

@@ -879,13 +879,7 @@ impl vm::Vm for MshvVm {
///
/// Start logging dirty pages
///
fn start_dirty_log(
&self,
_slot: u32,
_guest_phys_addr: u64,
_memory_size: u64,
_userspace_addr: u64,
) -> vm::Result<()> {
fn start_dirty_log(&self) -> vm::Result<()> {
Err(vm::HypervisorVmError::StartDirtyLog(anyhow!(
"functionality not implemented"
)))
@@ -893,13 +887,7 @@ impl vm::Vm for MshvVm {
///
/// Stop logging dirty pages
///
fn stop_dirty_log(
&self,
_slot: u32,
_guest_phys_addr: u64,
_memory_size: u64,
_userspace_addr: u64,
) -> vm::Result<()> {
fn stop_dirty_log(&self) -> vm::Result<()> {
Err(vm::HypervisorVmError::StopDirtyLog(anyhow!(
"functionality not implemented"
)))