sparc64: mem boot option correction
PATCH 1/1 sparc64: mem boot option correction
From: bob picco <[email protected]>
The "mem" boot option can result in many unexpected consequences. This patch attempts to prevent boot hangs which have been experienced on T4-4 and T5-8. Basically the boot loader allocates vmlinuz and initrd higher in available OBP physical memory. For example, on a 2Tb T5-8 it isn't possible to boot with mem G.
The patch utilizes memblock to avoid reserved regions and trim memory which is only free. Other improvements are possible for a multi-node machine.
This is a snippet of the boot log with mem G on T5-8 with the patch applied:
MEMBLOCK configuration: <- before memory reduction
memory size = 0x1ffad6ce000 reserved size = 0xa1adf44 memory.cnt = 0xb
memory[0x0] [0x00000030400000-0x00003fdde47fff], 0x3fada48000 bytes memory[0x1] [0x00003fdde4e000-0x00003fdde4ffff], 0x2000 bytes memory[0x2] [0x00080000000000-0x00083fffffffff], 0x4000000000 bytes memory[0x3] [0x00100000000000-0x00103fffffffff], 0x4000000000 bytes memory[0x4] [0x00180000000000-0x00183fffffffff], 0x4000000000 bytes memory[0x5] [0x00200000000000-0x00203fffffffff], 0x4000000000 bytes memory[0x6] [0x00280000000000-0x00283fffffffff], 0x4000000000 bytes memory[0x7] [0x00300000000000-0x00303fffffffff], 0x4000000000 bytes memory[0x8] [0x00380000000000-0x00383fffc71fff], 0x3fffc72000 bytes memory[0x9] [0x00383fffc92000-0x00383fffca1fff], 0x10000 bytes memory[0xa] [0x00383fffcb4000-0x00383fffcb5fff], 0x2000 bytes
reserved.cnt = 0x2
reserved[0x0] [0x00380000000000-0x0038000117e7f8], 0x117e7f9 bytes reserved[0x1] [0x00380004000000-0x0038000d02f74a], 0x902f74b bytes
...
MEMBLOCK configuration: <- after reduction of memory
memory size = 0x50a1adf44 reserved size = 0xa1adf44 memory.cnt = 0x4
memory[0x0] [0x00380000000000-0x0038000117e7f8], 0x117e7f9 bytes memory[0x1] [0x00380004000000-0x0038050d01d74a], 0x50901d74b bytes memory[0x2] [0x00383fffc92000-0x00383fffca1fff], 0x10000 bytes memory[0x3] [0x00383fffcb4000-0x00383fffcb5fff], 0x2000 bytes
reserved.cnt = 0x2
reserved[0x0] [0x00380000000000-0x0038000117e7f8], 0x117e7f9 bytes reserved[0x1] [0x00380004000000-0x0038000d02f74a], 0x902f74b bytes
...
Early memory node ranges
node 7: [mem 0x380000000000-0x38000117dfff] node 7: [mem 0x380004000000-0x380f0d01bfff] node 7: [mem 0x383fffc92000-0x383fffca1fff] node 7: [mem 0x383fffcb4000-0x383fffcb5fff]
Could not find start_pfn for node 0
Could not find start_pfn for node 1
Could not find start_pfn for node 2
Could not find start_pfn for node 3
Could not find start_pfn for node 4
Could not find start_pfn for node 5
Could not find start_pfn for node 6
.
The patch was tested on T4-1, T5-8 and Jalap?no.
--- arch/sparc/kernel/setup_64.c | 18 ++------------ arch/sparc/mm/init_64.c | 53 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 16 deletions(-)
arch/sparc/kernel/setup_64.c +3 -15
@@ -141,21 +141,9 @@ static void __init boot_flags_init(char *commands)process_switch (*commands++);continue ; } -if (!strncmp (commands,"mem=" ,4 )) { -/* -* "mem=XXX[kKmM]" overrides the PROM-reported -* memory size. -*/ - cmdline_memory_size =simple_strtoul (commands +4 , - &commands,0 ); -if (*commands ='K' || *commands ='k' ) { - cmdline_memory_size <<=10 ; - commands++; - }else if (*commands='M' || *commands='m' ) { - cmdline_memory_size <<=20 ; - commands++; - } - } +if (!strncmp (commands,"mem=" ,4 )) + cmdline_memory_size =memparse (commands +4 , &commands); +while (*commands && *commands !=' ' ) commands++; }
arch/sparc/mm/init_64.c +52 -1
65 lines not on this page · raw message
Signature · 1 line
1.7.1
David Miller
maintainerFrom: Bob Picco <[email protected]>
Date: Sun, 7 Sep 2014 11:52:27 -0400
arch/sparc/mm/init_64.c pgd_t swapper_pg_dir[PTRS_PER_PGD]; · line 1901
Quoted 3 lines
arch/sparc/mm/init_64.c +3
-0+for_each_free_mem_range (i, any_nid, &pa_start, &pa_end, &nid) { + available = available + (pa_end - pa_start); + }
Single statement basic blocks should not be enclosed with curly braces, thanks.
David Miller wrote: [Tue Sep 09 2014, 03:24:03PM EDT]
Quoted 9 lines
From: Bob Picco <[email protected]>
Date: Sun, 7 Sep 2014 11:52:27 -0400arch/sparc/mm/init_64.c pgd_t swapper_pg_dir[PTRS_PER_PGD]; · line 1901
Quoted 3 lines
arch/sparc/mm/init_64.c +3
-0+for_each_free_mem_range (i, any_nid, &pa_start, &pa_end, &nid) { + available = available + (pa_end - pa_start); + }Single statement basic blocks should not be enclosed with curly braces, thanks.
I'll fix it up.
you're welcome and thanx for the review,
bob