Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68417
b: refs/heads/master
c: 932f72a
h: refs/heads/master
i:
  68415: f8c7535
v: v3
  • Loading branch information
He, Qing authored and Avi Kivity committed Oct 13, 2007
1 parent a2943d4 commit 94b58e5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 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: 40487c680d5855459dfdce340df13d40071bb774
refs/heads/master: 932f72adbe76f098922c746737cb0bd75fc21e27
1 change: 1 addition & 0 deletions trunk/drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ struct kvm {
struct kvm_io_bus pio_bus;
struct kvm_pic *vpic;
struct kvm_ioapic *vioapic;
int round_robin_prev_vcpu;
};

static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
Expand Down
33 changes: 28 additions & 5 deletions trunk/drivers/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,35 @@ struct kvm_lapic *kvm_apic_round_robin(struct kvm *kvm, u8 vector,
unsigned long bitmap)
{
int vcpu_id;
int last;
int next;
struct kvm_lapic *apic;

last = kvm->round_robin_prev_vcpu;
next = last;

do {
if (++next == KVM_MAX_VCPUS)
next = 0;
if (kvm->vcpus[next] == NULL || !test_bit(next, &bitmap))
continue;
apic = kvm->vcpus[next]->apic;
if (apic && apic_enabled(apic))
break;
apic = NULL;
} while (next != last);
kvm->round_robin_prev_vcpu = next;

if (!apic) {
vcpu_id = ffs(bitmap) - 1;
if (vcpu_id < 0) {
vcpu_id = 0;
printk(KERN_DEBUG "vcpu not ready for apic_round_robin\n");
}
apic = kvm->vcpus[vcpu_id]->apic;
}

/* TODO for real round robin */
vcpu_id = fls(bitmap) - 1;
if (vcpu_id < 0)
printk(KERN_DEBUG "vcpu not ready for apic_round_robin\n");
return kvm->vcpus[vcpu_id]->apic;
return apic;
}

static void apic_set_eoi(struct kvm_lapic *apic)
Expand Down

0 comments on commit 94b58e5

Please sign in to comment.