aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorDave Hansen <dave.hansen@linux.intel.com>2015-02-10 16:20:30 -0500
committerBorislav Petkov <bp@suse.de>2015-02-19 05:45:27 -0500
commitf15e05186c3244e9195378a0a568283a8ccc60b0 (patch)
tree83b05f0c5aa85d0280042be41c889065f84af578 /arch/x86/mm
parentbfa76d49576599a4b9f9b7a71f23d73d6dcff735 (diff)
x86/mm/init: Fix incorrect page size in init_memory_mapping() printks
With 32-bit non-PAE kernels, we have 2 page sizes available (at most): 4k and 4M. Enabling PAE replaces that 4M size with a 2M one (which 64-bit systems use too). But, when booting a 32-bit non-PAE kernel, in one of our early-boot printouts, we say: init_memory_mapping: [mem 0x00000000-0x000fffff] [mem 0x00000000-0x000fffff] page 4k init_memory_mapping: [mem 0x37000000-0x373fffff] [mem 0x37000000-0x373fffff] page 2M init_memory_mapping: [mem 0x00100000-0x36ffffff] [mem 0x00100000-0x003fffff] page 4k [mem 0x00400000-0x36ffffff] page 2M init_memory_mapping: [mem 0x37400000-0x377fdfff] [mem 0x37400000-0x377fdfff] page 4k Which is obviously wrong. There is no 2M page available. This is probably because of a badly-named variable: in the map_range code: PG_LEVEL_2M. Instead of renaming all the PG_LEVEL_2M's. This patch just fixes the printout: init_memory_mapping: [mem 0x00000000-0x000fffff] [mem 0x00000000-0x000fffff] page 4k init_memory_mapping: [mem 0x37000000-0x373fffff] [mem 0x37000000-0x373fffff] page 4M init_memory_mapping: [mem 0x00100000-0x36ffffff] [mem 0x00100000-0x003fffff] page 4k [mem 0x00400000-0x36ffffff] page 4M init_memory_mapping: [mem 0x37400000-0x377fdfff] [mem 0x37400000-0x377fdfff] page 4k BRK [0x03206000, 0x03206fff] PGTABLE Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/20150210212030.665EC267@viggo.jf.intel.com Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/init.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 079c3b6a3ff1..7ff24240d863 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -238,6 +238,31 @@ static void __init_refok adjust_range_page_size_mask(struct map_range *mr,
238 } 238 }
239} 239}
240 240
241static const char *page_size_string(struct map_range *mr)
242{
243 static const char str_1g[] = "1G";
244 static const char str_2m[] = "2M";
245 static const char str_4m[] = "4M";
246 static const char str_4k[] = "4k";
247
248 if (mr->page_size_mask & (1<<PG_LEVEL_1G))
249 return str_1g;
250 /*
251 * 32-bit without PAE has a 4M large page size.
252 * PG_LEVEL_2M is misnamed, but we can at least
253 * print out the right size in the string.
254 */
255 if (IS_ENABLED(CONFIG_X86_32) &&
256 !IS_ENABLED(CONFIG_X86_PAE) &&
257 mr->page_size_mask & (1<<PG_LEVEL_2M))
258 return str_4m;
259
260 if (mr->page_size_mask & (1<<PG_LEVEL_2M))
261 return str_2m;
262
263 return str_4k;
264}
265
241static int __meminit split_mem_range(struct map_range *mr, int nr_range, 266static int __meminit split_mem_range(struct map_range *mr, int nr_range,
242 unsigned long start, 267 unsigned long start,
243 unsigned long end) 268 unsigned long end)
@@ -333,8 +358,7 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
333 for (i = 0; i < nr_range; i++) 358 for (i = 0; i < nr_range; i++)
334 printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n", 359 printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n",
335 mr[i].start, mr[i].end - 1, 360 mr[i].start, mr[i].end - 1,
336 (mr[i].page_size_mask & (1<<PG_LEVEL_1G))?"1G":( 361 page_size_string(&mr[i]));
337 (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
338 362
339 return nr_range; 363 return nr_range;
340} 364}