From patchwork Wed Jun 27 16:59:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [natty, SRU] bug #1018440 - KVM domain restore reboots the domain instead Date: Wed, 27 Jun 2012 06:59:28 -0000 From: Chris J Arges X-Patchwork-Id: 167718 Message-Id: <4FEB3BF0.3050707@canonical.com> To: Ubuntu Kernel Team BugLink: https://bugs.launchpad.net/bugs/1018440 == Natty SRU Justification == KVM domain restore reboots the domain instead, the reported uptime is incorrect. == Fix == Upstream patch : 5233dd51ece1615d54ab96c4cbe9ac3cc595e955 fixes the issue. This patch is present in Oneiric onwards. This patch only allows vmx_decache_cr3 to be run iff vcpu->arch.cr3 is stale. == Testcase == 1 Start a VM 2 let it accumulate some uptime; maybe start a background job 3 save or managedsave the VM and verify that it becomes "shut off" 4 restore or start the saved VM. 5 check uptime of VM and state of background job, if started. The uptime of the restored VM should represent the time it was up before being saved. It shows as being 0 since the VM gets rebooted Thanks, --chris j arges >From b856e079671eb638ee3e78e0d83cc6462da1a575 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Mon, 6 Jun 2011 14:27:47 -0300 Subject: [PATCH 2/2] KVM: VMX: do not overwrite uptodate vcpu->arch.cr3 on KVM_SET_SREGS Only decache guest CR3 value if vcpu->arch.cr3 is stale. Fixes loadvm with live guest. Signed-off-by: Marcelo Tosatti Tested-by: Markus Schade Signed-off-by: Avi Kivity (cherry picked from commit 5233dd51ece1615d54ab96c4cbe9ac3cc595e955) BugLink: http://launchpad.net/bugs/1018440 Signed-off-by: Chris J Arges --- arch/x86/kvm/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 3aad96c..51abe43 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1924,7 +1924,8 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0, unsigned long cr0, struct kvm_vcpu *vcpu) { - vmx_decache_cr3(vcpu); + if (!test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail)) + vmx_decache_cr3(vcpu); if (!(cr0 & X86_CR0_PG)) { /* From paging/starting to nonpaging */ vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, -- 1.7.9.5