kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Izik Eidus <ieidus@redhat.com>
Cc: kvm@vger.kernel.org, aarcange@redhat.com
Subject: Re: [PATCH 2/3] add SPTE_HOST_WRITEABLE flag to the shadow ptes
Date: Mon, 14 Sep 2009 08:18:56 +0300	[thread overview]
Message-ID: <4AADD240.3000608@redhat.com> (raw)
In-Reply-To: <1252600738-9456-3-git-send-email-ieidus@redhat.com>

On 09/10/2009 07:38 PM, Izik Eidus wrote:
> this flag notify that the host physical page we are pointing to from
> the spte is write protected, and therefore we cant change its access
> to be write unless we run get_user_pages(write = 1).
>
> (this is needed for change_pte support in kvm)
>
>
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 62d2f86..a7151b8 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -156,6 +156,8 @@ module_param(oos_shadow, bool, 0644);
>   #define CREATE_TRACE_POINTS
>   #include "mmutrace.h"
>
> +#define SPTE_HOST_WRITEABLE (1ULL<<  PT_FIRST_AVAIL_BITS_SHIFT)
> +
>    

Luckilly, this bit is available on EPT too.

>   #define SHADOW_PT_INDEX(addr, level) PT64_I
> @@ -595,9 +600,16 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
>
>   		nr_present++;
>   		pte_access = sp->role.access&  FNAME(gpte_access)(vcpu, gpte);
> +		if (!(sp->spt[i]&  SPTE_HOST_WRITEABLE)) {
> + 			pte_access&= ~PT_WRITABLE_MASK;
>    

pte_access uses ACC_ masks, not PT_ masks.


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  parent reply	other threads:[~2009-09-14  5:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10 16:38 [PATCH 0/3] ksm support for kvm Izik Eidus
2009-09-10 16:38 ` [PATCH 1/3] kvm: dont hold pagecount reference for mapped sptes pages Izik Eidus
2009-09-10 16:38   ` [PATCH 2/3] add SPTE_HOST_WRITEABLE flag to the shadow ptes Izik Eidus
2009-09-10 16:38     ` [PATCH 3/3] add support for change_pte mmu notifiers Izik Eidus
2009-09-11 21:24       ` Marcelo Tosatti
2009-09-12  6:41         ` Izik Eidus
2009-09-12 16:18           ` Marcelo Tosatti
2009-09-12 17:04             ` Izik Eidus
2009-09-12 16:59               ` Marcelo Tosatti
2009-09-11 21:14     ` [PATCH 2/3] add SPTE_HOST_WRITEABLE flag to the shadow ptes Marcelo Tosatti
2009-09-12  6:35       ` Izik Eidus
2009-09-14  5:18     ` Avi Kivity [this message]
2009-09-14  8:34     ` Marcelo Tosatti
2009-09-14 16:51       ` Izik Eidus
  -- strict thread matches above, loose matches on Subject: below --
2009-09-23 18:25 [PATCH 0/3] ksm support for kvm v2 Izik Eidus
2009-09-23 18:25 ` [PATCH 1/3] kvm: dont hold pagecount reference for mapped sptes pages Izik Eidus
2009-09-23 18:25   ` [PATCH 2/3] add SPTE_HOST_WRITEABLE flag to the shadow ptes Izik Eidus
2009-09-23 18:47 [PATCH 0/3] kvm ksm support v3 Izik Eidus
2009-09-23 18:47 ` [PATCH 1/3] kvm: dont hold pagecount reference for mapped sptes pages Izik Eidus
2009-09-23 18:47   ` [PATCH 2/3] add SPTE_HOST_WRITEABLE flag to the shadow ptes Izik Eidus
2009-09-24 16:55     ` Andrea Arcangeli

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=4AADD240.3000608@redhat.com \
    --to=avi@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=ieidus@redhat.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).