Re: KVM swapping with mmu notifiers

Andrea Arcangeli
2008-01-14T14:06:52Z

On Mon, Jan 14, 2008 at 11:45:39AM -0200, Marcelo Tosatti wrote:
> The alias and memslot maps are protected only by mmap_sem, so you

yes, they are already protected and furthermore in write mode.

> should make kvm_set_memory_region/set_memory_alias grab the mmu spinlock
> in addition to mmap_sem in write mode.

The mmu notifiers already hold the mmap_sem in read mode so I don't
see why I should add the mmu_lock around memslots.

The mmu_lock AFAICS is only needed to serialize with other vcpu fautls
when updating the sptes and I already take it there.

> And then you also need to cover "hva_to_gfn()" to happen under the lock.

hva_to_gfn only requires the mmap_sem in read mode and that's already
taken implicitly before the mmu notifiers are called.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.