[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86b0a2c6-91ee-6ea6-92e7-1e5235b559f5@deltatee.com>
Date: Mon, 18 Nov 2019 09:44:14 -0700
From: Logan Gunthorpe <logang@...tatee.com>
To: Yash Shah <yash.shah@...ive.com>,
"Paul Walmsley ( Sifive)" <paul.walmsley@...ive.com>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "palmer@...belt.com" <palmer@...belt.com>,
"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
"Anup.Patel@....com" <Anup.Patel@....com>,
"rppt@...ux.ibm.com" <rppt@...ux.ibm.com>,
"ren_guo@...ky.com" <ren_guo@...ky.com>,
"bmeng.cn@...il.com" <bmeng.cn@...il.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"wangkefeng.wang@...wei.com" <wangkefeng.wang@...wei.com>,
Sachin Ghadi <sachin.ghadi@...ive.com>
Subject: Re: [PATCH v2] RISC-V: Add address map dumper
On 2019-11-17 10:58 p.m., Yash Shah wrote:
> Add support for dumping the kernel address space layout to the console.
> User can enable CONFIG_DEBUG_VM to dump the virtual memory region into
> dmesg buffer during boot-up.
>
> Signed-off-by: Yash Shah <yash.shah@...ive.com>
Looks good to me, thanks.
Reviewed-by: Logan Gunthorpe <logang@...tatee.com>
> ---
> This patch is based on Linux 5.4-rc6 and tested on SiFive HiFive
> Unleashed board.
>
> Changes in v2:
> - Avoid #ifdefs inside functions
> - Helper functions instead of macros
> - Drop newly added CONFIG_DEBUG_VM_LAYOUT, instead use CONFIG_DEBUG_VM
> ---
> arch/riscv/mm/init.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 573463d..7828136 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -45,6 +45,41 @@ void setup_zero_page(void)
> memset((void *)empty_zero_page, 0, PAGE_SIZE);
> }
>
> +#ifdef CONFIG_DEBUG_VM
> +static inline void print_mlk(char *name, unsigned long b, unsigned long t)
> +{
> + pr_notice("%12s : 0x%08lx - 0x%08lx (%4ld kB)\n", name, b, t,
> + (((t) - (b)) >> 10));
> +}
> +
> +static inline void print_mlm(char *name, unsigned long b, unsigned long t)
> +{
> + pr_notice("%12s : 0x%08lx - 0x%08lx (%4ld MB)\n", name, b, t,
> + (((t) - (b)) >> 20));
> +}
> +
> +static void print_vm_layout(void)
> +{
> + pr_notice("Virtual kernel memory layout:\n");
> + print_mlk("fixmap", (unsigned long)FIXADDR_START,
> + (unsigned long)FIXADDR_TOP);
> + print_mlm("vmemmap", (unsigned long)VMEMMAP_START,
> + (unsigned long)VMEMMAP_END);
> + print_mlm("vmalloc", (unsigned long)VMALLOC_START,
> + (unsigned long)VMALLOC_END);
> + print_mlm("lowmem", (unsigned long)PAGE_OFFSET,
> + (unsigned long)high_memory);
> + print_mlk(".init", (unsigned long)__init_begin,
> + (unsigned long)__init_end);
> + print_mlk(".text", (unsigned long)_text, (unsigned long)_etext);
> + print_mlk(".data", (unsigned long)_sdata, (unsigned long)_edata);
> + print_mlk(".bss", (unsigned long)__bss_start,
> + (unsigned long)__bss_stop);
> +}
> +#else
> +static void print_vm_layout(void) { }
> +#endif /* CONFIG_DEBUG_VM */
> +
> void __init mem_init(void)
> {
> #ifdef CONFIG_FLATMEM
> @@ -55,6 +90,7 @@ void __init mem_init(void)
> memblock_free_all();
>
> mem_init_print_info(NULL);
> + print_vm_layout();
> }
>
> #ifdef CONFIG_BLK_DEV_INITRD
>
Powered by blists - more mailing lists