aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-09 08:56:29 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:52 -0400
commit988a2cae6a3c0dea6df59808a935a9a697bfc28c (patch)
treec1118d86c5d6f24fe738c608917b0affb311f26d /arch/x86/kvm/x86.c
parent73880c80aa9c8dc353cd0ad26579023213cd5314 (diff)
KVM: Use macro to iterate over vcpus.
[christian: remove unused variables on s390] Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d8adc1da76dd..89862a80e32c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2946,10 +2946,7 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
2946 2946
2947 spin_lock(&kvm_lock); 2947 spin_lock(&kvm_lock);
2948 list_for_each_entry(kvm, &vm_list, vm_list) { 2948 list_for_each_entry(kvm, &vm_list, vm_list) {
2949 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 2949 kvm_for_each_vcpu(i, vcpu, kvm) {
2950 vcpu = kvm->vcpus[i];
2951 if (!vcpu)
2952 continue;
2953 if (vcpu->cpu != freq->cpu) 2950 if (vcpu->cpu != freq->cpu)
2954 continue; 2951 continue;
2955 if (!kvm_request_guest_time_update(vcpu)) 2952 if (!kvm_request_guest_time_update(vcpu))
@@ -4678,20 +4675,22 @@ static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
4678static void kvm_free_vcpus(struct kvm *kvm) 4675static void kvm_free_vcpus(struct kvm *kvm)
4679{ 4676{
4680 unsigned int i; 4677 unsigned int i;
4678 struct kvm_vcpu *vcpu;
4681 4679
4682 /* 4680 /*
4683 * Unpin any mmu pages first. 4681 * Unpin any mmu pages first.
4684 */ 4682 */
4685 for (i = 0; i < KVM_MAX_VCPUS; ++i) 4683 kvm_for_each_vcpu(i, vcpu, kvm)
4686 if (kvm->vcpus[i]) 4684 kvm_unload_vcpu_mmu(vcpu);
4687 kvm_unload_vcpu_mmu(kvm->vcpus[i]); 4685 kvm_for_each_vcpu(i, vcpu, kvm)
4688 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 4686 kvm_arch_vcpu_free(vcpu);
4689 if (kvm->vcpus[i]) { 4687
4690 kvm_arch_vcpu_free(kvm->vcpus[i]); 4688 mutex_lock(&kvm->lock);
4691 kvm->vcpus[i] = NULL; 4689 for (i = 0; i < atomic_read(&kvm->online_vcpus); i++)
4692 } 4690 kvm->vcpus[i] = NULL;
4693 }
4694 4691
4692 atomic_set(&kvm->online_vcpus, 0);
4693 mutex_unlock(&kvm->lock);
4695} 4694}
4696 4695
4697void kvm_arch_sync_events(struct kvm *kvm) 4696void kvm_arch_sync_events(struct kvm *kvm)