On Fri, 13 Apr 2012 18:33:39 -0300
Marcelo Tosatti <[email protected]> wrote:
> > kvm_arch_commit_memory_region(kvm, mem, old, user_alloc);
> >
> > - /*
> > - * If the new memory slot is created, we need to clear all
> > - * mmio sptes.
> > - */
> > - if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT)
> > - kvm_arch_flush_shadow(kvm);
> > + /* Need to clear all mmio sptes used before. */
> > + if (npages && old.npages && base_gfn != old.base_gfn)
> > + kvm_arch_flush_shadow(kvm, mem->slot);
>
> mmio sptes are not related to any particular slot (by definition),
> i think you misunderstood the purpose of this flush. It handles
>
> 1) [start, end] gpa range unmapped.
> 2) mmio sptes are created that map this range.
> 3) a new slot is created. mmio sptes that map [start, end] range,
> which is now backed by new memslot should be removed.
Ah, OK.
> Perhaps there is an efficient way to clear all mmio sptes, or all
> mmio sptes pointing to [start, end] (instead of all sptes), here.
Well, I am OK -- though not happy -- with flushing everything during
the guest start-up.
But once shadows are fully created, we do not want to do that.
So maybe worth thinking such an efficient way!
Takuya
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html