All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: mm: Enhance Virtual kernel memory layout
@ 2016-04-13  7:49 Kefeng Wang
  2016-04-13  9:26 ` James Morse
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-04-13  7:49 UTC (permalink / raw)
  To: linux-arm-kernel

1) Show kernel excetion vector region and bss segment information.
2) Only show modules and PCI I/O with corresponding config enabled.
3) Each line with single pr_cont, or lead to anomalous print in dmesg.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
With this patch,

[    0.000000] Virtual kernel memory layout:
[    0.000000]      vector : 0xffffff8008084800 - 0xffffff8008084f80   (     1 KB)
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
[    0.000000]     .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
[    0.000000]       .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
[    0.000000]       .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
[    0.000000]        .bss : 0xffffff8008ba2400 - 0xffffff8008bdf738   (   245 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
[    0.000000]               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)

Before,

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
    .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
      .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
      .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
              0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)

 arch/arm64/mm/init.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index ea989d8..c6bcaa7 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -345,6 +345,9 @@ static void __init free_unused_memmap(void)
  */
 void __init mem_init(void)
 {
+	/* kernel exception vectors, 16 entries and each one with 128bytes */
+	extern char vectors[];
+
 	swiotlb_init(1);
 
 	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
@@ -363,34 +366,41 @@ void __init mem_init(void)
 #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
 
 	pr_notice("Virtual kernel memory layout:\n");
+	pr_cont("     vector : 0x%p - 0x%p   (%6ld KB)\n",
+		MLK(vectors, vectors + 0x780));
 #ifdef CONFIG_KASAN
 	pr_cont("    kasan   : 0x%16lx - 0x%16lx   (%6ld GB)\n",
 		MLG(KASAN_SHADOW_START, KASAN_SHADOW_END));
 #endif
+#ifdef CONFIG_MODULES
 	pr_cont("    modules : 0x%16lx - 0x%16lx   (%6ld MB)\n",
 		MLM(MODULES_VADDR, MODULES_END));
+#endif
 	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
 		MLG(VMALLOC_START, VMALLOC_END));
-	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
-		MLK_ROUNDUP(_text, __start_rodata),
-		MLK_ROUNDUP(__start_rodata, _etext),
-		MLK_ROUNDUP(__init_begin, __init_end),
+	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(_text, __start_rodata));
+	pr_cont("    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__start_rodata, _etext));
+	pr_cont("      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__init_begin, __init_end));
+	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
 		MLK_ROUNDUP(_sdata, _edata));
+	pr_cont("       .bss : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__bss_start, __bss_stop));
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
-	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n"
-		"              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
-		MLG(VMEMMAP_START,
-		    VMEMMAP_START + VMEMMAP_SIZE),
+	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
+		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
+	pr_cont("              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
 		MLM((unsigned long)phys_to_page(memblock_start_of_DRAM()),
 		    (unsigned long)virt_to_page(high_memory)));
 #endif
 	pr_cont("    fixed   : 0x%16lx - 0x%16lx   (%6ld KB)\n",
 		MLK(FIXADDR_START, FIXADDR_TOP));
+#ifdef CONFIG_PCI
 	pr_cont("    PCI I/O : 0x%16lx - 0x%16lx   (%6ld MB)\n",
 		MLM(PCI_IO_START, PCI_IO_END));
+#endif
 	pr_cont("    memory  : 0x%16lx - 0x%16lx   (%6ld MB)\n",
 		MLM(__phys_to_virt(memblock_start_of_DRAM()),
 		    (unsigned long)high_memory));
-- 
2.6.0.GIT

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH] arm64: mm: Enhance Virtual kernel memory layout
  2016-04-13  7:49 [PATCH] arm64: mm: Enhance Virtual kernel memory layout Kefeng Wang
@ 2016-04-13  9:26 ` James Morse
  2016-04-14  6:57   ` Kefeng Wang
  2016-04-15 17:20 ` Will Deacon
  2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
  2 siblings, 1 reply; 21+ messages in thread
From: James Morse @ 2016-04-13  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 13/04/16 08:49, Kefeng Wang wrote:
> 1) Show kernel excetion vector region and bss segment information.

Nit: exception


> 2) Only show modules and PCI I/O with corresponding config enabled.
> 3) Each line with single pr_cont, or lead to anomalous print in dmesg.

This commit message is a little confusing, it doesn't mention that this is to do
with the dump of the kernel memory layout during boot. I presume the motivation
is the missing time stamps when built with CONFIG_PRINTK_TIME.

Why add an entry for the vectors? They live in the text section, so this memory
is already covered. Adding it like this means the list is out of order.

It is probably better to put the splitting of pr_cont() into one per line in a
separate patch to adding new rows.


> ---
> With this patch,
> 
> [    0.000000] Virtual kernel memory layout:
> [    0.000000]      vector : 0xffffff8008084800 - 0xffffff8008084f80   (     1 KB)
> [    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
> [    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
> [    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
> [    0.000000]     .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
> [    0.000000]       .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
> [    0.000000]       .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
> [    0.000000]        .bss : 0xffffff8008ba2400 - 0xffffff8008bdf738   (   245 KB)
> [    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
> [    0.000000]               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
> [    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
> [    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
> [    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)
> 
> Before,
> 
> [    0.000000] Virtual kernel memory layout:
> [    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
> [    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
> [    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
>     .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
>       .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
>       .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
> [    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
>               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
> [    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
> [    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
> [    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)
> 
>  arch/arm64/mm/init.c | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index ea989d8..c6bcaa7 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -345,6 +345,9 @@ static void __init free_unused_memmap(void)
>   */
>  void __init mem_init(void)
>  {
> +	/* kernel exception vectors, 16 entries and each one with 128bytes */
> +	extern char vectors[];
> +
>  	swiotlb_init(1);
>  
>  	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
> @@ -363,34 +366,41 @@ void __init mem_init(void)
>  #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
>  
>  	pr_notice("Virtual kernel memory layout:\n");
> +	pr_cont("     vector : 0x%p - 0x%p   (%6ld KB)\n",
> +		MLK(vectors, vectors + 0x780));

0x780? Shouldn't this be 0x800, or better SZ_2K?


>  #ifdef CONFIG_KASAN
>  	pr_cont("    kasan   : 0x%16lx - 0x%16lx   (%6ld GB)\n",
>  		MLG(KASAN_SHADOW_START, KASAN_SHADOW_END));
>  #endif
> +#ifdef CONFIG_MODULES
>  	pr_cont("    modules : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>  		MLM(MODULES_VADDR, MODULES_END));
> +#endif
>  	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
>  		MLG(VMALLOC_START, VMALLOC_END));
> -	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n"
> -		"    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n"
> -		"      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n"
> -		"      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> -		MLK_ROUNDUP(_text, __start_rodata),
> -		MLK_ROUNDUP(__start_rodata, _etext),
> -		MLK_ROUNDUP(__init_begin, __init_end),
> +	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> +		MLK_ROUNDUP(_text, __start_rodata));
> +	pr_cont("    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> +		MLK_ROUNDUP(__start_rodata, _etext));
> +	pr_cont("      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> +		MLK_ROUNDUP(__init_begin, __init_end));
> +	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>  		MLK_ROUNDUP(_sdata, _edata));
> +	pr_cont("       .bss : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> +		MLK_ROUNDUP(__bss_start, __bss_stop));
>  #ifdef CONFIG_SPARSEMEM_VMEMMAP
> -	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n"
> -		"              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
> -		MLG(VMEMMAP_START,
> -		    VMEMMAP_START + VMEMMAP_SIZE),
> +	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
> +		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
> +	pr_cont("              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
>  		MLM((unsigned long)phys_to_page(memblock_start_of_DRAM()),
>  		    (unsigned long)virt_to_page(high_memory)));
>  #endif
>  	pr_cont("    fixed   : 0x%16lx - 0x%16lx   (%6ld KB)\n",
>  		MLK(FIXADDR_START, FIXADDR_TOP));
> +#ifdef CONFIG_PCI
>  	pr_cont("    PCI I/O : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>  		MLM(PCI_IO_START, PCI_IO_END));
> +#endif
>  	pr_cont("    memory  : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>  		MLM(__phys_to_virt(memblock_start_of_DRAM()),
>  		    (unsigned long)high_memory));
> 


Thanks,

James

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH] arm64: mm: Enhance Virtual kernel memory layout
  2016-04-13  9:26 ` James Morse
@ 2016-04-14  6:57   ` Kefeng Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-04-14  6:57 UTC (permalink / raw)
  To: linux-arm-kernel



On 2016/4/13 17:26, James Morse wrote:
> Hi,
> 
> On 13/04/16 08:49, Kefeng Wang wrote:
>> 1) Show kernel excetion vector region and bss segment information.
> 
> Nit: exception
> 
> 
>> 2) Only show modules and PCI I/O with corresponding config enabled.
>> 3) Each line with single pr_cont, or lead to anomalous print in dmesg.
> 
> This commit message is a little confusing, it doesn't mention that this is to do
> with the dump of the kernel memory layout during boot. I presume the motivation
> is the missing time stamps when built with CONFIG_PRINTK_TIME.

Right, the dmesg is not aligned when PRINTK_TIME enabled, due to the missing time stamps.

> 
> Why add an entry for the vectors? They live in the text section, so this memory
> is already covered. Adding it like this means the list is out of order.

Ok, the arm64 vectors don't have a fixed address, and it is in text section, seem
like it is not needed, not like in arm.

> 
> It is probably better to put the splitting of pr_cont() into one per line in a
> separate patch to adding new rows.

OK.

> 
> 
>> ---
>> With this patch,
>>
>> [    0.000000] Virtual kernel memory layout:
>> [    0.000000]      vector : 0xffffff8008084800 - 0xffffff8008084f80   (     1 KB)
>> [    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
>> [    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
>> [    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
>> [    0.000000]     .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
>> [    0.000000]       .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
>> [    0.000000]       .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
>> [    0.000000]        .bss : 0xffffff8008ba2400 - 0xffffff8008bdf738   (   245 KB)
>> [    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
>> [    0.000000]               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
>> [    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
>> [    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
>> [    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)
>>
>> Before,
>>
>> [    0.000000] Virtual kernel memory layout:
>> [    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
>> [    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
>> [    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
>>     .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
>>       .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
>>       .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
>> [    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
>>               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
>> [    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
>> [    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
>> [    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)
>>
>>  arch/arm64/mm/init.c | 32 +++++++++++++++++++++-----------
>>  1 file changed, 21 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> index ea989d8..c6bcaa7 100644
>> --- a/arch/arm64/mm/init.c
>> +++ b/arch/arm64/mm/init.c
>> @@ -345,6 +345,9 @@ static void __init free_unused_memmap(void)
>>   */
>>  void __init mem_init(void)
>>  {
>> +	/* kernel exception vectors, 16 entries and each one with 128bytes */
>> +	extern char vectors[];
>> +
>>  	swiotlb_init(1);
>>  
>>  	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
>> @@ -363,34 +366,41 @@ void __init mem_init(void)
>>  #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
>>  
>>  	pr_notice("Virtual kernel memory layout:\n");
>> +	pr_cont("     vector : 0x%p - 0x%p   (%6ld KB)\n",
>> +		MLK(vectors, vectors + 0x780));
> 
> 0x780? Shouldn't this be 0x800, or better SZ_2K?

Oh, my mistake, it should be SZ_2K.

> 
> 
>>  #ifdef CONFIG_KASAN
>>  	pr_cont("    kasan   : 0x%16lx - 0x%16lx   (%6ld GB)\n",
>>  		MLG(KASAN_SHADOW_START, KASAN_SHADOW_END));
>>  #endif
>> +#ifdef CONFIG_MODULES
>>  	pr_cont("    modules : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>>  		MLM(MODULES_VADDR, MODULES_END));
>> +#endif
>>  	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
>>  		MLG(VMALLOC_START, VMALLOC_END));
>> -	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n"
>> -		"    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n"
>> -		"      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n"
>> -		"      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>> -		MLK_ROUNDUP(_text, __start_rodata),
>> -		MLK_ROUNDUP(__start_rodata, _etext),
>> -		MLK_ROUNDUP(__init_begin, __init_end),
>> +	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>> +		MLK_ROUNDUP(_text, __start_rodata));
>> +	pr_cont("    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>> +		MLK_ROUNDUP(__start_rodata, _etext));
>> +	pr_cont("      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>> +		MLK_ROUNDUP(__init_begin, __init_end));
>> +	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>>  		MLK_ROUNDUP(_sdata, _edata));
>> +	pr_cont("       .bss : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>> +		MLK_ROUNDUP(__bss_start, __bss_stop));
>>  #ifdef CONFIG_SPARSEMEM_VMEMMAP
>> -	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n"
>> -		"              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
>> -		MLG(VMEMMAP_START,
>> -		    VMEMMAP_START + VMEMMAP_SIZE),
>> +	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
>> +		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
>> +	pr_cont("              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
>>  		MLM((unsigned long)phys_to_page(memblock_start_of_DRAM()),
>>  		    (unsigned long)virt_to_page(high_memory)));
>>  #endif
>>  	pr_cont("    fixed   : 0x%16lx - 0x%16lx   (%6ld KB)\n",
>>  		MLK(FIXADDR_START, FIXADDR_TOP));
>> +#ifdef CONFIG_PCI
>>  	pr_cont("    PCI I/O : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>>  		MLM(PCI_IO_START, PCI_IO_END));
>> +#endif
>>  	pr_cont("    memory  : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>>  		MLM(__phys_to_virt(memblock_start_of_DRAM()),
>>  		    (unsigned long)high_memory));
>>
> 
> 
> Thanks,
> 
> James
> 
> 
> .
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH] arm64: mm: Enhance Virtual kernel memory layout
  2016-04-13  7:49 [PATCH] arm64: mm: Enhance Virtual kernel memory layout Kefeng Wang
  2016-04-13  9:26 ` James Morse
@ 2016-04-15 17:20 ` Will Deacon
  2016-04-18  2:05   ` Kefeng Wang
  2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
  2 siblings, 1 reply; 21+ messages in thread
From: Will Deacon @ 2016-04-15 17:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kefeng,

On Wed, Apr 13, 2016 at 03:49:32PM +0800, Kefeng Wang wrote:
> 1) Show kernel excetion vector region and bss segment information.
> 2) Only show modules and PCI I/O with corresponding config enabled.
> 3) Each line with single pr_cont, or lead to anomalous print in dmesg.
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---

Can you post a new version of this patch addressing James's feedback,
please?

Thanks,

Will

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH] arm64: mm: Enhance Virtual kernel memory layout
  2016-04-15 17:20 ` Will Deacon
@ 2016-04-18  2:05   ` Kefeng Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-04-18  2:05 UTC (permalink / raw)
  To: linux-arm-kernel



On 2016/4/16 1:20, Will Deacon wrote:
> Hi Kefeng,
> 
> On Wed, Apr 13, 2016 at 03:49:32PM +0800, Kefeng Wang wrote:
>> 1) Show kernel excetion vector region and bss segment information.
>> 2) Only show modules and PCI I/O with corresponding config enabled.
>> 3) Each line with single pr_cont, or lead to anomalous print in dmesg.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
> 
> Can you post a new version of this patch addressing James's feedback,
> please?

Sorry for the later response, will do it ASAP.

Brs,
Kefeng

> 
> Thanks,
> 
> Will
> 
> .
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 0/3] arm64: mm: Enhance Virtual kernel memory layout
  2016-04-13  7:49 [PATCH] arm64: mm: Enhance Virtual kernel memory layout Kefeng Wang
  2016-04-13  9:26 ` James Morse
  2016-04-15 17:20 ` Will Deacon
@ 2016-04-18  3:09 ` Kefeng Wang
  2016-04-18  3:09   ` [PATCH v2 1/3] arm64: mm: make pr_cont() per line in " Kefeng Wang
                     ` (3 more replies)
  2 siblings, 4 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-04-18  3:09 UTC (permalink / raw)
  To: linux-arm-kernel

This is a micro enhance for Virtual kernel memory layout. Show bss info,
add restriction for modules and PCI I/O printing, and make each line with
single pr_cont().

With this patchset,

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008755000   (  6996 KB)
[    0.000000]     .rodata : 0xffffff8008755000 - 0xffffff8008a3d000   (  2976 KB)
[    0.000000]       .init : 0xffffff8008a3d000 - 0xffffff8008b09000   (   816 KB)
[    0.000000]       .data : 0xffffff8008b09000 - 0xffffff8008ba6800   (   630 KB)
[    0.000000]        .bss : 0xffffff8008ba6800 - 0xffffff8008be3738   (   244 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
[    0.000000]               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)

Before,

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
    .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
      .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
      .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
              0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)

Changes since v1:
- Drop vector info and spilt the patch, suggested by James Morse.

Kefeng Wang (3):
  arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  arm64: mm: Show bss segment in kernel memory layout
  arm64: mm: Restrictive printing for modules and PCI I/O in memory
    layout

 arch/arm64/mm/init.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

-- 
2.6.0.GIT

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
@ 2016-04-18  3:09   ` Kefeng Wang
  2016-04-18 11:16     ` James Morse
  2016-04-18  3:09   ` [PATCH v2 2/3] arm64: mm: Show bss segment in " Kefeng Wang
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 21+ messages in thread
From: Kefeng Wang @ 2016-04-18  3:09 UTC (permalink / raw)
  To: linux-arm-kernel

Each line with single pr_cont() in Virtual kernel memory layout,
or the dump of the kernel memory layout in dmesg is not aligned
when PRINTK_TIME enabled, due to the missing time stamps.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/mm/init.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index ea989d8..ce2e400 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -371,19 +371,18 @@ void __init mem_init(void)
 		MLM(MODULES_VADDR, MODULES_END));
 	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
 		MLG(VMALLOC_START, VMALLOC_END));
-	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
-		MLK_ROUNDUP(_text, __start_rodata),
-		MLK_ROUNDUP(__start_rodata, _etext),
-		MLK_ROUNDUP(__init_begin, __init_end),
+	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(_text, __start_rodata));
+	pr_cont("    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__start_rodata, _etext));
+	pr_cont("      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__init_begin, __init_end));
+	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
 		MLK_ROUNDUP(_sdata, _edata));
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
-	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n"
-		"              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
-		MLG(VMEMMAP_START,
-		    VMEMMAP_START + VMEMMAP_SIZE),
+	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
+		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
+	pr_cont("              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
 		MLM((unsigned long)phys_to_page(memblock_start_of_DRAM()),
 		    (unsigned long)virt_to_page(high_memory)));
 #endif
-- 
2.6.0.GIT

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] arm64: mm: Show bss segment in kernel memory layout
  2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
  2016-04-18  3:09   ` [PATCH v2 1/3] arm64: mm: make pr_cont() per line in " Kefeng Wang
@ 2016-04-18  3:09   ` Kefeng Wang
  2016-04-18 11:14     ` James Morse
  2016-04-18  3:09   ` [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in " Kefeng Wang
  2016-05-12 12:16   ` [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel " Kefeng Wang
  3 siblings, 1 reply; 21+ messages in thread
From: Kefeng Wang @ 2016-04-18  3:09 UTC (permalink / raw)
  To: linux-arm-kernel

Show the bss segment information as with text and data in Virtual
memory kernel layout.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/mm/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index ce2e400..c96fe51 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -379,6 +379,8 @@ void __init mem_init(void)
 		MLK_ROUNDUP(__init_begin, __init_end));
 	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
 		MLK_ROUNDUP(_sdata, _edata));
+	pr_cont("       .bss : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__bss_start, __bss_stop));
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
 		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
-- 
2.6.0.GIT

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in memory layout
  2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
  2016-04-18  3:09   ` [PATCH v2 1/3] arm64: mm: make pr_cont() per line in " Kefeng Wang
  2016-04-18  3:09   ` [PATCH v2 2/3] arm64: mm: Show bss segment in " Kefeng Wang
@ 2016-04-18  3:09   ` Kefeng Wang
  2016-04-18 11:15     ` James Morse
  2016-05-12 12:16   ` [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel " Kefeng Wang
  3 siblings, 1 reply; 21+ messages in thread
From: Kefeng Wang @ 2016-04-18  3:09 UTC (permalink / raw)
  To: linux-arm-kernel

The modules and PCI I/O informations in Virtual kernel memory layout
are inappropriate when corresponding config is not enabled, so don't
show them then.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/mm/init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index c96fe51..e06a445 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -367,8 +367,10 @@ void __init mem_init(void)
 	pr_cont("    kasan   : 0x%16lx - 0x%16lx   (%6ld GB)\n",
 		MLG(KASAN_SHADOW_START, KASAN_SHADOW_END));
 #endif
+#ifdef CONFIG_MODULES
 	pr_cont("    modules : 0x%16lx - 0x%16lx   (%6ld MB)\n",
 		MLM(MODULES_VADDR, MODULES_END));
+#endif
 	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
 		MLG(VMALLOC_START, VMALLOC_END));
 	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
@@ -390,8 +392,10 @@ void __init mem_init(void)
 #endif
 	pr_cont("    fixed   : 0x%16lx - 0x%16lx   (%6ld KB)\n",
 		MLK(FIXADDR_START, FIXADDR_TOP));
+#ifdef CONFIG_PCI
 	pr_cont("    PCI I/O : 0x%16lx - 0x%16lx   (%6ld MB)\n",
 		MLM(PCI_IO_START, PCI_IO_END));
+#endif
 	pr_cont("    memory  : 0x%16lx - 0x%16lx   (%6ld MB)\n",
 		MLM(__phys_to_virt(memblock_start_of_DRAM()),
 		    (unsigned long)high_memory));
-- 
2.6.0.GIT

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] arm64: mm: Show bss segment in kernel memory layout
  2016-04-18  3:09   ` [PATCH v2 2/3] arm64: mm: Show bss segment in " Kefeng Wang
@ 2016-04-18 11:14     ` James Morse
  0 siblings, 0 replies; 21+ messages in thread
From: James Morse @ 2016-04-18 11:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/04/16 04:09, Kefeng Wang wrote:
> Show the bss segment information as with text and data in Virtual
> memory kernel layout.
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/arm64/mm/init.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index ce2e400..c96fe51 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -379,6 +379,8 @@ void __init mem_init(void)
>  		MLK_ROUNDUP(__init_begin, __init_end));
>  	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
>  		MLK_ROUNDUP(_sdata, _edata));
> +	pr_cont("       .bss : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> +		MLK_ROUNDUP(__bss_start, __bss_stop));
>  #ifdef CONFIG_SPARSEMEM_VMEMMAP
>  	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
>  		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
> 

I think this is useful,

Acked-by: James Morse <james.morse@arm.com>


Thanks,

James

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in memory layout
  2016-04-18  3:09   ` [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in " Kefeng Wang
@ 2016-04-18 11:15     ` James Morse
  2016-04-19  7:08       ` Kefeng Wang
  0 siblings, 1 reply; 21+ messages in thread
From: James Morse @ 2016-04-18 11:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/04/16 04:09, Kefeng Wang wrote:
> The modules and PCI I/O informations in Virtual kernel memory layout
> are inappropriate when corresponding config is not enabled, so don't
> show them then.

I'm not sure about this, it looks like these areas are still reserved, so this
is still useful debug information. mm/dump.c will still print any mappings in
these ranges, its good to be consistent.


Thanks,

James

> ---
>  arch/arm64/mm/init.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index c96fe51..e06a445 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -367,8 +367,10 @@ void __init mem_init(void)
>  	pr_cont("    kasan   : 0x%16lx - 0x%16lx   (%6ld GB)\n",
>  		MLG(KASAN_SHADOW_START, KASAN_SHADOW_END));
>  #endif
> +#ifdef CONFIG_MODULES
>  	pr_cont("    modules : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>  		MLM(MODULES_VADDR, MODULES_END));
> +#endif
>  	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
>  		MLG(VMALLOC_START, VMALLOC_END));
>  	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
> @@ -390,8 +392,10 @@ void __init mem_init(void)
>  #endif
>  	pr_cont("    fixed   : 0x%16lx - 0x%16lx   (%6ld KB)\n",
>  		MLK(FIXADDR_START, FIXADDR_TOP));
> +#ifdef CONFIG_PCI
>  	pr_cont("    PCI I/O : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>  		MLM(PCI_IO_START, PCI_IO_END));
> +#endif
>  	pr_cont("    memory  : 0x%16lx - 0x%16lx   (%6ld MB)\n",
>  		MLM(__phys_to_virt(memblock_start_of_DRAM()),
>  		    (unsigned long)high_memory));
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  2016-04-18  3:09   ` [PATCH v2 1/3] arm64: mm: make pr_cont() per line in " Kefeng Wang
@ 2016-04-18 11:16     ` James Morse
  2016-04-18 11:21       ` Ard Biesheuvel
  0 siblings, 1 reply; 21+ messages in thread
From: James Morse @ 2016-04-18 11:16 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/04/16 04:09, Kefeng Wang wrote:
> Each line with single pr_cont() in Virtual kernel memory layout,
> or the dump of the kernel memory layout in dmesg is not aligned
> when PRINTK_TIME enabled, due to the missing time stamps.

Looks good to me, but I can't reproduce the miss-aligned output on v4.6-rc4, I get:
> [    0.000000] .text : 0xffffff8008080000 - 0xffffff8008887000   (  8220 KB)
> [    0.000000] .rodata : 0xffffff8008887000 - 0xffffff8008bdc000 (  3412 KB)
> [    0.000000] .init : 0xffffff8008bdc000 - 0xffffff8008cc3000   (   924 KB)
> [    0.000000] .data : 0xffffff8008cc3000 - 0xffffff8008dd7200   (  1105 KB)

without this patch, but it evidently happens for you. Do you have any special
build options or kernel version? I'd like to understand if there is some
kconfig/earlycon option that affects this!


Thanks,

James

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  2016-04-18 11:16     ` James Morse
@ 2016-04-18 11:21       ` Ard Biesheuvel
  2016-04-18 13:13         ` James Morse
  0 siblings, 1 reply; 21+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 11:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 18 April 2016 at 13:16, James Morse <james.morse@arm.com> wrote:
> On 18/04/16 04:09, Kefeng Wang wrote:
>> Each line with single pr_cont() in Virtual kernel memory layout,
>> or the dump of the kernel memory layout in dmesg is not aligned
>> when PRINTK_TIME enabled, due to the missing time stamps.
>
> Looks good to me, but I can't reproduce the miss-aligned output on v4.6-rc4, I get:
>> [    0.000000] .text : 0xffffff8008080000 - 0xffffff8008887000   (  8220 KB)
>> [    0.000000] .rodata : 0xffffff8008887000 - 0xffffff8008bdc000 (  3412 KB)
>> [    0.000000] .init : 0xffffff8008bdc000 - 0xffffff8008cc3000   (   924 KB)
>> [    0.000000] .data : 0xffffff8008cc3000 - 0xffffff8008dd7200   (  1105 KB)
>
> without this patch, but it evidently happens for you. Do you have any special
> build options or kernel version? I'd like to understand if there is some
> kconfig/earlycon option that affects this!
>

Interestingly, for me it only occurs when running dmesg, and not when
observing the output from the console directly.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  2016-04-18 11:21       ` Ard Biesheuvel
@ 2016-04-18 13:13         ` James Morse
  2016-04-19  5:58           ` Kefeng Wang
  0 siblings, 1 reply; 21+ messages in thread
From: James Morse @ 2016-04-18 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ard,

On 18/04/16 12:21, Ard Biesheuvel wrote:
> On 18 April 2016 at 13:16, James Morse <james.morse@arm.com> wrote:
>> On 18/04/16 04:09, Kefeng Wang wrote:
>>> Each line with single pr_cont() in Virtual kernel memory layout,
>>> or the dump of the kernel memory layout in dmesg is not aligned
>>> when PRINTK_TIME enabled, due to the missing time stamps.
>>
>> Looks good to me, but I can't reproduce the miss-aligned output on v4.6-rc4, I get:
>>> [    0.000000] .text : 0xffffff8008080000 - 0xffffff8008887000   (  8220 KB)
>>> [    0.000000] .rodata : 0xffffff8008887000 - 0xffffff8008bdc000 (  3412 KB)
>>> [    0.000000] .init : 0xffffff8008bdc000 - 0xffffff8008cc3000   (   924 KB)
>>> [    0.000000] .data : 0xffffff8008cc3000 - 0xffffff8008dd7200   (  1105 KB)
>>
>> without this patch, but it evidently happens for you. Do you have any special
>> build options or kernel version? I'd like to understand if there is some
>> kconfig/earlycon option that affects this!
>>
> 
> Interestingly, for me it only occurs when running dmesg, and not when
> observing the output from the console directly.

Hmmm, after some more digging: dmesg on Ubuntu 15.04 miss-aligns this, but
Ubuntu 14.04 doesn't....

Regardless, the patch fixes it, (and it looks the same on both ubuntu versions):
Tested-by: James Morse <james.morse@arm.com>


>From the comment above 'pr_cont()' in include/linux/printk.h:
> * Like KERN_CONT, pr_cont() should only be used when continuing
> * a line with no newline ('\n') enclosed. Otherwise it defaults
> * back to KERN_DEFAULT.

arm64 is probably confusing dmesg with its use of pr_cont("...\n").


Thanks,

James


15.04: util-linux 2.25.2-4ubuntu3
14.04: util-linux 2.20.1-5.1ubuntu20

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  2016-04-18 13:13         ` James Morse
@ 2016-04-19  5:58           ` Kefeng Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-04-19  5:58 UTC (permalink / raw)
  To: linux-arm-kernel



On 2016/4/18 21:13, James Morse wrote:
> Hi Ard,
> 
> On 18/04/16 12:21, Ard Biesheuvel wrote:
>> On 18 April 2016 at 13:16, James Morse <james.morse@arm.com> wrote:
>>> On 18/04/16 04:09, Kefeng Wang wrote:
>>>> Each line with single pr_cont() in Virtual kernel memory layout,
>>>> or the dump of the kernel memory layout in dmesg is not aligned
>>>> when PRINTK_TIME enabled, due to the missing time stamps.
>>>
>>> Looks good to me, but I can't reproduce the miss-aligned output on v4.6-rc4, I get:
>>>> [    0.000000] .text : 0xffffff8008080000 - 0xffffff8008887000   (  8220 KB)
>>>> [    0.000000] .rodata : 0xffffff8008887000 - 0xffffff8008bdc000 (  3412 KB)
>>>> [    0.000000] .init : 0xffffff8008bdc000 - 0xffffff8008cc3000   (   924 KB)
>>>> [    0.000000] .data : 0xffffff8008cc3000 - 0xffffff8008dd7200   (  1105 KB)
>>>
>>> without this patch, but it evidently happens for you. Do you have any special
>>> build options or kernel version? I'd like to understand if there is some
>>> kconfig/earlycon option that affects this!
>>>
>>
>> Interestingly, for me it only occurs when running dmesg, and not when
>> observing the output from the console directly.
> 
> Hmmm, after some more digging: dmesg on Ubuntu 15.04 miss-aligns this, but
> Ubuntu 14.04 doesn't....
> 
> Regardless, the patch fixes it, (and it looks the same on both ubuntu versions):
> Tested-by: James Morse <james.morse@arm.com>
> 

Thanks :)

> 
>>From the comment above 'pr_cont()' in include/linux/printk.h:
>> * Like KERN_CONT, pr_cont() should only be used when continuing
>> * a line with no newline ('\n') enclosed. Otherwise it defaults
>> * back to KERN_DEFAULT.
> 
> arm64 is probably confusing dmesg with its use of pr_cont("...\n").

After check the util-linux, find this commit(b45c3da2e1581 tags/v2.26-rc2~86)

commit b45c3da2e15814ca0c5b2ed2608de34df60af4da
Author: Ingo Br<C3><BC>ckl <ib@wupperonline.de>
Date:   Wed Jan 14 19:36:55 2015 +0100

    dmesg: Enable proper indent for messages containing line breaks

    Messages containing line breaks somehow look broken when additional time,
    facility or level information is displayed, because they partly appear in
    time/facility/level column.

    Indent them accordingly.

    Signed-off-by: Karel Zak <kzak@redhat.com>

After with this patch, the dmesg shows below,

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008755000   (  6996 KB)
                   .rodata : 0xffffff8008755000 - 0xffffff8008a3d000   (  2976 KB)
                     .init : 0xffffff8008a3d000 - 0xffffff8008b09000   (   816 KB)
                     .data : 0xffffff8008b09000 - 0xffffff8008ba6800   (   630 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
                             0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)


BRs,
Kefeng

> 
> 
> Thanks,
> 
> James
> 
> 
> 15.04: util-linux 2.25.2-4ubuntu3
> 14.04: util-linux 2.20.1-5.1ubuntu20
> 
> .
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in memory layout
  2016-04-18 11:15     ` James Morse
@ 2016-04-19  7:08       ` Kefeng Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-04-19  7:08 UTC (permalink / raw)
  To: linux-arm-kernel



On 2016/4/18 19:15, James Morse wrote:
> On 18/04/16 04:09, Kefeng Wang wrote:
>> The modules and PCI I/O informations in Virtual kernel memory layout
>> are inappropriate when corresponding config is not enabled, so don't
>> show them then.
> 
> I'm not sure about this, it looks like these areas are still reserved, so this
> is still useful debug information. mm/dump.c will still print any mappings in
> these ranges, its good to be consistent.

If the CONFIG is not enabled,  I think the areas will not be reserved and not mapped,
correct me if I am wrong. so it looks useless, but keeping them is ok for me.

BRs,
Kefeng

> 
> 
> Thanks,
> 
> James
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel memory layout
  2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
                     ` (2 preceding siblings ...)
  2016-04-18  3:09   ` [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in " Kefeng Wang
@ 2016-05-12 12:16   ` Kefeng Wang
  2016-05-12 12:16     ` [PATCH v3 1/2] arm64: mm: make pr_cont() per line in " Kefeng Wang
                       ` (2 more replies)
  3 siblings, 3 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-05-12 12:16 UTC (permalink / raw)
  To: linux-arm-kernel

This is a micro enhance for Virtual kernel memory layout. Show bss info,
and make each line with single pr_cont().

With this patchset,

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008755000   (  6996 KB)
[    0.000000]     .rodata : 0xffffff8008755000 - 0xffffff8008a3d000   (  2976 KB)
[    0.000000]       .init : 0xffffff8008a3d000 - 0xffffff8008b09000   (   816 KB)
[    0.000000]       .data : 0xffffff8008b09000 - 0xffffff8008ba6800   (   630 KB)
[    0.000000]        .bss : 0xffffff8008ba6800 - 0xffffff8008be3738   (   244 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
[    0.000000]               0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)

Before,

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000   (   246 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8008753000   (  6988 KB)
    .rodata : 0xffffff8008753000 - 0xffffff8008a3a000   (  2972 KB)
      .init : 0xffffff8008a3a000 - 0xffffff8008b06000   (   816 KB)
      .data : 0xffffff8008b06000 - 0xffffff8008ba2400   (   625 KB)
[    0.000000]     vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
              0xffffffbdc0000000 - 0xffffffbdc8000000   (   128 MB actual)
[    0.000000]     fixed   : 0xffffffbffe7fd000 - 0xffffffbffec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000   (    16 MB)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc200000000   (  8192 MB)

Changes since v2:
- Add tested/ack by James Morse.
- Remove restrictive printing, keep the same as mm/dump.c.

Changes since v1:
- Drop vector info and spilt the patch, suggested by James Morse.

Kefeng Wang (2):
  arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  arm64: mm: Show bss segment in kernel memory layout

 arch/arm64/mm/init.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

-- 
2.6.0.GIT

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v3 1/2] arm64: mm: make pr_cont() per line in Virtual kernel memory layout
  2016-05-12 12:16   ` [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel " Kefeng Wang
@ 2016-05-12 12:16     ` Kefeng Wang
  2016-05-12 12:16     ` [PATCH v3 2/2] arm64: mm: Show bss segment in " Kefeng Wang
  2016-05-12 13:36     ` [PATCH v3 0/2] arm64: mm: Enhance Virtual " Will Deacon
  2 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-05-12 12:16 UTC (permalink / raw)
  To: linux-arm-kernel

Each line with single pr_cont() in Virtual kernel memory layout,
or the dump of the kernel memory layout in dmesg is not aligned
when PRINTK_TIME enabled, due to the missing time stamps.

Tested-by: James Morse <james.morse@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/mm/init.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index ea989d8..ce2e400 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -371,19 +371,18 @@ void __init mem_init(void)
 		MLM(MODULES_VADDR, MODULES_END));
 	pr_cont("    vmalloc : 0x%16lx - 0x%16lx   (%6ld GB)\n",
 		MLG(VMALLOC_START, VMALLOC_END));
-	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n"
-		"      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
-		MLK_ROUNDUP(_text, __start_rodata),
-		MLK_ROUNDUP(__start_rodata, _etext),
-		MLK_ROUNDUP(__init_begin, __init_end),
+	pr_cont("      .text : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(_text, __start_rodata));
+	pr_cont("    .rodata : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__start_rodata, _etext));
+	pr_cont("      .init : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__init_begin, __init_end));
+	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
 		MLK_ROUNDUP(_sdata, _edata));
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
-	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n"
-		"              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
-		MLG(VMEMMAP_START,
-		    VMEMMAP_START + VMEMMAP_SIZE),
+	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
+		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
+	pr_cont("              0x%16lx - 0x%16lx   (%6ld MB actual)\n",
 		MLM((unsigned long)phys_to_page(memblock_start_of_DRAM()),
 		    (unsigned long)virt_to_page(high_memory)));
 #endif
-- 
2.6.0.GIT

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v3 2/2] arm64: mm: Show bss segment in kernel memory layout
  2016-05-12 12:16   ` [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel " Kefeng Wang
  2016-05-12 12:16     ` [PATCH v3 1/2] arm64: mm: make pr_cont() per line in " Kefeng Wang
@ 2016-05-12 12:16     ` Kefeng Wang
  2016-05-12 13:36     ` [PATCH v3 0/2] arm64: mm: Enhance Virtual " Will Deacon
  2 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-05-12 12:16 UTC (permalink / raw)
  To: linux-arm-kernel

Show the bss segment information as with text and data in Virtual
memory kernel layout.

Acked-by: James Morse <james.morse@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/mm/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index ce2e400..c96fe51 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -379,6 +379,8 @@ void __init mem_init(void)
 		MLK_ROUNDUP(__init_begin, __init_end));
 	pr_cont("      .data : 0x%p" " - 0x%p" "   (%6ld KB)\n",
 		MLK_ROUNDUP(_sdata, _edata));
+	pr_cont("       .bss : 0x%p" " - 0x%p" "   (%6ld KB)\n",
+		MLK_ROUNDUP(__bss_start, __bss_stop));
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 	pr_cont("    vmemmap : 0x%16lx - 0x%16lx   (%6ld GB maximum)\n",
 		MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE));
-- 
2.6.0.GIT

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel memory layout
  2016-05-12 12:16   ` [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel " Kefeng Wang
  2016-05-12 12:16     ` [PATCH v3 1/2] arm64: mm: make pr_cont() per line in " Kefeng Wang
  2016-05-12 12:16     ` [PATCH v3 2/2] arm64: mm: Show bss segment in " Kefeng Wang
@ 2016-05-12 13:36     ` Will Deacon
  2016-05-13  1:21       ` Kefeng Wang
  2 siblings, 1 reply; 21+ messages in thread
From: Will Deacon @ 2016-05-12 13:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 12, 2016 at 08:16:25PM +0800, Kefeng Wang wrote:
> This is a micro enhance for Virtual kernel memory layout. Show bss info,
> and make each line with single pr_cont().

I already queued[1] the previous version of this after James acked it,
so if you want to make further changes, please send incremental patches
for review.

Will

[1]
https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git/commit/?h=for-next/core&id=9974723e31d1fa99e3c0efb2ae6cbbf089c0080c
https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git/commit/?h=for-next/core&id=d32351c8242b7067b3f3e3a6caf7a387ff43f978

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel memory layout
  2016-05-12 13:36     ` [PATCH v3 0/2] arm64: mm: Enhance Virtual " Will Deacon
@ 2016-05-13  1:21       ` Kefeng Wang
  0 siblings, 0 replies; 21+ messages in thread
From: Kefeng Wang @ 2016-05-13  1:21 UTC (permalink / raw)
  To: linux-arm-kernel



On 2016/5/12 21:36, Will Deacon wrote:
> On Thu, May 12, 2016 at 08:16:25PM +0800, Kefeng Wang wrote:
>> This is a micro enhance for Virtual kernel memory layout. Show bss info,
>> and make each line with single pr_cont().
> 
> I already queued[1] the previous version of this after James acked it,
> so if you want to make further changes, please send incremental patches
> for review.
> 

I can't see them before, thanks Will.

BRs,
Kefeng


> Will
> 
> [1]
> https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git/commit/?h=for-next/core&id=9974723e31d1fa99e3c0efb2ae6cbbf089c0080c
> https://git.kernel.org/cgit/linux/kernel/git/arm64/linux.git/commit/?h=for-next/core&id=d32351c8242b7067b3f3e3a6caf7a387ff43f978
> 
> .
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-05-13  1:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13  7:49 [PATCH] arm64: mm: Enhance Virtual kernel memory layout Kefeng Wang
2016-04-13  9:26 ` James Morse
2016-04-14  6:57   ` Kefeng Wang
2016-04-15 17:20 ` Will Deacon
2016-04-18  2:05   ` Kefeng Wang
2016-04-18  3:09 ` [PATCH v2 0/3] " Kefeng Wang
2016-04-18  3:09   ` [PATCH v2 1/3] arm64: mm: make pr_cont() per line in " Kefeng Wang
2016-04-18 11:16     ` James Morse
2016-04-18 11:21       ` Ard Biesheuvel
2016-04-18 13:13         ` James Morse
2016-04-19  5:58           ` Kefeng Wang
2016-04-18  3:09   ` [PATCH v2 2/3] arm64: mm: Show bss segment in " Kefeng Wang
2016-04-18 11:14     ` James Morse
2016-04-18  3:09   ` [PATCH v2 3/3] arm64: mm: Restrictive printing for modules and PCI I/O in " Kefeng Wang
2016-04-18 11:15     ` James Morse
2016-04-19  7:08       ` Kefeng Wang
2016-05-12 12:16   ` [PATCH v3 0/2] arm64: mm: Enhance Virtual kernel " Kefeng Wang
2016-05-12 12:16     ` [PATCH v3 1/2] arm64: mm: make pr_cont() per line in " Kefeng Wang
2016-05-12 12:16     ` [PATCH v3 2/2] arm64: mm: Show bss segment in " Kefeng Wang
2016-05-12 13:36     ` [PATCH v3 0/2] arm64: mm: Enhance Virtual " Will Deacon
2016-05-13  1:21       ` Kefeng Wang

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.