Re: [PATCH 14/27] KVM: MMU: Make walk_addr_generic capable for two-level walking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 07, 2010 at 01:48:05PM -0400, Marcelo Tosatti wrote:
> On Mon, Sep 06, 2010 at 05:55:53PM +0200, Joerg Roedel wrote:
> > This patch uses kvm_read_guest_page_tdp to make the
> > walk_addr_generic functions suitable for two-level page
> > table walking.
> > 
> > Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
> > ---
> >  arch/x86/kvm/paging_tmpl.h |   27 ++++++++++++++++++++-------
> >  1 files changed, 20 insertions(+), 7 deletions(-)
> > 
> > diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> > index cd59af1..a5b5759 100644
> > --- a/arch/x86/kvm/paging_tmpl.h
> > +++ b/arch/x86/kvm/paging_tmpl.h
> > @@ -124,6 +124,8 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
> >  	unsigned index, pt_access, uninitialized_var(pte_access);
> >  	gpa_t pte_gpa;
> >  	bool eperm, present, rsvd_fault;
> > +	int offset;
> > +	u32 error = 0;
> >  
> >  	trace_kvm_mmu_pagetable_walk(addr, write_fault, user_fault,
> >  				     fetch_fault);
> > @@ -153,12 +155,13 @@ walk:
> >  		index = PT_INDEX(addr, walker->level);
> >  
> >  		table_gfn = gpte_to_gfn(pte);
> > -		pte_gpa = gfn_to_gpa(table_gfn);
> > -		pte_gpa += index * sizeof(pt_element_t);
> > +		offset    = index * sizeof(pt_element_t);
> > +		pte_gpa   = gfn_to_gpa(table_gfn) + offset;
> >  		walker->table_gfn[walker->level - 1] = table_gfn;
> >  		walker->pte_gpa[walker->level - 1] = pte_gpa;
> >  
> > -		if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte))) {
> > +		if (kvm_read_guest_page_mmu(vcpu, mmu, table_gfn, &pte, offset,
> > +					    sizeof(pte), &error)) {
> >  			present = false;
> >  			break;
> >  		}
> 
> If there is failure reading the nested page tables here, you fill
> vcpu->arch.fault. But the nested fault error values will be overwritten
> at the end of walk_addr() by the original fault values?

True. Thanks for pointing that out. I will write a test-case for that
too. The results from my implemented tests show that sometimes the error
code is not reported correctly too. So I decided to do a v4 of this
patch-set with all found issues fixed.

Thanks for your review.

	Joerg


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux