All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Avi Kivity <avi@redhat.com>
Subject: Re: KVM: MMU: only write protect mappings at pagetable level
Date: Wed, 22 Dec 2010 10:48:56 -0700	[thread overview]
Message-ID: <1293040136.2928.0.camel@x201> (raw)
In-Reply-To: <20101222110157.GA4266@amt.cnet>

On Wed, 2010-12-22 at 09:01 -0200, Marcelo Tosatti wrote:
> If a pagetable contains a writeable large spte, all of its sptes will be
> write protected, including non-leaf ones, leading to endless pagefaults.
> 
> Do not write protect pages above PT_PAGE_TABLE_LEVEL, as the spte fault
> paths assume non-leaf sptes are writable.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index c3853d5..c716ff8 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -3442,6 +3442,9 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
>  		if (!test_bit(slot, sp->slot_bitmap))
>  			continue;
>  
> +		if (sp->role.level != PT_PAGE_TABLE_LEVEL)
> +			continue;
> +
>  		pt = sp->spt;
>  		for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
>  			/* avoid RMW */

Works for me.

Tested-by: Alex Williamson <alex.williamson@redhat.com>


      parent reply	other threads:[~2010-12-22 17:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 11:01 KVM: MMU: only write protect mappings at pagetable level Marcelo Tosatti
2010-12-22 11:07 ` Avi Kivity
2010-12-22 11:12   ` Marcelo Tosatti
2010-12-22 13:01     ` Avi Kivity
2010-12-22 13:06       ` Marcelo Tosatti
2010-12-22 14:06         ` Avi Kivity
2010-12-22 17:48 ` Alex Williamson [this message]

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=1293040136.2928.0.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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.