On Mon, Sep 9, 2013 at 1:00 AM, Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> wrote: > On Fri, Sep 06, 2013 at 05:09:41PM -0600, Bjorn Helgaas wrote: >>[+cc Kenji, Alex] >> >>On Fri, Sep 06, 2013 at 09:45:56AM +0800, Wei Yang wrote: >>> In __pci_bus_size_bridges() we check whether a pci bus is a root >>> bus by testing bus->self. As indicated by commit 79af72d7 >>> ("PCI: pci_is_root_bus helper"), bus->self == NULL is not a proper >>> way to check the pci root bus. >>> >>> This patch changes it to pci_is_root_bus() to check whether it is >>> a root bus. >> >>I think this is a good change, even if only on the grounds of >>consistency. >> >>Did you trip over a case where a root bus has bus->self != NULL? >>I'd like to know more details about the case where: >> >> (bus->parent == NULL) && (bus->self != NULL) > > I found one case that (bus->self == NULL) and this bus is not root bus. > > Not sure, this case will meet your requirement? I'm definitely interested in that case as well. Can you include a complete "lspci -vv" output for the case where this happens? I suspect this happens with SR-IOV when we create "virtual" buses, i.e., in virtfn_add_bus(). I think maybe I'll update the comment at pci_is_root_bus() with a note about why we want to use it instead of testing for "bus->self == NULL". I think we still have other tree traversal issues related to those virtual buses, e.g., the ones I mentioned here [1]. But those are a separate problem. Bjorn [1] http://lkml.kernel.org/r/CAErSpo5sFfr=O-Pp=PyaxGauaEajaTr2aK-EQ_rTVUk1zyz8cA@xxxxxxxxxxxxxx -- 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