kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	joerg.roedel@amd.com
Subject: Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings
Date: Tue, 6 Jan 2009 14:43:11 -0200	[thread overview]
Message-ID: <20090106164311.GA4902@amt.cnet> (raw)
In-Reply-To: <49636AE7.4090108@redhat.com>

On Tue, Jan 06, 2009 at 04:29:59PM +0200, Avi Kivity wrote:
> Yes...
>
> Looks like kvm_unsync_page can be folded into mmu_need_write_protect  
> (after which we can drop lookup_page(), which is not a good API).  But  
> that's after we solve the current problem.
>
> Looks like the addition of a second role for non-pge mode confuses the  
> mmu.  After the second page is created, mmu_need_write_protect() will  
> return 1, but previously existing sptes can still be writable?
>
> Looks like we need to call rmap_write_protect() when the new page is  
> created.

I'm not sure about the details, but I suspect that multiple shadows
confuse NPT somehow.

Alexander can you give this a try:

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 36aa576..2c6579e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -363,7 +363,8 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 	}
 	kvm_x86_ops->set_cr4(vcpu, cr4);
 	vcpu->arch.cr4 = cr4;
-	vcpu->arch.mmu.base_role.cr4_pge = !!(cr4 & X86_CR4_PGE);
+	if (!tdp_enabled)
+		vcpu->arch.mmu.base_role.cr4_pge = !!(cr4 & X86_CR4_PGE);
 	kvm_mmu_sync_global(vcpu);
 	kvm_mmu_reset_context(vcpu);
 }

  parent reply	other threads:[~2009-01-06 16:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081221184146.8E00B250012@cleopatra.tlv.redhat.com>
2009-01-05 14:56 ` [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings Alexander Graf
2009-01-06 10:41   ` Avi Kivity
2009-01-06 14:11     ` Marcelo Tosatti
2009-01-06 14:29       ` Avi Kivity
2009-01-06 15:06         ` Marcelo Tosatti
2009-01-06 16:43         ` Marcelo Tosatti [this message]
2009-01-07  6:49           ` Alexander Graf
2009-01-07 10:19             ` Avi Kivity
2009-01-07 10:43               ` Marcelo Tosatti
2009-01-07 11:32                 ` Avi Kivity
2009-01-07 13:46                   ` Marcelo Tosatti
2009-01-08 19:53                     ` Alexander Graf
2009-01-09  0:36                       ` Marcelo Tosatti
2009-01-09 10:43                         ` Alexander Graf
2009-01-11  9:12 Marcelo Tosatti
2009-01-11  9:20 ` Avi Kivity

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=20090106164311.GA4902@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).