On Tue, Sep 25, 2012 at 1:17 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: > On Tue, Sep 25, 2012 at 11:19 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: >> On Tue, Sep 25, 2012 at 12:06 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: > >>> that is for initial booting path. >>> >>> for hot add/remove notifier add need to be done case by case. >> >> Can initial boot be done the same as hot-add? If we add interfaces >> like for_each_pci_host_bridge(), people will just copy that for use at >> run-time. So it would be better to have the same interfaces for use >> at boot-time and at hot add-time. > > still need to check them case by case. some function may be too early > to be called in work_fn in notifier. that need to find out when to get > that bus notifier get > register. > > I have one draft patch that will delay bridge enabling to BUS_ADD for > pci bridge... > that will need to get that register rather later otherwise that bridge > can not be enabled because resources are not reserved/allocated for > initial booting path. > please refer to the attached patch. you should notice that fs_initcall > is used for registration until boot path already have that pci bridges > before. > > +static struct notifier_block pci_hp_nb = { > + .notifier_call = &pci_hp_notifier, > +}; > + > +static int __init pci_hp_init(void) > +{ > + return bus_register_notifier(&pci_bus_type, &pci_hp_nb); > +} > + > +fs_initcall(pci_hp_init); > > Also using that for_each_pci_host_bridge in run-time is still safe. Sure, it might be *safe*. But it's not *sufficient*. If you use for_each_pci_host_bridge(), you also need to do something else to deal with hot-added host bridges. It's hard to make sure that every caller does both parts correctly: 1) for_each_pci_host_bridge() for things we've already seen and 2) some sort of notifier for hot-added bridges That's why I'd prefer a single interface. -- 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