linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Walmsley <paul.walmsley@sifive.com>
To: Yash Shah <yash.shah@sifive.com>
Cc: "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>,
	"rppt@linux.ibm.com" <rppt@linux.ibm.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>,
	"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
	Sachin Ghadi <sachin.ghadi@sifive.com>
Subject: Re: [PATCH v2] RISC-V: Add address map dumper
Date: Fri, 22 Nov 2019 18:57:27 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.21.9999.1911221855090.14532@viisi.sifive.com> (raw)
In-Reply-To: <1574056694-28927-1-git-send-email-yash.shah@sifive.com>

Hi Yash,

On Mon, 18 Nov 2019, 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@sifive.com>

Thanks, I've queued up the following patch.  I added the PCI I/O region,
and also dropped some of the .init/.text/etc. prints since they duplicate 
the output from mem_init_print_info().


- Paul

From: Yash Shah <yash.shah@sifive.com>
Date: Mon, 18 Nov 2019 05:58:34 +0000
Subject: [PATCH] RISC-V: Add address map dumper

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@sifive.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
[paul.walmsley@sifive.com: dropped .init/.text/.data/.bss prints;
 added PCI legacy I/O region display]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
---
 arch/riscv/mm/init.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 573463d1c799..c2c0e244555f 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -45,6 +45,37 @@ 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("pci io", (unsigned long)PCI_IO_START,
+		  (unsigned long)PCI_IO_END);
+	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);
+}
+#else
+static void print_vm_layout(void) { }
+#endif /* CONFIG_DEBUG_VM */
+
 void __init mem_init(void)
 {
 #ifdef CONFIG_FLATMEM
@@ -55,6 +86,7 @@ void __init mem_init(void)
 	memblock_free_all();
 
 	mem_init_print_info(NULL);
+	print_vm_layout();
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
-- 
2.24.0.rc0


      parent reply	other threads:[~2019-11-23  2:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  5:58 [PATCH v2] RISC-V: Add address map dumper Yash Shah
2019-11-18  6:12 ` Anup Patel
2019-11-18 16:44 ` Logan Gunthorpe
2019-11-23  2:57 ` Paul Walmsley [this message]

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=alpine.DEB.2.21.9999.1911221855090.14532@viisi.sifive.com \
    --to=paul.walmsley@sifive.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=ren_guo@c-sky.com \
    --cc=rppt@linux.ibm.com \
    --cc=sachin.ghadi@sifive.com \
    --cc=tglx@linutronix.de \
    --cc=wangkefeng.wang@huawei.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).