kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Avi Kivity <avi@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH v5 8/9] KVM: MMU: combine guest pte read between fetch and pte prefetch
Date: Tue, 6 Jul 2010 16:52:54 -0300	[thread overview]
Message-ID: <20100706195254.GA4311@amt.cnet> (raw)
In-Reply-To: <4C330A9A.9030106@cn.fujitsu.com>

On Tue, Jul 06, 2010 at 06:51:06PM +0800, Xiao Guangrong wrote:
> Combine guest pte read between guest pte check in the fetch path and pte prefetch
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
>  arch/x86/kvm/paging_tmpl.h |   69 ++++++++++++++++++++++++++-----------------
>  1 files changed, 42 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index e04c1a4..a1e6d91 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -67,6 +67,7 @@ struct guest_walker {
>  	int level;
>  	gfn_t table_gfn[PT_MAX_FULL_LEVELS];
>  	pt_element_t ptes[PT_MAX_FULL_LEVELS];
> +	pt_element_t prefetch_ptes[PTE_PREFETCH_NUM];
>  	gpa_t pte_gpa[PT_MAX_FULL_LEVELS];
>  	unsigned pt_access;
>  	unsigned pte_access;
> @@ -291,12 +292,12 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
>  		     gpte_to_gfn(gpte), pfn, true, true);
>  }
>  
> -static void FNAME(pte_prefetch)(struct kvm_vcpu *vcpu, u64 *sptep)
> +static void FNAME(pte_prefetch)(struct kvm_vcpu *vcpu, struct guest_walker *gw,
> +				u64 *sptep)
>  {
>  	struct kvm_mmu_page *sp;
> -	pt_element_t gptep[PTE_PREFETCH_NUM];
> -	gpa_t first_pte_gpa;
> -	int offset = 0, index, i, j, max;
> +	pt_element_t *gptep;
> +	int index, i, j, max;
>  
>  	sp = page_header(__pa(sptep));
>  	index = sptep - sp->spt;
> @@ -311,15 +312,7 @@ static void FNAME(pte_prefetch)(struct kvm_vcpu *vcpu, u64 *sptep)
>  	i = index & ~(PTE_PREFETCH_NUM - 1);
>  	max = index | (PTE_PREFETCH_NUM - 1);
>  
> -	if (PTTYPE == 32)
> -		offset = sp->role.quadrant << PT64_LEVEL_BITS;
> -
> -	first_pte_gpa = gfn_to_gpa(sp->gfn) +
> -				(offset + i) * sizeof(pt_element_t);
> -
> -	if (kvm_read_guest_atomic(vcpu->kvm, first_pte_gpa, gptep,
> -					sizeof(gptep)) < 0)
> -		return;
> +	gptep = gw->prefetch_ptes;

Where do you reread the gpte in the prefetch path?

  reply	other threads:[~2010-07-06 19:52 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06 10:44 [PATCH v5 1/9] KVM: MMU: fix forgot reserved bits check in speculative path Xiao Guangrong
2010-07-06 10:45 ` [PATCH v5 2/9] KVM: MMU: fix race between 'walk_addr' and 'fetch' Xiao Guangrong
2010-07-06 10:46   ` [PATCH v5 3/9] export __get_user_pages_fast() function Xiao Guangrong
2010-07-11 12:52   ` [PATCH v5 2/9] KVM: MMU: fix race between 'walk_addr' and 'fetch' Avi Kivity
2010-07-11 15:40     ` Avi Kivity
2010-07-06 10:47 ` [PATCH v5 4/9] KVM: MMU: introduce gfn_to_pfn_atomic() function Xiao Guangrong
2010-07-06 11:22   ` Gleb Natapov
2010-07-06 11:28     ` Xiao Guangrong
2010-07-09  1:34   ` Xiao Guangrong
2010-07-06 10:48 ` [PATCH v5 5/9] KVM: MMU: introduce gfn_to_page_many_atomic() function Xiao Guangrong
2010-07-11 12:59   ` Avi Kivity
2010-07-12  2:55     ` Xiao Guangrong
2010-07-12 12:28       ` Avi Kivity
2010-07-13  1:17         ` Xiao Guangrong
2010-07-06 10:49 ` [PATCH v5 6/9] KVM: MMU: introduce pte_prefetch_topup_memory_cache() Xiao Guangrong
2010-07-11 13:05   ` Avi Kivity
2010-07-12  3:05     ` Xiao Guangrong
2010-07-12 12:26       ` Avi Kivity
2010-07-13  1:16         ` Xiao Guangrong
2010-07-13  4:21           ` Avi Kivity
2010-07-13  4:25             ` Xiao Guangrong
2010-07-13  5:35               ` Avi Kivity
2010-07-13  5:48                 ` Xiao Guangrong
2010-07-13  6:05                   ` Avi Kivity
2010-07-13  6:10                     ` Xiao Guangrong
2010-07-13  6:29                       ` Avi Kivity
2010-07-13  6:52                         ` Xiao Guangrong
2010-07-13  7:45                           ` Avi Kivity
2010-07-06 10:50 ` [PATCH v5 7/9] KVM: MMU: prefetch ptes when intercepted guest #PF Xiao Guangrong
2010-07-06 10:51 ` [PATCH v5 8/9] KVM: MMU: combine guest pte read between fetch and pte prefetch Xiao Guangrong
2010-07-06 19:52   ` Marcelo Tosatti [this message]
2010-07-07  1:23     ` Xiao Guangrong
2010-07-07 13:07       ` Marcelo Tosatti
2010-07-07 13:11         ` Xiao Guangrong
2010-07-07 13:40           ` Marcelo Tosatti
2010-07-07 14:10             ` Xiao Guangrong
2010-07-07 15:30               ` Marcelo Tosatti
2010-07-06 10:52 ` [PATCH v5 9/9] KVM: MMU: trace " Xiao Guangrong
2010-07-11 12:24 ` [PATCH v5 1/9] KVM: MMU: fix forgot reserved bits check in speculative path Avi Kivity
2010-07-12  2:37   ` Xiao Guangrong
2010-07-12 13:15     ` Avi Kivity
2010-07-13  1:57       ` 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=20100706195254.GA4311@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).