All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, KVM <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 5/6] KVM: MMU: abstract invalid guest pte mapping
Date: Mon, 22 Nov 2010 18:18:21 +0800	[thread overview]
Message-ID: <4CEA436D.8050202@cn.fujitsu.com> (raw)
In-Reply-To: <4CEA37A6.8040204@redhat.com>


On 11/22/2010 05:28 PM, Avi Kivity wrote:

>> +static bool FNAME(map_invalid_gpte)(struct kvm_vcpu *vcpu,
>> +                    struct kvm_mmu_page *sp, u64 *spte,
>> +                    pt_element_t gpte)
> 
> It's really only for speculative maps, the name should reflect that.
> 

OK, i'll use speculative_map_invalid_gpte or speculative_map_gpte
instead.

> Why restrict to invalid gptes?  Won't it work for valid gptes as well? 
> Maybe you'll need an extra code path for update_pte() which already
> knows the pfn.
> 

Um. i did it in the in the previous version, but it needs a callback to
get pfn since get pfn is very different on update_pte / prefetch_pte /
sync_page paths. the codes seems more complicated.

Maybe we can get pfn first and call FNAME(map_vaild_gpte) later, but
it can add little little overload on prefetch_pte path.

>> +{
>> +    u64 nonpresent = shadow_trap_nonpresent_pte;
>> +
>> +    if (is_rsvd_bits_set(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL))
>> +        goto no_present;
>> +
>> +    if (!is_present_gpte(gpte)) {
>> +        if (!sp->unsync)
>> +            nonpresent = shadow_notrap_nonpresent_pte;
>> +        goto no_present;
>> +    }
> 
> I think the order is reversed.  If !is_present_gpte(), it doesn't matter
> if reserved bits are set or not.
> 

if !is_present_gpte() && is_rsvd_bits_set, then we may mark the spte notrap,
so the guest will detect #PF with PFEC.P=PEFC.RSVD=0, but the appropriate PFEC
is PFEC.P=0 && PEFC.RSVD=1 ?

  reply	other threads:[~2010-11-22 10:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19  9:01 [PATCH v3 1/6] KVM: MMU: fix forgot flush tlbs on sync_page path Xiao Guangrong
2010-11-19  9:02 ` [PATCH v3 2/6] KVM: MMU: don't drop spte if overwrite it from W to RO Xiao Guangrong
2010-11-19  9:03 ` [PATCH v3 3/6] KVM: MMU: rename 'reset_host_protection' to 'host_writable' Xiao Guangrong
2010-11-19  9:04 ` [PATCH v3 4/6] KVM: MMU: remove 'clear_unsync' parameter Xiao Guangrong
2010-11-19  9:04 ` [PATCH v3 5/6] KVM: MMU: abstract invalid guest pte mapping Xiao Guangrong
2010-11-22  9:28   ` Avi Kivity
2010-11-22 10:18     ` Xiao Guangrong [this message]
2010-11-22 10:17       ` Avi Kivity
2010-11-23  3:08     ` Xiao Guangrong
2010-11-19  9:05 ` [PATCH v3 6/6] KVM: MMU: delay flush all tlbs on sync_page path Xiao Guangrong
2010-11-19 16:11   ` Marcelo Tosatti
2010-11-22  3:45     ` Xiao Guangrong
2010-11-22 14:19       ` Marcelo Tosatti
2010-11-22 21:46         ` Marcelo Tosatti
2010-11-23  3:13           ` Xiao Guangrong
2010-11-26  1:37 ` [PATCH v3 1/6] KVM: MMU: fix forgot flush " Xiao Guangrong
2010-11-26 14:29   ` Marcelo Tosatti

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=4CEA436D.8050202@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@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.