diff options
author | Sheng Yang <sheng@linux.intel.com> | 2009-01-05 21:03:02 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-02-14 19:47:36 -0500 |
commit | ad8ba2cd44d4d39fb3fe55d5dcc565b19fc3a7fb (patch) | |
tree | 74dfd501fc541b7d55eecec7b9469f1db8225507 | |
parent | 85db06e514422ae429b5f85742d8111b70bd56f3 (diff) |
KVM: Add kvm_arch_sync_events to sync with asynchronize events
kvm_arch_sync_events is introduced to quiet down all other events may happen
contemporary with VM destroy process, like IRQ handler and work struct for
assigned device.
For kvm_arch_sync_events is called at the very beginning of kvm_destroy_vm(), so
the state of KVM here is legal and can provide a environment to quiet down other
events.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 4 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 4 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 4 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 1 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 1 |
6 files changed, 18 insertions, 0 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 4e586f6110aa..28f982045f29 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -1337,6 +1337,10 @@ static void kvm_release_vm_pages(struct kvm *kvm) | |||
1337 | } | 1337 | } |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | void kvm_arch_sync_events(struct kvm *kvm) | ||
1341 | { | ||
1342 | } | ||
1343 | |||
1340 | void kvm_arch_destroy_vm(struct kvm *kvm) | 1344 | void kvm_arch_destroy_vm(struct kvm *kvm) |
1341 | { | 1345 | { |
1342 | kvm_iommu_unmap_guest(kvm); | 1346 | kvm_iommu_unmap_guest(kvm); |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 2822c8ccfaaf..5f81256287f5 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -125,6 +125,10 @@ static void kvmppc_free_vcpus(struct kvm *kvm) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void kvm_arch_sync_events(struct kvm *kvm) | ||
129 | { | ||
130 | } | ||
131 | |||
128 | void kvm_arch_destroy_vm(struct kvm *kvm) | 132 | void kvm_arch_destroy_vm(struct kvm *kvm) |
129 | { | 133 | { |
130 | kvmppc_free_vcpus(kvm); | 134 | kvmppc_free_vcpus(kvm); |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index be8497186b96..0d33893e1e89 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -212,6 +212,10 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | void kvm_arch_sync_events(struct kvm *kvm) | ||
216 | { | ||
217 | } | ||
218 | |||
215 | void kvm_arch_destroy_vm(struct kvm *kvm) | 219 | void kvm_arch_destroy_vm(struct kvm *kvm) |
216 | { | 220 | { |
217 | kvm_free_vcpus(kvm); | 221 | kvm_free_vcpus(kvm); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cc17546a2406..b0fc079f1bee 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4127,6 +4127,10 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
4127 | 4127 | ||
4128 | } | 4128 | } |
4129 | 4129 | ||
4130 | void kvm_arch_sync_events(struct kvm *kvm) | ||
4131 | { | ||
4132 | } | ||
4133 | |||
4130 | void kvm_arch_destroy_vm(struct kvm *kvm) | 4134 | void kvm_arch_destroy_vm(struct kvm *kvm) |
4131 | { | 4135 | { |
4132 | kvm_free_all_assigned_devices(kvm); | 4136 | kvm_free_all_assigned_devices(kvm); |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ec49d0be7f52..bf6f703642fc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -285,6 +285,7 @@ void kvm_free_physmem(struct kvm *kvm); | |||
285 | struct kvm *kvm_arch_create_vm(void); | 285 | struct kvm *kvm_arch_create_vm(void); |
286 | void kvm_arch_destroy_vm(struct kvm *kvm); | 286 | void kvm_arch_destroy_vm(struct kvm *kvm); |
287 | void kvm_free_all_assigned_devices(struct kvm *kvm); | 287 | void kvm_free_all_assigned_devices(struct kvm *kvm); |
288 | void kvm_arch_sync_events(struct kvm *kvm); | ||
288 | 289 | ||
289 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 290 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
290 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 291 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 0b6f2f71271f..68e3f1ec1674 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -891,6 +891,7 @@ static void kvm_destroy_vm(struct kvm *kvm) | |||
891 | { | 891 | { |
892 | struct mm_struct *mm = kvm->mm; | 892 | struct mm_struct *mm = kvm->mm; |
893 | 893 | ||
894 | kvm_arch_sync_events(kvm); | ||
894 | spin_lock(&kvm_lock); | 895 | spin_lock(&kvm_lock); |
895 | list_del(&kvm->vm_list); | 896 | list_del(&kvm->vm_list); |
896 | spin_unlock(&kvm_lock); | 897 | spin_unlock(&kvm_lock); |