Prev: cachefiles: use path_get instead of lone dget
Next: [PATCH] OCFS2: Allow huge (> 16 TiB) volumes to mount
From: Marcelo Tosatti on 6 Jul 2010 16:10 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(a)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? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Xiao Guangrong on 6 Jul 2010 21:30 Marcelo Tosatti wrote: >> - >> - 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? > Marcelo, Thanks for your review. Below codes read gptes in the prefetch path: index = sptep - sp->spt; 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; It reads the 16 aligned items around sptep's corresponding gpte and this gpte is also in this area. :-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Marcelo Tosatti on 7 Jul 2010 09:10 On Wed, Jul 07, 2010 at 09:23:15AM +0800, Xiao Guangrong wrote: > > > Marcelo Tosatti wrote: > > >> - > >> - 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? > > > > Marcelo, > > Thanks for your review. > > Below codes read gptes in the prefetch path: > > index = sptep - sp->spt; > 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; > > It reads the 16 aligned items around sptep's corresponding gpte and this gpte > is also in this area. :-) But you removed that in patch 8? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Xiao Guangrong on 7 Jul 2010 09:20 Marcelo Tosatti wrote: >> >> Below codes read gptes in the prefetch path: >> >> index = sptep - sp->spt; >> 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; >> >> It reads the 16 aligned items around sptep's corresponding gpte and this gpte >> is also in this area. :-) > > But you removed that in patch 8? > Oh, i just want it good for review, you mean it's better let patch 7 and 8 in one patch? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Marcelo Tosatti on 7 Jul 2010 10:00 On Wed, Jul 07, 2010 at 09:11:56PM +0800, Xiao Guangrong wrote: > > > Marcelo Tosatti wrote: > > >> > >> Below codes read gptes in the prefetch path: > >> > >> index = sptep - sp->spt; > >> 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; > >> > >> It reads the 16 aligned items around sptep's corresponding gpte and this gpte > >> is also in this area. :-) > > > > But you removed that in patch 8? > > > > Oh, i just want it good for review, you mean it's better let patch 7 and 8 in one patch? I mean patch 7 is wrong because it removes rereading of gpte, with mmu_lock held, in the prefetch patch. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Next
|
Last
Pages: 1 2 Prev: cachefiles: use path_get instead of lone dget Next: [PATCH] OCFS2: Allow huge (> 16 TiB) volumes to mount |