Re: [RFT] kvm with Windows optimization

Avi Kivity
2007-10-28T16:26:48Z

Anthony Liguori wrote:
>
> Using the following patch, I'm getting really good results.

> --- a/kernel/mmu.c 2007-10-25 12:36:18.000000000 -0500
> +++ b/kernel/mmu.c 2007-10-25 17:09:55.000000000 -0500
> @@ -280,7 +280,7 @@
> if (r)
> goto out;
> r = mmu_topup_memory_cache(&vcpu->mmu_rmap_desc_cache,
> - rmap_desc_cache, 1);
> + rmap_desc_cache, 2);
> if (r)
> goto out;
> r = mmu_topup_memory_cache_page(&vcpu->mmu_page_cache, 8);
>

I think I know what's happening.

We get a write page fault on a page that's not shadowed. Turns out it's
a page table page, so we map it read-only, and also rmap it.

Since it's a page table page, we emulate the write and try to map the
just-written pte as well, since it's likely somebody will access the
memory pointed-to by the pte. This consumes another rmap entry, and we
go boom.

This didn't happen previously, because we didn't rmap read-only pages,
so the first mapping did not consume an rmap entry. With swapping
enabled, we do map read only pages, so we see this.

The correct fix is probably to call mmu_topup_memory_pages() from where
we do the emulated write, but this seems difficult.

--
error compiling committee.c: too many arguments to function