From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 1/8 v2] Change irq routing table to use gsi indexed array. Date: Wed, 12 Aug 2009 11:41:14 +0300 Message-ID: <20090812084114.GX4764@redhat.com> References: <1249993895-11119-1-git-send-email-gleb@redhat.com> <1249993895-11119-2-git-send-email-gleb@redhat.com> <4A8277B2.8010008@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:40497 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbZHLIlQ (ORCPT ); Wed, 12 Aug 2009 04:41:16 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7C8fHGE011914 for ; Wed, 12 Aug 2009 04:41:17 -0400 Content-Disposition: inline In-Reply-To: <4A8277B2.8010008@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 12, 2009 at 11:05:06AM +0300, Avi Kivity wrote: > On 08/11/2009 03:31 PM, Gleb Natapov wrote: >> Use gsi indexed array instead of scanning all entries on each interrupt >> injection. >> >> >> @@ -163,20 +166,23 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level) >> >> void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) >> { >> - struct kvm_kernel_irq_routing_entry *e; >> struct kvm_irq_ack_notifier *kian; >> struct hlist_node *n; >> unsigned gsi = pin; >> + int i; >> >> trace_kvm_ack_irq(irqchip, pin); >> >> - list_for_each_entry(e,&kvm->irq_routing, link) >> + 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; >> } >> + } >> > > Don't you need to iterate over all the entries for a gsi? > One pin/irqchip cannot be mapped to more than one GSI. Besides this is what the current code does. -- Gleb.