]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] x86_64: Don't oops at boot when empty Opteron node has IO
authorAndi Kleen <ak@suse.de>
Tue, 23 Aug 2005 01:14:27 +0000 (03:14 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 24 Aug 2005 02:59:39 +0000 (19:59 -0700)
The code to detect IO links on Opteron would not check
if the node had actually memory. This could lead to pci_bus_to_node
returning an invalid node, which might cause crashes later
when dma_alloc_coherent passes it to page_alloc_node().

The bug has been there forever but for some reason
it is causing now crashes.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/pci/k8-bus.c

index c2c38b579939432627a006cb8b2307ca6b9cd6c1..d80c323669e0c5e741a33f8c5700b2c8b8784007 100644 (file)
@@ -47,13 +47,22 @@ fill_mp_bus_to_cpumask(void)
                         * if there are no busses hanging off of the current
                         * ldt link then both the secondary and subordinate
                         * bus number fields are set to 0.
+                        * 
+                        * RED-PEN
+                        * This is slightly broken because it assumes
+                        * HT node IDs == Linux node ids, which is not always
+                        * true. However it is probably mostly true.
                         */
                        if (!(SECONDARY_LDT_BUS_NUMBER(ldtbus) == 0
                                && SUBORDINATE_LDT_BUS_NUMBER(ldtbus) == 0)) {
                                for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus);
                                     j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus);
-                                    j++)
-                                       pci_bus_to_node[j] = NODE_ID(nid);
+                                    j++) { 
+                                       int node = NODE_ID(nid);
+                                       if (!node_online(node))
+                                               node = 0;
+                                       pci_bus_to_node[j] = node;
+                               }               
                        }
                }
        }