On Fri, Feb 24, 2012 at 10:38 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: > On Thu, Feb 23, 2012 at 9:23 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: >> On Thu, Feb 23, 2012 at 9:04 PM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: >>> Hi Jesse, >>> >>> I rebased these series: >> >>> v2 add PCI bus-to-resource offset support in core >>> (http://marc.info/?l=linux-pci&m=132884138928641&w=2) >> >> did you solve concerns that i raised? >> 1. two lists that one for host bridge and one for root buses I looked at all the uses of the pci_root_buses list, and I think almost all of them should be removed by restructuring the code. alpha, frv, microblaze, mn10300, powerpc, and x86 use pci_root_buses to find all PCI devices, call pci_claim_resource(), and do some resource allocation. x86 is fairly typical: pci_subsys_init (subsys_initcall) pcibios_init pcibios_resource_survey pcibios_allocate_bus_resources(&pci_root_buses) list_for_each_entry(each root bus): for_each_bridge_window: pci_claim_resource pcibios_allocate_bus_resources(&bus->children) pcibios_allocate_resources(0) pcibios_allocate_resources(1) I think this is a broken model. We only call pcibios_resource_survey() at boot-time, so hotplug devices are treated differently, which is a problem. Some architectures use pci_claim_resource() in a different path, or not at all. That's another problem. None of this stuff is really architecture-dependent, so having a half-dozen separate implementations is adding complexity and inconsistencies without any benefit. In addition to the uses in pcibios_resource_survey(), pci_root_buses is also used by some ARM PCI IRQ handlers, a powerpc syscall (sys_pciconfig_iobase()) and DRM (on alpha only). I suspect these uses could be removed by keeping a little more architecture-specific state. There are also a few uses in the PCI core, but again, these are mostly in resource allocation paths that I think are not correctly designed. PCI resource allocation is not a system-wide problem. It's at most a per-host bridge problem. We should not be iterating over all PCI root buses; rather, we should be doing a piece of the allocation every time we scan below a host bridge. I don't want to trivialize the work here. Restructuring this is a large amount of work. But I think it's good to have some idea of where things should go. I *could* trivially remove the pci_root_buses usages by converting them all to iterators over the pci_host_bridges list. But I don't really want to do that because it polishes code that I think should be removed completely, and it would require exporting pci_host_bridges outside the PCI core, where I don't think it should go. Bjorn -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html