diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-12-23 11:35:21 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:44 -0500 |
commit | bc6678a33d9b952981a8e44a4f876c3ad64ca4d8 (patch) | |
tree | e26027179eb0d76f234509145a395dd6e5910074 /include/linux/kvm_host.h | |
parent | 3ad26d8139a82b0510b1e0435ee82ae461d33401 (diff) |
KVM: introduce kvm->srcu and convert kvm_set_memory_region to SRCU update
Use two steps for memslot deletion: mark the slot invalid (which stops
instantiation of new shadow pages for that slot, but allows destruction),
then instantiate the new empty slot.
Also simplifies kvm_handle_hva locking.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 9af240387fe6..93bd30701ca7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -162,6 +162,7 @@ struct kvm { | |||
162 | struct rw_semaphore slots_lock; | 162 | struct rw_semaphore slots_lock; |
163 | struct mm_struct *mm; /* userspace tied to this vm */ | 163 | struct mm_struct *mm; /* userspace tied to this vm */ |
164 | struct kvm_memslots *memslots; | 164 | struct kvm_memslots *memslots; |
165 | struct srcu_struct srcu; | ||
165 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | 166 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE |
166 | u32 bsp_vcpu_id; | 167 | u32 bsp_vcpu_id; |
167 | struct kvm_vcpu *bsp_vcpu; | 168 | struct kvm_vcpu *bsp_vcpu; |
@@ -275,6 +276,7 @@ void kvm_set_page_accessed(struct page *page); | |||
275 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | 276 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); |
276 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, | 277 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, |
277 | struct kvm_memory_slot *slot, gfn_t gfn); | 278 | struct kvm_memory_slot *slot, gfn_t gfn); |
279 | int memslot_id(struct kvm *kvm, gfn_t gfn); | ||
278 | void kvm_release_pfn_dirty(pfn_t); | 280 | void kvm_release_pfn_dirty(pfn_t); |
279 | void kvm_release_pfn_clean(pfn_t pfn); | 281 | void kvm_release_pfn_clean(pfn_t pfn); |
280 | void kvm_set_pfn_dirty(pfn_t pfn); | 282 | void kvm_set_pfn_dirty(pfn_t pfn); |
@@ -490,11 +492,6 @@ static inline void kvm_guest_exit(void) | |||
490 | current->flags &= ~PF_VCPU; | 492 | current->flags &= ~PF_VCPU; |
491 | } | 493 | } |
492 | 494 | ||
493 | static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
494 | { | ||
495 | return slot - kvm->memslots->memslots; | ||
496 | } | ||
497 | |||
498 | static inline gpa_t gfn_to_gpa(gfn_t gfn) | 495 | static inline gpa_t gfn_to_gpa(gfn_t gfn) |
499 | { | 496 | { |
500 | return (gpa_t)gfn << PAGE_SHIFT; | 497 | return (gpa_t)gfn << PAGE_SHIFT; |