vmm: fix KVM clock lost during restore form snapshot

Connecting a restored KVM clock vm will take long time, as clock
is NOT restored immediately after vm resume from snapshot.

this is because 9ce6c3b incorrectly remove vm_snapshot.clock, and
always pass None to new_from_memory_manager, which will result to
kvm_set_clock() never be called during restore from snapshot.

Fixes: 9ce6c3b
Signed-off-by: Ren Lei <ren.lei4@zte.com.cn>
This commit is contained in:
ren lei 2021-05-20 14:47:45 +08:00 committed by Sebastien Boeuf
parent 75ad89670b
commit 324c924ca4

View File

@ -498,7 +498,9 @@ impl Vm {
reset_evt: EventFd, reset_evt: EventFd,
seccomp_action: &SeccompAction, seccomp_action: &SeccompAction,
hypervisor: Arc<dyn hypervisor::Hypervisor>, hypervisor: Arc<dyn hypervisor::Hypervisor>,
#[cfg(feature = "kvm")] _saved_clock: Option<hypervisor::ClockData>, #[cfg(all(feature = "kvm", target_arch = "x86_64"))] _saved_clock: Option<
hypervisor::ClockData,
>,
activate_evt: EventFd, activate_evt: EventFd,
) -> Result<Self> { ) -> Result<Self> {
config config
@ -718,7 +720,7 @@ impl Vm {
reset_evt, reset_evt,
seccomp_action, seccomp_action,
hypervisor, hypervisor,
#[cfg(feature = "kvm")] #[cfg(all(feature = "kvm", target_arch = "x86_64"))]
None, None,
activate_evt, activate_evt,
)?; )?;
@ -783,8 +785,8 @@ impl Vm {
reset_evt, reset_evt,
seccomp_action, seccomp_action,
hypervisor, hypervisor,
#[cfg(feature = "kvm")] #[cfg(all(feature = "kvm", target_arch = "x86_64"))]
None, vm_snapshot.clock,
activate_evt, activate_evt,
) )
} }
@ -821,7 +823,7 @@ impl Vm {
reset_evt, reset_evt,
seccomp_action, seccomp_action,
hypervisor, hypervisor,
#[cfg(feature = "kvm")] #[cfg(all(feature = "kvm", target_arch = "x86_64"))]
None, None,
activate_evt, activate_evt,
) )