Re: [PATCH] pci device sysdata may be null check in pcibus_to_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Whitcroft <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux