From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:33077 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758693Ab2CMDo7 convert rfc822-to-8bit (ORCPT ); Mon, 12 Mar 2012 23:44:59 -0400 Received: by lahj13 with SMTP id j13so80824lah.19 for ; Mon, 12 Mar 2012 20:44:57 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1331362837-10740-36-git-send-email-yinghai@kernel.org> References: <1331362837-10740-1-git-send-email-yinghai@kernel.org> <1331362837-10740-36-git-send-email-yinghai@kernel.org> From: Bjorn Helgaas Date: Mon, 12 Mar 2012 21:44:37 -0600 Message-ID: Subject: Re: [PATCH v2 35/37] PCI: Make /sys/bus/pci/rescan rescan root To: Yinghai Lu Cc: Jesse Barnes , x86 , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-pci-owner@vger.kernel.org List-ID: On Sat, Mar 10, 2012 at 12:00 AM, Yinghai Lu wrote: > It will rediscover removed pci root buses. > > Signed-off-by: Yinghai Lu > --- >  drivers/pci/pci-sysfs.c |    2 ++ >  1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index 4d122cb..fc0a7de 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -284,6 +284,7 @@ msi_bus_store(struct device *dev, struct device_attribute *attr, > >  #ifdef CONFIG_HOTPLUG >  static DEFINE_MUTEX(pci_remove_rescan_mutex); > +void __weak arch_pci_root_rescan(void) { } >  static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf, >                                size_t count) >  { > @@ -295,6 +296,7 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf, > >        if (val) { >                mutex_lock(&pci_remove_rescan_mutex); > +               arch_pci_root_rescan(); >                while ((b = pci_find_next_bus(b)) != NULL) >                        pci_rescan_bus(b); >                mutex_unlock(&pci_remove_rescan_mutex); This is gross. We used to rescan every previously-discovered PCI root bus. Now, we do the same, plus: 1) Scan the ACPI namespace for PCI host bridges, adding and scanning any we haven't seen before, and 2) scan domain 0, buses 0 - pcibios_last_bus, looking for any we haven't seen before. These just don't fit with the previous functionality. The scan should be done on the *ACPI namespace*, which is where any new bridges would live. It shouldn't be done in the PCI namespace. The new bridges aren't part of PCI.