public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] x86: Fix dev_to_node  for x86 and x86_64
@ 2006-12-28 21:05 Ravikiran G Thirumalai
  2006-12-28 21:17 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Ravikiran G Thirumalai @ 2006-12-28 21:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, gregkh, jgarzik, hch

Hi Andrew,
dev_to_node() does not work as expected on x86 and x86_64 as pointed out
earlier here:
http://lkml.org/lkml/2006/11/7/10

Following patch fixes it, please apply.  (Note: The fix depends on support
for PCI domains for x86/x86_64)

Thanks,
Kiran


dev_to_node does not work as expected on x86_64 (and i386).  This is because
node value returned by pcibus_to_node is initialized after a struct device
is created with current x86_64 code.

We need the node value initialized before the call to pci_scan_bus_parented,
as the generic devices are allocated and initialized
off pci_scan_child_bus, which gets called from pci_scan_bus_parented
The following patch does that using "pci_sysdata" introduced by the PCI
domain patches in -mm.

Signed-off-by: Alok N Kataria <alok.kataria@calsoftinc.com>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>

Index: linux-2.6.20-rc1/arch/i386/pci/acpi.c
===================================================================
--- linux-2.6.20-rc1.orig/arch/i386/pci/acpi.c	2006-12-28 11:51:52.542775000 -0800
+++ linux-2.6.20-rc1/arch/i386/pci/acpi.c	2006-12-28 12:01:19.242775000 -0800
@@ -9,6 +9,7 @@ struct pci_bus * __devinit pci_acpi_scan
 {
 	struct pci_bus *bus;
 	struct pci_sysdata *sd;
+	int pxm;
 
 	/* Allocate per-root-bus (not per bus) arch-specific data.
 	 * TODO: leak; this memory is never freed.
@@ -30,15 +31,21 @@ struct pci_bus * __devinit pci_acpi_scan
 	}
 #endif /* CONFIG_PCI_DOMAINS */
 
+	sd->node = -1;
+
+	pxm = acpi_get_pxm(device->handle);
+#ifdef CONFIG_ACPI_NUMA
+	if (pxm >= 0)
+		sd->node = pxm_to_node(pxm);
+#endif
+
 	bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
 	if (!bus)
 		kfree(sd);
 
 #ifdef CONFIG_ACPI_NUMA
 	if (bus != NULL) {
-		int pxm = acpi_get_pxm(device->handle);
 		if (pxm >= 0) {
-			sd->node = pxm_to_node(pxm);
 			printk("bus %d -> pxm %d -> node %d\n",
 				busnum, pxm, sd->node);
 		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-28 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-28 21:05 [patch] x86: Fix dev_to_node for x86 and x86_64 Ravikiran G Thirumalai
2006-12-28 21:17 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox