KVM: MMU: Switch to mmu spinlock

Convert the synchronization of the shadow handling to a separate mmu_lock
spinlock.

Also guard fetch() by mmap_sem in read-mode to protect against alias
and memslot changes.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
Marcelo Tosatti
2007-12-20 19:18:26 -05:00
committed by Avi Kivity
parent d7824fff89
commit aaee2c94f7
5 changed files with 35 additions and 31 deletions

View File

@@ -104,7 +104,8 @@ struct kvm_memory_slot {
};
struct kvm {
struct mutex lock; /* protects everything except vcpus */
struct mutex lock; /* protects the vcpus array and APIC accesses */
spinlock_t mmu_lock;
struct mm_struct *mm; /* userspace tied to this vm */
int nmemslots;
struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +