From: mel@skynet.ie (Mel Gorman)
To: Linus Torvalds <torvalds@osdl.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
johannes@sipsolutions.net, Andreas Schwab <schwab@suse.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Use symbolic names instead of indices for zone initialisation
Date: Fri, 6 Oct 2006 10:51:35 +0100 [thread overview]
Message-ID: <20061006095135.GA9881@skynet.ie> (raw)
In-Reply-To: <jek63euw97.fsf@sykes.suse.de>
Hi Linus,
Arch-independent zone-sizing is using indices instead of symbolic names
to offset within an array related to zones (max_zone_pfns). The unintended
impact is that ZONE_DMA and ZONE_NORMAL is initialised on powerpc instead
of ZONE_DMA and ZONE_HIGHMEM when CONFIG_HIGHMEM is set. As a result, the
the machine fails to boot but will boot with CONFIG_HIGHMEM turned off.
The following patch properly initialises the max_zone_pfns[] array and uses
symbolic names instead of indices in each architecture using arch-independent
zone-sizing. Two users have successfully booted their powerpcs with it
(one an ibook G4). It has also been boot tested on x86, x86_64, ppc64 and
ia64. Please merge for 2.6.19-rc2.
Credit to Benjamin Herrenschmidt for identifying the bug and rolling the
first fix. Additional credit to Johannes Berg and Andreas Schwab for reporting
the problem and testing on powerpc.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/kernel/setup.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c
--- linux-2.6.18-git19-clean/arch/i386/kernel/setup.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/kernel/setup.c 2006-10-03 11:15:59.000000000 +0100
@@ -1083,16 +1083,15 @@ static unsigned long __init setup_memory
void __init zone_sizes_init(void)
{
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] =
+ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
- max_low_pfn,
- highend_pfn};
+ max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
add_active_range(0, 0, highend_pfn);
#else
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
- max_low_pfn};
add_active_range(0, 0, max_low_pfn);
#endif
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/i386/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c
--- linux-2.6.18-git19-clean/arch/i386/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/i386/mm/discontig.c 2006-10-03 11:17:27.000000000 +0100
@@ -357,11 +357,12 @@ void __init numa_kva_reserve(void)
void __init zone_sizes_init(void)
{
int nid;
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT,
- max_low_pfn,
- highend_pfn
- };
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] =
+ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
+ max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
/* If SRAT has not registered memory, register it now */
if (find_max_pfn_with_active_regions() == 0) {
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/contig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c
--- linux-2.6.18-git19-clean/arch/ia64/mm/contig.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/contig.c 2006-10-03 11:21:09.000000000 +0100
@@ -233,6 +233,7 @@ paging_init (void)
efi_memmap_walk(count_pages, &num_physpages);
max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
max_zone_pfns[ZONE_DMA] = max_dma;
max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c
--- linux-2.6.18-git19-clean/arch/ia64/mm/discontig.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ia64/mm/discontig.c 2006-10-03 11:21:54.000000000 +0100
@@ -709,6 +709,7 @@ void __init paging_init(void)
max_pfn = mem_data[node].max_pfn;
}
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
max_zone_pfns[ZONE_DMA] = max_dma;
max_zone_pfns[ZONE_NORMAL] = max_pfn;
free_area_init_nodes(max_zone_pfns);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c
--- linux-2.6.18-git19-clean/arch/powerpc/mm/mem.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/mem.c 2006-10-03 11:10:57.000000000 +0100
@@ -307,11 +307,12 @@ void __init paging_init(void)
top_of_ram, total_ram);
printk(KERN_DEBUG "Memory hole size: %ldMB\n",
(top_of_ram - total_ram) >> 20);
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
#ifdef CONFIG_HIGHMEM
- max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
- max_zone_pfns[1] = top_of_ram >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
#else
- max_zone_pfns[0] = top_of_ram >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
#endif
free_area_init_nodes(max_zone_pfns);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c
--- linux-2.6.18-git19-clean/arch/powerpc/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/powerpc/mm/numa.c 2006-10-03 11:12:01.000000000 +0100
@@ -617,9 +617,9 @@ void __init do_init_bootmem(void)
void __init paging_init(void)
{
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {
- lmb_end_of_DRAM() >> PAGE_SHIFT
- };
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT;
free_area_init_nodes(max_zone_pfns);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/ppc/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c
--- linux-2.6.18-git19-clean/arch/ppc/mm/init.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/ppc/mm/init.c 2006-10-03 11:13:46.000000000 +0100
@@ -374,11 +374,12 @@ void __init paging_init(void)
end_pfn = start_pfn + (total_memory >> PAGE_SHIFT);
add_active_range(0, start_pfn, end_pfn);
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
#ifdef CONFIG_HIGHMEM
- max_zone_pfns[0] = total_lowmem >> PAGE_SHIFT;
- max_zone_pfns[1] = total_memory >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_HIGHMEM] = total_memory >> PAGE_SHIFT;
#else
- max_zone_pfns[0] = total_memory >> PAGE_SHIFT;
+ max_zone_pfns[ZONE_DMA] = total_memory >> PAGE_SHIFT;
#endif /* CONFIG_HIGHMEM */
free_area_init_nodes(max_zone_pfns);
}
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/init.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c
--- linux-2.6.18-git19-clean/arch/x86_64/mm/init.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/init.c 2006-10-03 11:18:54.000000000 +0100
@@ -406,9 +406,12 @@ void __cpuinit zap_low_mappings(int cpu)
#ifndef CONFIG_NUMA
void __init paging_init(void)
{
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
- MAX_DMA32_PFN,
- end_pfn};
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+ max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
+ max_zone_pfns[ZONE_NORMAL] = end_pfn;
+
memory_present(0, 0, end_pfn);
sparse_init();
free_area_init_nodes(max_zone_pfns);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c
--- linux-2.6.18-git19-clean/arch/x86_64/mm/numa.c 2006-10-03 09:12:56.000000000 +0100
+++ linux-2.6.18-git19-use_zone_symbolic_names/arch/x86_64/mm/numa.c 2006-10-03 11:19:47.000000000 +0100
@@ -338,9 +338,11 @@ static void __init arch_sparse_init(void
void __init paging_init(void)
{
int i;
- unsigned long max_zone_pfns[MAX_NR_ZONES] = { MAX_DMA_PFN,
- MAX_DMA32_PFN,
- end_pfn};
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
+ max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
+ max_zone_pfns[ZONE_NORMAL] = end_pfn;
arch_sparse_init();
next prev parent reply other threads:[~2006-10-06 9:51 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-05 3:29 Merge window closed: v2.6.19-rc1 Linus Torvalds
2006-10-05 4:28 ` 2.6.19-rc1: known regressions Adrian Bunk
2006-10-05 4:45 ` Benjamin Herrenschmidt
2006-10-05 6:37 ` Jens Axboe
2006-10-05 6:52 ` Benjamin Herrenschmidt
2006-10-05 11:01 ` Gene Heskett
2006-10-05 14:04 ` Adrian Bunk
2006-10-05 20:27 ` Andreas Schwab
2006-10-05 21:15 ` Mel Gorman
2006-10-06 0:24 ` Andreas Schwab
2006-10-06 9:51 ` Mel Gorman [this message]
2006-10-05 7:16 ` Nigel Cunningham
2006-10-05 8:27 ` [patch] x86, fix rwsem build bug on CONFIG_M386=y Ingo Molnar
2006-10-05 9:41 ` [discuss] " Andi Kleen
2006-10-10 12:18 ` cpufreq not working on AMD K8 (was Re: 2.6.19-rc1: known regressions) Christian
2006-10-10 14:59 ` Langsdorf, Mark
2006-10-10 16:37 ` Christian
2006-10-10 16:43 ` Langsdorf, Mark
2006-10-11 14:06 ` Christian
2006-10-11 17:33 ` Langsdorf, Mark
2006-10-11 18:16 ` Christian
2006-10-11 18:38 ` Tomasz Torcz
2006-10-11 4:23 ` Adrian Bunk
2006-10-11 9:30 ` Christian
2006-10-11 14:57 ` Adrian Bunk
2006-10-05 15:09 ` Merge window closed: v2.6.19-rc1 Alistair John Strachan
2006-10-05 18:56 ` ohci1394 regression in 2.6.19-rc1 (was Re: Merge window closed: v2.6.19-rc1) Stefan Richter
2006-10-05 20:30 ` Alistair John Strachan
2006-10-05 20:32 ` Alistair John Strachan
2006-10-05 22:16 ` Stefan Richter
2006-10-05 22:37 ` Alistair John Strachan
2006-10-05 23:22 ` ohci1394 regression in 2.6.19-rc1 Stefan Richter
2006-10-06 13:55 ` Stefan Richter
2006-10-06 17:17 ` Stefan Richter
2006-10-06 18:33 ` Stefan Richter
2006-10-06 22:52 ` Alistair John Strachan
2006-10-05 15:41 ` Merge window closed: v2.6.19-rc1 Gene Heskett
2006-10-06 8:36 ` usb resets [Was Re: Merge window closed: v2.6.19-rc1] Uwe Zeisberger
2006-10-06 12:18 ` Gene Heskett
2006-10-05 19:17 ` Merge window closed: v2.6.19-rc1 Peter Osterlund
2006-10-05 19:21 ` Eric Sandeen
2006-10-05 20:49 ` [patch] fix qla{2,4} build error Frederik Deweerdt
2006-10-05 22:01 ` Andrew Vasquez
2006-10-06 16:54 ` [PATCH] Maintain module-parameter name consistency with qla2xxx/qla4xxx Andrew Vasquez
2006-10-05 21:09 ` monitor not active after boot (was Re: Merge window closed: v2.6.19-rc1) Olaf Hering
2006-10-08 10:12 ` Olaf Hering
2006-10-06 4:31 ` Merge window closed: v2.6.19-rc1 Alex Romosan
2006-10-06 18:47 ` 2.6.19-rc1 regression: airo suspend fails Adrian Bunk
2006-10-07 3:54 ` Alex Romosan
2006-10-07 19:52 ` Dave Kleikamp
2006-10-07 20:17 ` Alex Romosan
2006-10-08 6:43 ` Pavel Machek
2006-10-06 17:49 ` Merge window closed: v2.6.19-rc1 caszonyi
2006-10-06 18:12 ` Linus Torvalds
2006-10-06 19:05 ` Eric W. Biederman
2006-10-07 18:23 ` Gabor Gombas
2006-10-07 20:29 ` Eric W. Biederman
2006-10-06 22:43 ` Grant Coady
2006-10-06 22:47 ` Jesper Juhl
2006-10-07 2:33 ` Linus Torvalds
2006-10-07 13:16 ` James Bottomley
[not found] ` <20061007214620.GB8810@stusta.de>
2006-10-07 23:02 ` 2.6.19-rc1: known regressions (v2) Prakash Punnoor
2006-10-08 7:12 ` x60 backlight Re: [discuss] " Pavel Machek
2006-10-08 17:38 ` Adrian Bunk
2006-10-08 17:59 ` Michael S. Tsirkin
2006-10-08 19:30 ` Adrian Bunk
2006-10-16 19:39 ` Michael S. Tsirkin
2006-10-08 18:36 ` Pavel Machek
2006-10-08 19:29 ` Adrian Bunk
2006-10-08 23:44 ` Jeremy Fitzhardinge
2006-10-08 11:10 ` [GIT PULL] ieee1394 update (was 2.6.19-rc1: known regressions (v2)) Stefan Richter
2006-10-09 15:32 ` 2.6.19-rc1: known regressions (v2) - xfrm_register_mode Steve Fox
2006-10-09 15:51 ` Mel Gorman
2006-10-08 11:47 ` BUG when doing parallel NFS mounts (WAS: Re: Merge window closed: v2.6.19-rc1) Peter Osterlund
2006-10-08 15:19 ` Peter Osterlund
2006-10-08 18:35 ` Trond Myklebust
2006-10-08 18:54 ` Peter Osterlund
2006-10-08 19:21 ` Trond Myklebust
2006-10-09 0:31 ` 2.6.19-rc1: DVB frontend selection causes compile errors Adrian Bunk
2006-10-09 7:53 ` [v4l-dvb-maintainer] " Michael Krufky
2006-10-09 8:05 ` Adrian Bunk
2006-10-09 8:27 ` Michael Krufky
2006-10-14 5:23 ` Randy Dunlap
2006-10-14 13:32 ` Trent Piepho
[not found] ` <20061010051019.GB3650@stusta.de>
2006-10-10 5:16 ` 2.6.19-rc1: known regressions (v3) Benjamin Herrenschmidt
2006-10-10 8:41 ` Mel Gorman
[not found] ` <17708.9637.569670.824121@cargo.ozlabs.ibm.com>
2006-10-11 3:08 ` Adrian Bunk
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=20061006095135.GA9881@skynet.ie \
--to=mel@skynet.ie \
--cc=benh@kernel.crashing.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=schwab@suse.de \
--cc=torvalds@osdl.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®