From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: Restoring saved guest causes guest to reboot Date: Thu, 26 May 2011 17:25:16 +0200 Message-ID: <20110526152516.GM23407@8bytes.org> References: <20110524094023.GI23407@8bytes.org> <20110524130208.GJ23407@8bytes.org> <4DDBB085.2010907@redhat.com> <4DDBB5D3.3020403@redhat.com> <4DDCA687.9080506@gmail.com> <4DDDF6D1.1070907@redhat.com> <4DDE3975.6020709@gmail.com> <4DDE6FC0.3010801@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org To: Markus Schade Return-path: Received: from 8bytes.org ([88.198.83.132]:55688 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756905Ab1EZPZS (ORCPT ); Thu, 26 May 2011 11:25:18 -0400 Content-Disposition: inline In-Reply-To: <4DDE6FC0.3010801@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, May 26, 2011 at 05:20:32PM +0200, Markus Schade wrote: > On 05/26/2011 01:28 PM, Markus Schade wrote: >> On 05/26/2011 08:44 AM, Avi Kivity wrote: >>> On 05/25/2011 09:49 AM, Markus Schade wrote: >>>> >>>> Git bisect tells me that this is the first bad commit: >>>> -----------------%<----------------- >>>> aff48baa34c033318ad322ecbf2e4bcd891b29ca is the first bad commit >>> >>> Does your machine have ept? >>> >>> (cat /sys/module/kvm_intel/parameters/ept) >>> >> >> Sure. (Assuming that the Y means yes). I am no C developer, but I was >> wondering, if the issue is related to the difference in >> ept_update_paging_mode_cr0 between original patch in the kvm git and the >> linux-2.6. git tree. > > I have re-added the missing 4 lines to ept_update_paging_mode_cr0 in > vmx.c, which resolves this issue for in Kernel 2.6,37 and 2.6.39. > I haven't tested all guests, but neither Squeeze nor 2008 R2 reboot anymore. > > Markus > > static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) > @@ -1921,6 +1940,8 @@ > unsigned long cr0, > struct kvm_vcpu *vcpu) > { > + ulong cr3; > + > vmx_decache_cr3(vcpu); > if (!(cr0 & X86_CR0_PG)) { > /* From paging/starting to nonpaging */ > @@ -1936,8 +1957,11 @@ > vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) & > ~(CPU_BASED_CR3_LOAD_EXITING | > CPU_BASED_CR3_STORE_EXITING)); > + /* Must fetch cr3 before updating cr0 */ > + cr3 = kvm_read_cr3(vcpu); > vcpu->arch.cr0 = cr0; > vmx_set_cr4(vcpu, kvm_read_cr4(vcpu)); > + vmx_set_cr3(vcpu, cr3); Hmm, not 100% sure, but the issue might be that the arch.cr3 value does not make it into the vmcs after cr3 was changed from user-space? This would also be fixed with the change above. Joerg