[PATCH] fix pcibus_to_node for x86_64

From: Christoph Lameter
Date: Wed May 18 2005 - 22:39:03 EST


On Wed, 18 May 2005, Matthew Dobson wrote:

> x86_64 surprisingly does define pcibus_to_cpumask, but NOT
> pcibus_to_node(). That means when they unconditionally #include
> <asm-generic/topology.h> at the bottom of asm-x86_64/topology.h they get a
> confusing mish-mash of pcibus functions. What I mean is, on x86_64
> pcibus_to_cpumask will do the right thing but pcibus_to_node will not.
> This is broken. The correct thing to do would be to define pcibus_to_node
> in asm-x86_64/topology.h and only include asm-generic/topology.h if
> DISCONTIG/NUMA isn't defined.

Correct. There is a bit missing there. x86_64 has the pci_bus_to_node
array but not the macro pcibus_to_node. On cursory review it looks as if
it would already be right. Just the _ and the [] ....

Here is a fix for x86_64 that adds pcibus_to_node to
asm-x86_64/topology.h. Patch against 2.6.12-rc4-mm2:

Index: linux-2.6.12-rc4/include/asm-x86_64/topology.h
===================================================================
--- linux-2.6.12-rc4.orig/include/asm-x86_64/topology.h 2005-05-17 02:19:53.000000000 +0000
+++ linux-2.6.12-rc4/include/asm-x86_64/topology.h 2005-05-19 01:40:06.000000000 +0000
@@ -26,7 +26,8 @@
#define parent_node(node) (node)
#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node]))
#define node_to_cpumask(node) (node_to_cpumask[node])
-#define pcibus_to_cpumask(bus) node_to_cpumask(pci_bus_to_node[(bus)->number]);
+#define pcibus_to_node(bus) pci_bus_to_node[(bus)->number]
+#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));

#ifdef CONFIG_NUMA
/* sched_domains SD_NODE_INIT for x86_64 machines */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/