On Wed, May 27, 2015 at 08:58:38PM +0000, Tang, Jason (ES) wrote: > ... > Q1: Doesn't PCI Hotplug already solve this problem? > A1: From what I can tell, the existing PCI Hotplug infrastructure only > works with PCI endpoints; it has no way to handle hot adding a > bridge, and then later on hot adding an endpoint. __pci_bus_size_bridges() uses pci_hotplug_mem_size (default 2MB, overridable with "pci=hpmemsize=") to reserve space for things that may be hot-added below a bridge that supports hotplug. The thing that's added may be a bridge, and that bridge might support hotplug, and it should work at hot-add a device below that bridge. So in principle, this should work, but there might be something broken. If you conclude it "has no way to handle hot adding a bridge," there must be something seriously broken, and I'd like to fix that, even if it's not sufficient to deal with your whole situation. Can you post a complete dmesg log showing the two hot-adds and the failure? > Static enumeration can also be used in cases where the memory > behind a bridge needs to be changed due to faulty hardware. Can you elaborate on this a bit? Are you saying you have a piece of defective hardware, and you can avoid the defect by assigning different addresses to it? > Q2: Why do bus numbers need to be reenumerated? > A2: Consider a bus "A", with secondary bus number 1), has two child > buses, "B" and "C". Suppose that "B" has no grandchild buses, so > let its bus range is [2-2]. Likewise, "C" also has no grandchild > buses, so its bus range is [3-3]. Therefore, "A"'s bus range is > [1-3]. Let a new bridge "D" be hot added under "B". This bridge's > bus needs to be within its parent's bus range, but "B" has no > space for it. If "B" were to be dynamically resized to [2-3], then > "C"'s bus number would now be invalid. I would expect to see a dev->is_hotplug_bridge test in the bridge enumeration path (maybe somewhere in pci_scan_bridge()) so we could reserve some bus numbers for future hot adds. But I don't, so maybe this is just a bug. There's a lot of this stuff that works fairly well as long as the BIOS has preconfigured things. If your BIOS doesn't do that, I could certainly believe it wouldn't work as well. I would prefer to make Linux work better and depend less on BIOS if we can. 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