On 08/12/2009 03:17 PM, Gleb Natapov wrote:
Maintain back mapping from irqchip/pin to gsi to speedup
interrupt acknowledgment notifications.
struct kvm_irq_routing_table {
+ int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS];
struct kvm_kernel_irq_routing_entry *rt_entries;
u32 nr_rt_entries;
/*
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index a9d2262..00e4be7 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -168,25 +168,16 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned
irqchip, unsigned pin)
{
struct kvm_irq_ack_notifier *kian;
struct hlist_node *n;
- unsigned gsi = pin;
- int i;
+ unsigned gsi;
trace_kvm_ack_irq(irqchip, pin);
- for (i = 0; i< kvm->irq_routing->nr_rt_entries; i++) {
- struct kvm_kernel_irq_routing_entry *e;
- e =&kvm->irq_routing->rt_entries[i];
- if (e->type == KVM_IRQ_ROUTING_IRQCHIP&&
- e->irqchip.irqchip == irqchip&&
- e->irqchip.pin == pin) {
- gsi = e->gsi;
- break;
- }
- }
-
- hlist_for_each_entry(kian, n,&kvm->arch.irq_ack_notifier_list, link)
- if (kian->gsi == gsi)
- kian->irq_acked(kian);
+ gsi = kvm->irq_routing->chip[irqchip][pin];
+ if (gsi != -1)
unsigned vs. int compare... it will work, but will raise eyebrows.
Better make it a -1U.
+ hlist_for_each_entry(kian, n,&kvm->arch.irq_ack_notifier_list,
+ link)
+ if (kian->gsi == gsi)
+ kian->irq_acked(kian);
}
void kvm_register_irq_ack_notifier(struct kvm *kvm,
@@ -308,6 +299,9 @@ static int setup_routing_entry(struct kvm_irq_routing_table
*rt,
}
e->irqchip.irqchip = ue->u.irqchip.irqchip;
e->irqchip.pin = ue->u.irqchip.pin + delta;
+ if (e->irqchip.pin> KVM_IOAPIC_NUM_PINS)
+ goto out;
>=
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html