Thread (4 messages) 4 messages, 3 authors, 2017-08-31

Re: [PATCH] powerpc/mm: Fix mapped range information print during boot

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-05-03 09:32:40
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Michael Ellerman, Linus Torvalds

Anshuman Khandual [off-list ref] writes:
This is a trivial fix patch regarding mapped ranges in radix MMU
environment during boot. No functional change.

Before the patch:

$dmesg | grep Mapped
[    0.000000] Mapped range 0x0 - 0x2000000000 with 0x40000000
[    0.000000] Mapped range 0x200000000000 - 0x202000000000 with 0x40000000

After the patch:

$dmesg | grep Mapped
[    0.000000] Mapped range 0x0000000000000000 - 0x0000002000000000 with 1024 MB
[    0.000000] Mapped range 0x0000200000000000 - 0x0000202000000000 with 1024 MB
It's a bit better, how about this instead?
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index c28165d8970b..519cfef569d1 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -8,9 +8,14 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+
+#define pr_fmt(fmt) "radix-mmu: " fmt
+
+#include <linux/kernel.h>
 #include <linux/sched/mm.h>
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
+#include <linux/string_helpers.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -112,10 +117,14 @@ static inline void __meminit print_mapping(unsigned long start,
 					   unsigned long end,
 					   unsigned long size)
 {
+	char buf[10];
+
 	if (end <= start)
 		return;
 
-	pr_info("Mapped range 0x%lx - 0x%lx with 0x%lx\n", start, end, size);
+	string_get_size(size, 1, STRING_UNITS_2, buf, sizeof(buf));
+
+	pr_info("Mapped 0x%016lx-0x%016lx with %s pages\n", start, end, buf);
 }
 
 static int __meminit create_physical_mapping(unsigned long start,

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help