From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH 3/4] KVM: MMU: notrap it if gpte's reserved is set
Date: Sun, 14 Nov 2010 12:56:10 +0200 [thread overview]
Message-ID: <4CDFC04A.8010907@redhat.com> (raw)
In-Reply-To: <4CDD1841.9010300@cn.fujitsu.com>
On 11/12/2010 12:34 PM, Xiao Guangrong wrote:
> We can past the page fault to guest directly if gpte's reserved
> is set
>
How can that work? shadow_notrap_nonpresent_pte causes a fault with
PFEC.P=PFEC.RSVD=0, while we need PFEC.P=PFEC.RSVD=1.
> Signed-off-by: Xiao Guangrong<xiaoguangrong@cn.fujitsu.com>
> ---
> arch/x86/kvm/paging_tmpl.h | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index 291342d..952357a 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -760,6 +760,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
> pt_element_t gpte;
> gpa_t pte_gpa;
> gfn_t gfn;
> + bool gpte_invalid;
>
> if (!is_shadow_present_pte(sp->spt[i]))
> continue;
> @@ -771,12 +772,13 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
> return -EINVAL;
>
> gfn = gpte_to_gfn(gpte);
> - if (is_rsvd_bits_set(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL)
> - || gfn != sp->gfns[i] || !is_present_gpte(gpte)
> - || !(gpte& PT_ACCESSED_MASK)) {
> + gpte_invalid = is_present_gpte(gpte) ||
> + is_rsvd_bits_set(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL);
Shouldn't that be &&?
> + if (gpte_invalid || gfn != sp->gfns[i] ||
> + !(gpte& PT_ACCESSED_MASK)) {
> u64 nonpresent;
>
> - if (is_present_gpte(gpte) || !clear_unsync)
> + if (gpte_invalid || !clear_unsync)
> nonpresent = shadow_trap_nonpresent_pte;
> else
> nonpresent = shadow_notrap_nonpresent_pte;
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-11-14 10:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 10:30 [PATCH 1/4] KVM: MMU: don't drop spte if overwrite it from W to RO Xiao Guangrong
2010-11-12 10:33 ` [PATCH 2/4] KVM: MMU: rename 'reset_host_protection' to 'host_writeable' Xiao Guangrong
2010-11-12 10:37 ` Xiao Guangrong
2010-11-12 10:34 ` [PATCH 3/4] KVM: MMU: notrap it if gpte's reserved is set Xiao Guangrong
2010-11-14 10:56 ` Avi Kivity [this message]
2010-11-15 5:41 ` Xiao Guangrong
2010-11-15 9:17 ` Avi Kivity
2010-11-17 1:45 ` Xiao Guangrong
2010-11-12 10:35 ` [PATCH 4/4] KVM: MMU: cleanup update_pte, pte_prefetch and sync_page functions Xiao Guangrong
2010-11-16 20:52 ` Marcelo Tosatti
2010-11-17 1:58 ` Xiao Guangrong
2010-11-14 10:52 ` [PATCH 1/4] KVM: MMU: don't drop spte if overwrite it from W to RO Avi Kivity
2010-11-15 5:34 ` Xiao Guangrong
2010-11-16 20:24 ` Marcelo Tosatti
2010-11-17 1:42 ` Xiao Guangrong
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=4CDFC04A.8010907@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=xiaoguangrong@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox