LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86_64: fix dma_alloc_pages
@ 2008-02-19 10:21 Yinghai Lu
  2008-02-19 10:29 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2008-02-19 10:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andrew Morton, 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 check the if the node is online..., if not will get numa_node_id
to get one node with ram.

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 a82473d..931b51a 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -53,12 +53,9 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
 	int node;
 
 	node = dev_to_node(dev);
-	if (node == -1)
+	if (node == -1 || !node_online(node))
 		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] 2+ messages in thread

* Re: [PATCH] x86_64: fix dma_alloc_pages
  2008-02-19 10:21 [PATCH] x86_64: fix dma_alloc_pages Yinghai Lu
@ 2008-02-19 10:29 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-02-19 10:29 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Andrew Morton, Linux Kernel Mailing List


* Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:

> 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 check the if the node is online..., if not will get 
> numa_node_id to get one node with ram.

thanks, applied.

	Ingo

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

end of thread, other threads:[~2008-02-19 10:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 10:21 [PATCH] x86_64: fix dma_alloc_pages Yinghai Lu
2008-02-19 10:29 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).