From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 2/8 v2] Maintain back mapping from irqchip/pin to gsi. Date: Wed, 12 Aug 2009 11:42:45 +0300 Message-ID: <20090812084245.GY4764@redhat.com> References: <1249993895-11119-1-git-send-email-gleb@redhat.com> <1249993895-11119-3-git-send-email-gleb@redhat.com> <4A8278D6.7080102@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]:40518 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbZHLImq (ORCPT ); Wed, 12 Aug 2009 04:42:46 -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 n7C8glYK012214 for ; Wed, 12 Aug 2009 04:42:47 -0400 Content-Disposition: inline In-Reply-To: <4A8278D6.7080102@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 12, 2009 at 11:09:58AM +0300, Avi Kivity wrote: > On 08/11/2009 03:31 PM, Gleb Natapov wrote: >> Maintain back mapping from irqchip/pin to gsi to speedup >> interrupt acknowledgment notifications. >> >> Signed-off-by: Gleb Natapov >> --- >> include/linux/kvm_host.h | 1 + >> virt/kvm/irq_comm.c | 24 +++++++++++------------- >> 2 files changed, 12 insertions(+), 13 deletions(-) >> >> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h >> index 09df31d..d2b8eb3 100644 >> --- a/include/linux/kvm_host.h >> +++ b/include/linux/kvm_host.h >> @@ -133,6 +133,7 @@ struct kvm_kernel_irq_routing_entry { >> }; >> >> struct kvm_irq_routing_table { >> + int chip[3][KVM_IOAPIC_NUM_PINS]; >> > > KVM_NR_IRQCHIPS > > An alternative implementation is to embed a lookup table in each > irqchip. I don't think it's really necessary. > >> --- a/virt/kvm/irq_comm.c >> +++ b/virt/kvm/irq_comm.c >> @@ -168,21 +168,13 @@ 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; >> - } >> - } >> + gsi = kvm->irq_routing->chip[irqchip][pin]; >> + if (gsi == -1) >> + gsi = pin; >> > > What's this? > If there is not GSI mapping use pin as gsi. This what current code does. We can BUG() here I think. -- Gleb.