Re: [patch 2/3] KVM: MMU: skip global pgtables on sync due to cr3 switch

Avi Kivity
2008-10-26T11:27:38Z

Marcelo Tosatti wrote:
> Skip syncing global pages on cr3 switch (but not on cr4/cr0). This is
> important for Linux 32-bit guests with PAE, where the kmap page is
> marked as global.
>
>

Patch is good, but won't apply without the first.

> {
> u64 spte;
> int ret = 0;
> u64 mt_mask = shadow_mt_mask;
> + struct kvm_mmu_page *sp = page_header(__pa(shadow_pte));
> +
> + if (!global && sp->global) {
> + sp->global = 0;
>

A slight deficiency in this approach is that a page can't transition
from !global to global. I don't think this is frequent, so we don't
need to deal with it. But a more accurate approach is to keep a count
of non-global present mappings, and to activate the global logic when
this count is nonzero.

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