aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ba4275d06fb7..2d6ca7968d65 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -555,12 +555,14 @@ static void ack_flush(void *_completed)
555static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) 555static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
556{ 556{
557 int i, cpu, me; 557 int i, cpu, me;
558 cpumask_t cpus; 558 cpumask_var_t cpus;
559 bool called = false; 559 bool called = true;
560 struct kvm_vcpu *vcpu; 560 struct kvm_vcpu *vcpu;
561 561
562 if (alloc_cpumask_var(&cpus, GFP_ATOMIC))
563 cpumask_clear(cpus);
564
562 me = get_cpu(); 565 me = get_cpu();
563 cpus_clear(cpus);
564 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 566 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
565 vcpu = kvm->vcpus[i]; 567 vcpu = kvm->vcpus[i];
566 if (!vcpu) 568 if (!vcpu)
@@ -568,14 +570,17 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
568 if (test_and_set_bit(req, &vcpu->requests)) 570 if (test_and_set_bit(req, &vcpu->requests))
569 continue; 571 continue;
570 cpu = vcpu->cpu; 572 cpu = vcpu->cpu;
571 if (cpu != -1 && cpu != me) 573 if (cpus != NULL && cpu != -1 && cpu != me)
572 cpu_set(cpu, cpus); 574 cpumask_set_cpu(cpu, cpus);
573 }
574 if (!cpus_empty(cpus)) {
575 smp_call_function_mask(cpus, ack_flush, NULL, 1);
576 called = true;
577 } 575 }
576 if (unlikely(cpus == NULL))
577 smp_call_function_many(cpu_online_mask, ack_flush, NULL, 1);
578 else if (!cpumask_empty(cpus))
579 smp_call_function_many(cpus, ack_flush, NULL, 1);
580 else
581 called = false;
578 put_cpu(); 582 put_cpu();
583 free_cpumask_var(cpus);
579 return called; 584 return called;
580} 585}
581 586