public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] make dev_to_node return online node or -1
@ 2008-02-20  8:15 Yinghai Lu
  2008-02-20  8:32 ` [PATCH 1/4] make dev_to_node return online node Yinghai Lu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20  8:15 UTC (permalink / raw)
  To: Greg KH, Ingo Molnar, Andrew Morton; +Cc: Linux Kernel Mailing List

Please check update on dev_to_node().

YH

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

* [PATCH 1/4] make dev_to_node return online node
  2008-02-20  8:15 [PATCH 0/4] make dev_to_node return online node or -1 Yinghai Lu
@ 2008-02-20  8:32 ` Yinghai Lu
  2008-02-20 20:41   ` Yinghai Lu
  2008-02-20  8:34 ` [PATCH 3/4] ide: use dev_to_node instead of pcibus_to_node Yinghai Lu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20  8:32 UTC (permalink / raw)
  To: Greg KH, Ingo Molnar, Andrew Morton; +Cc: Linux Kernel Mailing List



some numa system ( with multi HT chains) may return node without ram. aka it
is not online.
try to get one online node.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

diff --git a/include/linux/device.h b/include/linux/device.h
index 2258d89..7f1a4d7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -478,7 +478,12 @@ struct device {
 #ifdef CONFIG_NUMA
 static inline int dev_to_node(struct device *dev)
 {
-	return dev->numa_node;
+	int node;
+	node = dev->numa_node;
+
+	if (node != -1 && !node_online(node))
+		node = numa_node_id();
+	return node;
 }
 static inline void set_dev_node(struct device *dev, int node)
 {

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

* [PATCH 3/4] ide: use dev_to_node instead of pcibus_to_node
  2008-02-20  8:15 [PATCH 0/4] make dev_to_node return online node or -1 Yinghai Lu
  2008-02-20  8:32 ` [PATCH 1/4] make dev_to_node return online node Yinghai Lu
@ 2008-02-20  8:34 ` Yinghai Lu
  2008-02-20  8:36 ` [PATCH 4/4] driver: use dev_to_node in pci_call_probe Yinghai Lu
  2008-02-20  8:36 ` [PATCH 2/4] x86_64: fix dma_alloc_pages v2 Yinghai Lu
  3 siblings, 0 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20  8:34 UTC (permalink / raw)
  To: Greg KH, Ingo Molnar, Andrew Morton, Jeff Garzik
  Cc: Linux Kernel Mailing List


when node0 doesn't have RAM, could have problem because pcibus_to_node may
return 0. So use update dev_to_node to get online node.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/include/linux/ide.h
===================================================================
--- linux-2.6.orig/include/linux/ide.h
+++ linux-2.6/include/linux/ide.h
@@ -1294,8 +1294,7 @@ static inline void ide_dump_identify(u8 
 
 static inline int hwif_to_node(ide_hwif_t *hwif)
 {
-	struct pci_dev *dev = to_pci_dev(hwif->dev);
-	return hwif->dev ? pcibus_to_node(dev->bus) : -1;
+	return hwif->dev ? dev_to_node(hwif->dev) : -1;
 }
 
 static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)




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

* [PATCH 4/4] driver: use dev_to_node in pci_call_probe
  2008-02-20  8:15 [PATCH 0/4] make dev_to_node return online node or -1 Yinghai Lu
  2008-02-20  8:32 ` [PATCH 1/4] make dev_to_node return online node Yinghai Lu
  2008-02-20  8:34 ` [PATCH 3/4] ide: use dev_to_node instead of pcibus_to_node Yinghai Lu
@ 2008-02-20  8:36 ` Yinghai Lu
  2008-02-20  8:36 ` [PATCH 2/4] x86_64: fix dma_alloc_pages v2 Yinghai Lu
  3 siblings, 0 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20  8:36 UTC (permalink / raw)
  To: Greg KH, Ingo Molnar, Andrew Morton; +Cc: Linux Kernel Mailing List

to make sure get one online node.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/drivers/pci/pci-driver.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci-driver.c
+++ linux-2.6/drivers/pci/pci-driver.c
@@ -181,8 +181,8 @@ static int pci_call_probe(struct pci_dri
 	   any need to change it. */
 	struct mempolicy *oldpol;
 	cpumask_t oldmask = current->cpus_allowed;
-	int node = pcibus_to_node(dev->bus);
-	if (node >= 0 && node_online(node))
+	int node = dev_to_node(&dev->dev);
+	if (node >= 0)
 	    set_cpus_allowed(current, node_to_cpumask(node));
 	/* And set default memory allocation policy */
 	oldpol = current->mempolicy;

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

* [PATCH 2/4] x86_64: fix dma_alloc_pages v2
  2008-02-20  8:15 [PATCH 0/4] make dev_to_node return online node or -1 Yinghai Lu
                   ` (2 preceding siblings ...)
  2008-02-20  8:36 ` [PATCH 4/4] driver: use dev_to_node in pci_call_probe Yinghai Lu
@ 2008-02-20  8:36 ` Yinghai Lu
  2008-02-20 10:07   ` Yinghai Lu
  3 siblings, 1 reply; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20  8:36 UTC (permalink / raw)
  To: Greg KH, Ingo Molnar, Andrew Morton; +Cc: Linux Kernel Mailing List


one system with two nodes and two ht links on every node.
the bios already have _pxm for two links.

when no ram installed for node1 will have panic.

reason: the device on second chain will get node = 1 from dev_to_node...via
pci_acpi_scan_root.
but node1 doesn't have ram installed.
in dma_alloc_pages it will pass check with first_node(node_online_map)...
and will have problem with __alloc_pages in alloc_pages_node.

this patch will use updated dev_to node, so remove check about fist_node etc

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/arch/x86/kernel/pci-dma_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/pci-dma_64.c
+++ linux-2.6/arch/x86/kernel/pci-dma_64.c
@@ -53,12 +53,6 @@ dma_alloc_pages(struct device *dev, gfp_
 	int node;
 
 	node = dev_to_node(dev);
-	if (node == -1)
-		node = numa_node_id();
-
-	if (node < first_node(node_online_map))
-		node = first_node(node_online_map);
-
 	page = alloc_pages_node(node, gfp, order);
 	return page ? page_address(page) : NULL;
 }

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

* Re: [PATCH 2/4] x86_64: fix dma_alloc_pages v2
  2008-02-20  8:36 ` [PATCH 2/4] x86_64: fix dma_alloc_pages v2 Yinghai Lu
@ 2008-02-20 10:07   ` Yinghai Lu
  0 siblings, 0 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20 10:07 UTC (permalink / raw)
  To: Greg KH; +Cc: Ingo Molnar, Andrew Morton, Linux Kernel Mailing List

please use this one instead.

because v1 already in mm, and that doesn't depends on 1/4 here.

[PATCH 2/4] x86_64: fix dma_alloc_pages fix

this patch will use updated dev_to node, because dev_to_node already make sure
it have node online

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index 931b51a..375cb2b 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -53,8 +53,6 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
 	int node;
 
 	node = dev_to_node(dev);
-	if (node == -1 || !node_online(node))
-		node = numa_node_id();
 
 	page = alloc_pages_node(node, gfp, order);
 	return page ? page_address(page) : NULL;

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

* Re: [PATCH 1/4] make dev_to_node return online node
  2008-02-20  8:32 ` [PATCH 1/4] make dev_to_node return online node Yinghai Lu
@ 2008-02-20 20:41   ` Yinghai Lu
  0 siblings, 0 replies; 7+ messages in thread
From: Yinghai Lu @ 2008-02-20 20:41 UTC (permalink / raw)
  To: Greg KH, Ingo Molnar; +Cc: Andrew Morton, Linux Kernel Mailing List

please use this one instead. this one is less intrusive, and pcibus_to_node will work too
and don't need other changes.

YH

---

[PATCH] make dev_to_node return online node v2

some numa system ( with multi HT chains) may return node without ram. aka it
is not online.
try to get one online node, otherwise return -1

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index c163ad1..2c1a651 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -213,6 +213,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
 		set_mp_bus_to_node(busnum, node);
 	else
 		node = get_mp_bus_to_node(busnum);
+
+	if (node != -1 && !node_online(node))
+		node = -1;
 #endif
 
 	/* Allocate per-root-bus (not per bus) arch-specific data.

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

end of thread, other threads:[~2008-02-20 20:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20  8:15 [PATCH 0/4] make dev_to_node return online node or -1 Yinghai Lu
2008-02-20  8:32 ` [PATCH 1/4] make dev_to_node return online node Yinghai Lu
2008-02-20 20:41   ` Yinghai Lu
2008-02-20  8:34 ` [PATCH 3/4] ide: use dev_to_node instead of pcibus_to_node Yinghai Lu
2008-02-20  8:36 ` [PATCH 4/4] driver: use dev_to_node in pci_call_probe Yinghai Lu
2008-02-20  8:36 ` [PATCH 2/4] x86_64: fix dma_alloc_pages v2 Yinghai Lu
2008-02-20 10:07   ` Yinghai Lu

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