diff mbox

[natty,SRU] bug #1018440 - KVM domain restore reboots the domain instead

Message ID 4FEB3BF0.3050707@canonical.com
State New
Headers show

Commit Message

Chris J Arges June 27, 2012, 4:59 p.m. UTC
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

Comments

Tim Gardner June 27, 2012, 5:05 p.m. UTC | #1

Brad Figg June 27, 2012, 6:56 p.m. UTC | #2
On 06/27/2012 09:59 AM, Chris J Arges wrote:
> 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
> 
> 
> 
> 
>
Tim Gardner June 27, 2012, 7:02 p.m. UTC | #3

diff mbox

Patch

From b856e079671eb638ee3e78e0d83cc6462da1a575 Mon Sep 17 00:00:00 2001
From: Marcelo Tosatti <mtosatti@redhat.com>
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 <mtosatti@redhat.com>
Tested-by: Markus Schade <markus.schade@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
(cherry picked from commit 5233dd51ece1615d54ab96c4cbe9ac3cc595e955)

BugLink: http://launchpad.net/bugs/1018440

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 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