From: Mike Rapoport <rppt@linux.ibm.com>
To: Yash Shah <yash.shah@sifive.com>
Cc: "aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
"Anup.Patel@wdc.com" <Anup.Patel@wdc.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Sachin Ghadi <sachin.ghadi@sifive.com>,
"palmer@dabbelt.com" <palmer@dabbelt.com>,
"ren_guo@c-sky.com" <ren_guo@c-sky.com>,
"Paul Walmsley \( Sifive\)" <paul.walmsley@sifive.com>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"bmeng.cn@gmail.com" <bmeng.cn@gmail.com>,
"logang@deltatee.com" <logang@deltatee.com>,
"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [PATCH] RISC-V: Add address map dumper
Date: Mon, 11 Nov 2019 22:56:48 +0100 [thread overview]
Message-ID: <20191111215647.GB10647@linux.ibm.com> (raw)
In-Reply-To: <1573450015-16475-1-git-send-email-yash.shah@sifive.com>
Hi,
On Mon, Nov 11, 2019 at 05:27:25AM +0000, Yash Shah wrote:
> Add support for dumping the kernel address space layout to the console.
> User can enable CONFIG_DEBUG_VM_LAYOUT to dump the virtual memory region
> into dmesg buffer during boot-up.
>
> Signed-off-by: Yash Shah <yash.shah@sifive.com>
> ---
> This patch is based on Linux 5.4-rc6 and tested on SiFive HiFive Unleashed
> board.
> ---
> arch/riscv/Kconfig.debug | 9 +++++++++
> arch/riscv/mm/init.c | 30 ++++++++++++++++++++++++++++++
> 2 files changed, 39 insertions(+)
>
> diff --git a/arch/riscv/Kconfig.debug b/arch/riscv/Kconfig.debug
> index e69de29..cdedfd3 100644
> --- a/arch/riscv/Kconfig.debug
> +++ b/arch/riscv/Kconfig.debug
> @@ -0,0 +1,9 @@
> +config DEBUG_VM_LAYOUT
I believe this could be enabled when CONFIG_DEBUG_VM=y without adding yet
another architecture specific Kconfig option.
> + bool "Print virtual memory layout on boot up"
> + depends on DEBUG_KERNEL
> + help
> + Say Y here if you want to dump the kernel virtual memory layout to
> + dmesg log on boot up. This information is only useful for kernel
> + developers who are working in architecture specific areas of the
> + kernel. It is probably not a good idea to enable this feature in a
> + production kernel.
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 79cfb35..fcb8144 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -55,6 +55,36 @@ void __init mem_init(void)
> memblock_free_all();
>
> mem_init_print_info(NULL);
> +#ifdef CONFIG_DEBUG_VM_LAYOUT
> +#define MLK(b, t) b, t, (((t) - (b)) >> 10)
> +#define MLM(b, t) b, t, (((t) - (b)) >> 20)
> +#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
> +
> +
> + pr_notice("Virtual kernel memory layout:\n"
> + " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
> + " vmemmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
> + " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
> + " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
> + " .init : 0x%px - 0x%px (%4td kB)\n"
> + " .text : 0x%px - 0x%px (%4td kB)\n"
> + " .data : 0x%px - 0x%px (%4td kB)\n"
> + " .bss : 0x%px - 0x%px (%4td kB)\n",
> +
> + MLK(FIXADDR_START, FIXADDR_TOP),
> + MLM(VMEMMAP_START, VMEMMAP_END),
> + MLM(VMALLOC_START, VMALLOC_END),
> + MLM(PAGE_OFFSET, (unsigned long)high_memory),
> +
> + MLK_ROUNDUP(__init_begin, __init_end),
> + MLK_ROUNDUP(_text, _etext),
> + MLK_ROUNDUP(_sdata, _edata),
> + MLK_ROUNDUP(__bss_start, __bss_stop));
> +
> +#undef MLK
> +#undef MLM
> +#undef MLK_ROUNDUP
> +#endif
> }
>
> #ifdef CONFIG_BLK_DEV_INITRD
> --
> 2.7.4
>
--
Sincerely yours,
Mike.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Mike Rapoport <rppt@linux.ibm.com>
To: Yash Shah <yash.shah@sifive.com>
Cc: "Paul Walmsley ( Sifive)" <paul.walmsley@sifive.com>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"palmer@dabbelt.com" <palmer@dabbelt.com>,
"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
"Anup.Patel@wdc.com" <Anup.Patel@wdc.com>,
"logang@deltatee.com" <logang@deltatee.com>,
"ren_guo@c-sky.com" <ren_guo@c-sky.com>,
"bmeng.cn@gmail.com" <bmeng.cn@gmail.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
Sachin Ghadi <sachin.ghadi@sifive.com>
Subject: Re: [PATCH] RISC-V: Add address map dumper
Date: Mon, 11 Nov 2019 22:56:48 +0100 [thread overview]
Message-ID: <20191111215647.GB10647@linux.ibm.com> (raw)
In-Reply-To: <1573450015-16475-1-git-send-email-yash.shah@sifive.com>
Hi,
On Mon, Nov 11, 2019 at 05:27:25AM +0000, Yash Shah wrote:
> Add support for dumping the kernel address space layout to the console.
> User can enable CONFIG_DEBUG_VM_LAYOUT to dump the virtual memory region
> into dmesg buffer during boot-up.
>
> Signed-off-by: Yash Shah <yash.shah@sifive.com>
> ---
> This patch is based on Linux 5.4-rc6 and tested on SiFive HiFive Unleashed
> board.
> ---
> arch/riscv/Kconfig.debug | 9 +++++++++
> arch/riscv/mm/init.c | 30 ++++++++++++++++++++++++++++++
> 2 files changed, 39 insertions(+)
>
> diff --git a/arch/riscv/Kconfig.debug b/arch/riscv/Kconfig.debug
> index e69de29..cdedfd3 100644
> --- a/arch/riscv/Kconfig.debug
> +++ b/arch/riscv/Kconfig.debug
> @@ -0,0 +1,9 @@
> +config DEBUG_VM_LAYOUT
I believe this could be enabled when CONFIG_DEBUG_VM=y without adding yet
another architecture specific Kconfig option.
> + bool "Print virtual memory layout on boot up"
> + depends on DEBUG_KERNEL
> + help
> + Say Y here if you want to dump the kernel virtual memory layout to
> + dmesg log on boot up. This information is only useful for kernel
> + developers who are working in architecture specific areas of the
> + kernel. It is probably not a good idea to enable this feature in a
> + production kernel.
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 79cfb35..fcb8144 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -55,6 +55,36 @@ void __init mem_init(void)
> memblock_free_all();
>
> mem_init_print_info(NULL);
> +#ifdef CONFIG_DEBUG_VM_LAYOUT
> +#define MLK(b, t) b, t, (((t) - (b)) >> 10)
> +#define MLM(b, t) b, t, (((t) - (b)) >> 20)
> +#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
> +
> +
> + pr_notice("Virtual kernel memory layout:\n"
> + " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
> + " vmemmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
> + " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
> + " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
> + " .init : 0x%px - 0x%px (%4td kB)\n"
> + " .text : 0x%px - 0x%px (%4td kB)\n"
> + " .data : 0x%px - 0x%px (%4td kB)\n"
> + " .bss : 0x%px - 0x%px (%4td kB)\n",
> +
> + MLK(FIXADDR_START, FIXADDR_TOP),
> + MLM(VMEMMAP_START, VMEMMAP_END),
> + MLM(VMALLOC_START, VMALLOC_END),
> + MLM(PAGE_OFFSET, (unsigned long)high_memory),
> +
> + MLK_ROUNDUP(__init_begin, __init_end),
> + MLK_ROUNDUP(_text, _etext),
> + MLK_ROUNDUP(_sdata, _edata),
> + MLK_ROUNDUP(__bss_start, __bss_stop));
> +
> +#undef MLK
> +#undef MLM
> +#undef MLK_ROUNDUP
> +#endif
> }
>
> #ifdef CONFIG_BLK_DEV_INITRD
> --
> 2.7.4
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2019-11-11 21:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 5:27 [PATCH] RISC-V: Add address map dumper Yash Shah
2019-11-11 5:27 ` Yash Shah
2019-11-11 18:14 ` Logan Gunthorpe
2019-11-11 18:14 ` Logan Gunthorpe
2019-11-11 21:55 ` Mike Rapoport
2019-11-11 21:55 ` Mike Rapoport
2019-11-12 6:19 ` Yash Shah
2019-11-12 6:19 ` Yash Shah
2019-11-11 21:56 ` Mike Rapoport [this message]
2019-11-11 21:56 ` Mike Rapoport
2019-11-12 6:35 ` Yash Shah
2019-11-12 6:35 ` Yash Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191111215647.GB10647@linux.ibm.com \
--to=rppt@linux.ibm.com \
--cc=Anup.Patel@wdc.com \
--cc=aou@eecs.berkeley.edu \
--cc=bmeng.cn@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=logang@deltatee.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=ren_guo@c-sky.com \
--cc=sachin.ghadi@sifive.com \
--cc=tglx@linutronix.de \
--cc=yash.shah@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.