Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125295
b: refs/heads/master
c: 4984689
h: refs/heads/master
i:
  125293: 7b73723
  125291: ccbfa48
  125287: 21bff5f
  125279: e20991d
v: v3
  • Loading branch information
Rusty Russell authored and Avi Kivity committed Dec 31, 2008
1 parent cd09f67 commit ef99836
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 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: 3d3aab1b973b01bd2a1aa46307e94a1380b1d802
refs/heads/master: 498468961ed6f62a306eb90c49125776c526fa40
44 changes: 15 additions & 29 deletions trunk/virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,11 @@ static void ack_flush(void *_completed)
{
}

void kvm_flush_remote_tlbs(struct kvm *kvm)
static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
{
int i, cpu, me;
cpumask_t cpus;
bool called = false;
struct kvm_vcpu *vcpu;

me = get_cpu();
Expand All @@ -564,45 +565,30 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
vcpu = kvm->vcpus[i];
if (!vcpu)
continue;
if (test_and_set_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests))
if (test_and_set_bit(req, &vcpu->requests))
continue;
cpu = vcpu->cpu;
if (cpu != -1 && cpu != me)
cpu_set(cpu, cpus);
}
if (cpus_empty(cpus))
goto out;
++kvm->stat.remote_tlb_flush;
smp_call_function_mask(cpus, ack_flush, NULL, 1);
out:
if (!cpus_empty(cpus)) {
smp_call_function_mask(cpus, ack_flush, NULL, 1);
called = true;
}
put_cpu();
return called;
}

void kvm_reload_remote_mmus(struct kvm *kvm)
void kvm_flush_remote_tlbs(struct kvm *kvm)
{
int i, cpu, me;
cpumask_t cpus;
struct kvm_vcpu *vcpu;

me = get_cpu();
cpus_clear(cpus);
for (i = 0; i < KVM_MAX_VCPUS; ++i) {
vcpu = kvm->vcpus[i];
if (!vcpu)
continue;
if (test_and_set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests))
continue;
cpu = vcpu->cpu;
if (cpu != -1 && cpu != me)
cpu_set(cpu, cpus);
}
if (cpus_empty(cpus))
goto out;
smp_call_function_mask(cpus, ack_flush, NULL, 1);
out:
put_cpu();
if (make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH))
++kvm->stat.remote_tlb_flush;
}

void kvm_reload_remote_mmus(struct kvm *kvm)
{
make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD);
}

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

0 comments on commit ef99836

Please sign in to comment.