From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDfqs-0000lO-Qk for qemu-devel@nongnu.org; Thu, 07 Mar 2013 13:47:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDfqp-0007GZ-RD for qemu-devel@nongnu.org; Thu, 07 Mar 2013 13:47:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDfqp-0007GT-Kl for qemu-devel@nongnu.org; Thu, 07 Mar 2013 13:47:35 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r27IlZ6u009881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Mar 2013 13:47:35 -0500 Date: Thu, 7 Mar 2013 20:47:54 +0200 From: "Michael S. Tsirkin" Message-ID: <20130307184754.GA31034@redhat.com> References: <20130307182853.22096.81037.stgit@bling.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130307182853.22096.81037.stgit@bling.home> Subject: Re: [Qemu-devel] [PATCH] pci: Fix INTx routing notifier recursion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: qemu-devel@nongnu.org On Thu, Mar 07, 2013 at 11:29:19AM -0700, Alex Williamson wrote: > For some reason we recurse to fire the INTx routing notifier for each > child of a bus, for each possible device of a bus. That means that if > we add a root port, the notifier gets called for that bridge 256 > times. If we add an upstream switch behind that root port, 256^2. But > of course we need a downstream switch, 256^3. This starts to be > noticeable. Stop the insanity. > > Signed-off-by: Alex Williamson Applied, thanks. > --- > hw/pci/pci.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 8772707..f24c389 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -1215,9 +1215,10 @@ void pci_bus_fire_intx_routing_notifier(PCIBus *bus) > if (dev && dev->intx_routing_notifier) { > dev->intx_routing_notifier(dev); > } > - QLIST_FOREACH(sec, &bus->child, sibling) { > - pci_bus_fire_intx_routing_notifier(sec); > - } > + } > + > + QLIST_FOREACH(sec, &bus->child, sibling) { > + pci_bus_fire_intx_routing_notifier(sec); > } > } >