Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-05-07 Thread Marcelo Tosatti
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 > Reported-b

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-05-07 Thread Lai Jiangshan
Marcelo Tosatti wrote: > On Thu, May 06, 2010 at 03:03:48PM +0800, Lai Jiangshan wrote: >> Marcelo Tosatti wrote: >>> On Thu, Apr 29, 2010 at 09:43:40PM +0300, Avi Kivity wrote: On 04/29/2010 09:09 PM, Marcelo Tosatti wrote: > You missed quadrant on 4mb large page emulation with shadow (se

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-05-06 Thread Marcelo Tosatti
On Thu, May 06, 2010 at 03:03:48PM +0800, Lai Jiangshan wrote: > Marcelo Tosatti wrote: > > On Thu, Apr 29, 2010 at 09:43:40PM +0300, Avi Kivity wrote: > >> On 04/29/2010 09:09 PM, Marcelo Tosatti wrote: > >>> You missed quadrant on 4mb large page emulation with shadow (see updated > >>> patch belo

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-05-06 Thread Lai Jiangshan
Marcelo Tosatti wrote: > On Thu, Apr 29, 2010 at 09:43:40PM +0300, Avi Kivity wrote: >> On 04/29/2010 09:09 PM, Marcelo Tosatti wrote: >>> You missed quadrant on 4mb large page emulation with shadow (see updated >>> patch below). >> Good catch. >> >>> Also for some reason i can't understand the ass

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Marcelo Tosatti
On Thu, Apr 29, 2010 at 09:43:40PM +0300, Avi Kivity wrote: > On 04/29/2010 09:09 PM, Marcelo Tosatti wrote: > > > >You missed quadrant on 4mb large page emulation with shadow (see updated > >patch below). > > Good catch. > > >Also for some reason i can't understand the assumption > >does not hol

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Avi Kivity
On 04/29/2010 09:09 PM, Marcelo Tosatti wrote: You missed quadrant on 4mb large page emulation with shadow (see updated patch below). Good catch. Also for some reason i can't understand the assumption does not hold for large sptes with TDP, so reverted for now. It's unrelated to TDP, s

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Marcelo Tosatti
On Wed, Apr 28, 2010 at 07:57:01PM +0800, Lai Jiangshan wrote: > > I think users will enable tdp when their hardwares support ept or npt. > This patch can reduce about 50% kvm mmu memory usage for they. > > This simple patch use the fact that: > > When sp->role.direct is set, sp->gfns does not c

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Avi Kivity
On 04/30/2010 11:54 AM, Lai Jiangshan wrote: Avi Kivity wrote: On 04/30/2010 05:25 AM, Lai Jiangshan wrote: It's unrelated to TDP, same issue with shadow. I think the calculation is correct. For example the 4th spte for a level=2 page will yield gfn=4*512. Avi, M

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Avi Kivity
On 04/30/2010 05:25 AM, Lai Jiangshan wrote: It's unrelated to TDP, same issue with shadow. I think the calculation is correct. For example the 4th spte for a level=2 page will yield gfn=4*512. Avi, Marcelo Thank you very much. The calculation I used is correct. Yes. btw, can y

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-28 Thread Marcelo Tosatti
On Wed, Apr 28, 2010 at 07:57:01PM +0800, Lai Jiangshan wrote: > > I think users will enable tdp when their hardwares support ept or npt. > This patch can reduce about 50% kvm mmu memory usage for they. > > This simple patch use the fact that: > > When sp->role.direct is set, sp->gfns does not c

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-28 Thread Avi Kivity
On 04/28/2010 02:57 PM, Lai Jiangshan wrote: I think users will enable tdp when their hardwares support ept or npt. This patch can reduce about 50% kvm mmu memory usage for they. Good one! -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: se

[PATCH] kvm mmu: reduce 50% memory usage

2010-04-28 Thread Lai Jiangshan
I think users will enable tdp when their hardwares support ept or npt. This patch can reduce about 50% kvm mmu memory usage for they. This simple patch use the fact that: When sp->role.direct is set, sp->gfns does not contain any essential information, leaf sptes reachable from this sp are for a