Messages in this thread | | | Date | Tue, 20 Dec 2005 15:16:09 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH] pci device sysdata may be null check in pcibus_to_node |
| |
Andy Whitcroft <apw@shadowen.org> wrote: > > pci device sysdata may be null, check in pcibus_to_node > > We have been seeing panic's on NUMA systems in pci_call_probe() in > 2.6.15-rc5-mm2 and -mm3. It seems that some changes have occured > to the meaning of the 'sysdata' for a device such that it is no > longer just an integer containing the node, it is now a structure > containing the node and other data. However, it seems that we do not > always initialise this sysdata before we probe the device. > > Below are three examples from a boot with this checked for. It is > not clear to me whether it is reasonable to attempt to probe this > device without the bus sysdata being initialised. The attached > patch adds a safety check to pcibus_to_node() to avoid the panic, > this restores the 'call anytime' semantic for this function. > > ... > > -#define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node > +#define pcibus_to_node(bus) (((bus)->sysdata)? ((struct pci_sysdata *)((bus)->sysdata))->node : -1) > #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) >
It would be neater and faster to simply require that the platform always put something sane bus->sysdata, even if that's a pointer to some statically allocated struct. IOW:
static struct pci_sysdata dummy_sysdata = { .node = -1 };
somewhere_in_initialisation() { ... if (bus->sysdata == NULL) bus->sysdata = dummy_sysdata; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |