Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72136
b: refs/heads/master
c: 49d3bd7
h: refs/heads/master
v: v3
  • Loading branch information
Laurent Vivier authored and Avi Kivity committed Oct 22, 2007
1 parent 83a3d5a commit 2f14559
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 83d87d167367ae2cc2c6810399aefac33a2ced41
refs/heads/master: 49d3bd7e2b990e717aa66e229410b8f5096c4956
26 changes: 3 additions & 23 deletions trunk/drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,15 @@ static void vcpu_put(struct kvm_vcpu *vcpu)

static void ack_flush(void *_completed)
{
atomic_t *completed = _completed;

atomic_inc(completed);
}

void kvm_flush_remote_tlbs(struct kvm *kvm)
{
int i, cpu, needed;
int i, cpu;
cpumask_t cpus;
struct kvm_vcpu *vcpu;
atomic_t completed;

atomic_set(&completed, 0);
cpus_clear(cpus);
needed = 0;
for (i = 0; i < KVM_MAX_VCPUS; ++i) {
vcpu = kvm->vcpus[i];
if (!vcpu)
Expand All @@ -221,23 +215,9 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
continue;
cpu = vcpu->cpu;
if (cpu != -1 && cpu != raw_smp_processor_id())
if (!cpu_isset(cpu, cpus)) {
cpu_set(cpu, cpus);
++needed;
}
}

/*
* We really want smp_call_function_mask() here. But that's not
* available, so ipi all cpus in parallel and wait for them
* to complete.
*/
for (cpu = first_cpu(cpus); cpu != NR_CPUS; cpu = next_cpu(cpu, cpus))
smp_call_function_single(cpu, ack_flush, &completed, 1, 0);
while (atomic_read(&completed) != needed) {
cpu_relax();
barrier();
cpu_set(cpu, cpus);
}
smp_call_function_mask(cpus, ack_flush, NULL, 1);
}

int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
Expand Down

0 comments on commit 2f14559

Please sign in to comment.