From: Andi Kleen <ak@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: peterc@gelato.unsw.edu.au, linux-mm@kvack.org, mbligh@mbligh.org,
linux-ia64@vger.kernel.org, kravetz@us.ibm.com,
tony.luck@intel.com
Subject: Re: [PATCH] gurantee DMA area for alloc_bootmem_low() ver. 2.
Date: Thu, 18 Aug 2005 21:39:27 +0000 [thread overview]
Message-ID: <p73y86ysz5c.fsf@verdi.suse.de> (raw)
In-Reply-To: <20050818125236.4ffe1053.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> writes:
> >
> > To avoid this panic, following patch confirm allocated area, and retry
> > if it is not in DMA.
> > I tested this patch on my Tiger 4 and our new server.
>
> It kills my x86_64 box:
Funny I ran into a similar problem recently. On a multi node x86-64
system when swiotlb is forced (normally those are AMD systems which
use the AMD hardware IOMMU) the bootmem_alloc in swiotlb.c would
allocate from the last node. Why? Because alloc_bootmem just
does for_each_pgdat() and tries each node and the pgdat list
starts with the highest node going down to the lowest.
I just changed the ordering of the pgdat list that made bootmem
work again.
-Andi
Index: linux/mm/bootmem.c
=================================--- linux.orig/mm/bootmem.c
+++ linux/mm/bootmem.c
@@ -61,9 +61,17 @@ static unsigned long __init init_bootmem
{
bootmem_data_t *bdata = pgdat->bdata;
unsigned long mapsize = ((end - start)+7)/8;
+ static struct pglist_data *pgdat_last;
- pgdat->pgdat_next = pgdat_list;
- pgdat_list = pgdat;
+ pgdat->pgdat_next = NULL;
+ /* Add new nodes last so that bootmem always starts
+ searching in the first nodes, not the last ones */
+ if (pgdat_last)
+ pgdat_last->pgdat_next = pgdat;
+ else {
+ pgdat_list = pgdat;
+ pgdat_last = pgdat;
+ }
mapsize = ALIGN(mapsize, sizeof(long));
bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
WARNING: multiple messages have this Message-ID (diff)
From: Andi Kleen <ak@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: peterc@gelato.unsw.edu.au, linux-mm@kvack.org, mbligh@mbligh.org,
linux-ia64@vger.kernel.org, kravetz@us.ibm.com,
tony.luck@intel.com
Subject: Re: [PATCH] gurantee DMA area for alloc_bootmem_low() ver. 2.
Date: 18 Aug 2005 23:39:27 +0200 [thread overview]
Message-ID: <p73y86ysz5c.fsf@verdi.suse.de> (raw)
In-Reply-To: <20050818125236.4ffe1053.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> writes:
> >
> > To avoid this panic, following patch confirm allocated area, and retry
> > if it is not in DMA.
> > I tested this patch on my Tiger 4 and our new server.
>
> It kills my x86_64 box:
Funny I ran into a similar problem recently. On a multi node x86-64
system when swiotlb is forced (normally those are AMD systems which
use the AMD hardware IOMMU) the bootmem_alloc in swiotlb.c would
allocate from the last node. Why? Because alloc_bootmem just
does for_each_pgdat() and tries each node and the pgdat list
starts with the highest node going down to the lowest.
I just changed the ordering of the pgdat list that made bootmem
work again.
-Andi
Index: linux/mm/bootmem.c
===================================================================
--- linux.orig/mm/bootmem.c
+++ linux/mm/bootmem.c
@@ -61,9 +61,17 @@ static unsigned long __init init_bootmem
{
bootmem_data_t *bdata = pgdat->bdata;
unsigned long mapsize = ((end - start)+7)/8;
+ static struct pglist_data *pgdat_last;
- pgdat->pgdat_next = pgdat_list;
- pgdat_list = pgdat;
+ pgdat->pgdat_next = NULL;
+ /* Add new nodes last so that bootmem always starts
+ searching in the first nodes, not the last ones */
+ if (pgdat_last)
+ pgdat_last->pgdat_next = pgdat;
+ else {
+ pgdat_list = pgdat;
+ pgdat_last = pgdat;
+ }
mapsize = ALIGN(mapsize, sizeof(long));
bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2005-08-18 21:39 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-12 6:50 [PATCH] gurantee DMA area for alloc_bootmem_low() Yasunori Goto
2005-07-12 6:50 ` Yasunori Goto
2005-07-12 14:39 ` Martin J. Bligh
2005-07-12 14:39 ` Martin J. Bligh
2005-07-13 5:09 ` Yasunori Goto
2005-07-13 5:09 ` Yasunori Goto
2005-07-12 18:30 ` Mike Kravetz
2005-07-12 18:30 ` Mike Kravetz
2005-07-12 19:29 ` Dave Hansen
2005-07-12 19:29 ` Dave Hansen
2005-07-12 20:37 ` Mike Kravetz
2005-07-12 20:37 ` Mike Kravetz
2005-07-13 6:34 ` Yasunori Goto
2005-07-13 6:34 ` Yasunori Goto
2005-07-13 22:03 ` Mike Kravetz
2005-07-13 22:03 ` Mike Kravetz
2005-07-15 2:43 ` Yasunori Goto
2005-07-15 2:43 ` Yasunori Goto
2005-08-09 11:11 ` [PATCH] gurantee DMA area for alloc_bootmem_low() ver. 2 Yasunori Goto
2005-08-09 11:11 ` Yasunori Goto
2005-08-09 15:05 ` Martin J. Bligh
2005-08-09 15:05 ` Martin J. Bligh
2005-08-09 21:15 ` Mike Kravetz
2005-08-09 21:15 ` Mike Kravetz
2005-08-10 3:06 ` Dave Hansen
2005-08-10 3:06 ` Dave Hansen
2005-08-10 16:23 ` Dave Hansen
2005-08-10 16:23 ` Dave Hansen
2005-08-11 20:46 ` Christoph Lameter
2005-08-11 20:46 ` Christoph Lameter
2005-08-11 21:14 ` Mike Kravetz
2005-08-11 21:14 ` Mike Kravetz
2005-08-11 22:37 ` Christoph Lameter
2005-08-11 22:37 ` Christoph Lameter
2005-08-09 23:02 ` Peter Chubb
2005-08-09 23:02 ` Peter Chubb
2005-08-10 6:10 ` Yasunori Goto
2005-08-10 6:10 ` Yasunori Goto
2005-08-18 19:52 ` Andrew Morton
2005-08-18 19:52 ` Andrew Morton
2005-08-18 21:39 ` Andi Kleen [this message]
2005-08-18 21:39 ` Andi Kleen
2005-08-19 2:29 ` Yasunori Goto
2005-08-19 2:29 ` Yasunori Goto
2005-08-19 3:03 ` Andi Kleen
2005-08-19 3:03 ` Andi Kleen
2005-08-19 1:26 ` Yasunori Goto
2005-08-19 1:26 ` Yasunori Goto
2005-08-25 9:15 ` Yasunori Goto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=p73y86ysz5c.fsf@verdi.suse.de \
--to=ak@suse.de \
--cc=akpm@osdl.org \
--cc=kravetz@us.ibm.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mbligh@mbligh.org \
--cc=peterc@gelato.unsw.edu.au \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.