From 324c924ca48dae5cde0e9bb9a3794a642833b78c Mon Sep 17 00:00:00 2001 From: ren lei Date: Thu, 20 May 2021 14:47:45 +0800 Subject: [PATCH] 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 --- vmm/src/vm.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index f7755ed69..d3e76823b 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -498,7 +498,9 @@ impl Vm { reset_evt: EventFd, seccomp_action: &SeccompAction, hypervisor: Arc, - #[cfg(feature = "kvm")] _saved_clock: Option, + #[cfg(all(feature = "kvm", target_arch = "x86_64"))] _saved_clock: Option< + hypervisor::ClockData, + >, activate_evt: EventFd, ) -> Result { config @@ -718,7 +720,7 @@ impl Vm { reset_evt, seccomp_action, hypervisor, - #[cfg(feature = "kvm")] + #[cfg(all(feature = "kvm", target_arch = "x86_64"))] None, activate_evt, )?; @@ -783,8 +785,8 @@ impl Vm { reset_evt, seccomp_action, hypervisor, - #[cfg(feature = "kvm")] - None, + #[cfg(all(feature = "kvm", target_arch = "x86_64"))] + vm_snapshot.clock, activate_evt, ) } @@ -821,7 +823,7 @@ impl Vm { reset_evt, seccomp_action, hypervisor, - #[cfg(feature = "kvm")] + #[cfg(all(feature = "kvm", target_arch = "x86_64"))] None, activate_evt, )