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. -Yinghai
Attachment:
pci_bridge_notifcation_1.patch
Description: Binary data