All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Markus Schade <markus.schade@gmail.com>
Cc: Joerg Roedel <joro@8bytes.org>, Avi Kivity <avi@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: Restoring saved guest causes guest to reboot
Date: Mon, 30 May 2011 15:02:46 -0300	[thread overview]
Message-ID: <20110530180246.GA9285@amt.cnet> (raw)
In-Reply-To: <alpine.DEB.2.02.1105301410320.6961@perseus.csn.tu-chemnitz.de>

On Mon, May 30, 2011 at 02:16:41PM +0200, Markus Schade wrote:
> On Thu, 26 May 2011, Joerg Roedel wrote:
> 
> >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.
> >
> >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.
> 
> So, basically, Linus just has to re-pull, since the
> "change" I made is already in the tree. Or is there another way to solve
> this? I find it hard to believe that I am the only one using
> save/restore on Nehalem CPUs or that this bug only affects me.
> Although I can verify this on dozens of machines.

Markus,

Please check whether the following patch fixes the problem for you.

-----

Only decache guest CR3 value if vcpu->arch.cr3 is stale.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 750b0ff..772c4d2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2049,7 +2049,9 @@ 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,

  reply	other threads:[~2011-05-30 18:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24  7:11 Restoring saved guest causes guest to reboot Markus Schade
2011-05-24  9:18 ` Joerg Roedel
2011-05-24  9:35   ` Markus Schade
2011-05-24  9:40     ` Joerg Roedel
2011-05-24 11:42       ` Markus Schade
2011-05-24 13:02         ` Joerg Roedel
2011-05-24 13:20           ` Avi Kivity
2011-05-24 13:37             ` Markus Schade
2011-05-24 13:42               ` Avi Kivity
2011-05-25  6:49                 ` Markus Schade
2011-05-26  6:44                   ` Avi Kivity
2011-05-26 11:28                     ` Markus Schade
2011-05-26 15:20                       ` Markus Schade
2011-05-26 15:25                         ` Joerg Roedel
2011-05-30 12:16                           ` Markus Schade
2011-05-30 18:02                             ` Marcelo Tosatti [this message]
2011-05-31  9:44                               ` Markus Schade
2011-06-06 13:57                               ` Markus Schade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110530180246.GA9285@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=markus.schade@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.