[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100507201416.GA12974@amt.cnet>
Date: Fri, 7 May 2010 17:14:16 -0300
From: Marcelo Tosatti <mtosatti@...hat.com>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Avi Kivity <avi@...hat.com>, LKML <linux-kernel@...r.kernel.org>,
kvm@...r.kernel.org
Subject: Re: [PATCH] kvm mmu: reduce 50% memory usage
On Fri, May 07, 2010 at 04:25:36PM +0800, Lai Jiangshan wrote:
> Subject: [PATCH] kvm, tdp: calculate correct base gfn for non-DIR level
>
> the base gfn calculation is incorrect in __direct_map(),
> it does not calculate correctly when level=3 or 4.
>
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> Reported-by: Marcelo Tosatti <mtosatti@...hat.com>
> ---
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index a5c6719..6986a6f 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -1955,7 +1956,10 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
> }
>
> if (*iterator.sptep == shadow_trap_nonpresent_pte) {
> - pseudo_gfn = (iterator.addr & PT64_DIR_BASE_ADDR_MASK) >> PAGE_SHIFT;
> + u64 base_addr = iterator.addr;
> +
> + base_addr &= PT64_LVL_ADDR_MASK(iterator.level);
> + pseudo_gfn = base_addr >> PAGE_SHIFT;
> sp = kvm_mmu_get_page(vcpu, pseudo_gfn, iterator.addr,
> iterator.level - 1,
> 1, ACC_ALL, iterator.sptep);
Looks good, please resend the whole patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists