Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp185304ybc; Fri, 22 Nov 2019 18:59:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzUEuuOqw9PH8Y+D16vIkt71xSunEcj0BsJ1AhMWKmgdgo/Fqsz41A8FjuWj+dhx0I3h48T X-Received: by 2002:a17:907:2099:: with SMTP id pv25mr6637507ejb.144.1574477985463; Fri, 22 Nov 2019 18:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574477985; cv=none; d=google.com; s=arc-20160816; b=f2BGVQyc7Mulrf3pzb/6UAMGZb1ugDXENJpwxjGLPqShIOPWrSVSS28u7U3qAwW6Cy w8s03MAxfVIUxbQBr1xBL4rwnUxN452eO/PLc6I3gJzVju9rpy7MK1jlXE9Xmms88BZX 1z3eJnEHAug9++DfZo8PLxoBgwE9FhhWdTp0If9mDr8BWhTYsATUJOKpNXrrjxuGHgZu 9TvxgOeLVBhw5BZB1fLu5O+LmrDo8nsIZMW565U87tIasbhqJxzH6BMQcCG4aNJ0C3fT 6uEKnyQB1BIdAebGTI3jidauUrkMD13zR1GtIAmioeN/9uEb08TksnJ6q01HPiwo2IGG /Pxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=yH4Y/VZBJNypI69fryRWHnM3YvLC5pprHhmD6xuLHHY=; b=HKintyfc4qRMbA3cjbxcSwKYTAZDllRJGqsjeybfvNyMJYsXpBSZwfjCUhEWBWx9tG jNsvLAK4ujkxHeQzQuDfxHQFXtmiMgaodpZnp/12puU8qhRg5HxezImNR6nYOoD/7Wfw eCsdd6CzDrO5/D86Mcxc3sOgbzgaGbmBY+oPwzTEIMFoZPXYzzOKJ6AncmsmzwvkfVEt EyZKyyG2BAM85xfORuE8TPgABThSXNYKF+7bC5zieHTwRuXZFiTAKEnNkA5z24m8753g MpK4RiDMa3zmj/3xaMD/siRCf1LI9S7RI99791JU/SOAigvpZEhsrq8fPIf33+TwsRWq RF0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=jsczJLCK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23si6272227ede.355.2019.11.22.18.59.20; Fri, 22 Nov 2019 18:59:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=jsczJLCK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbfKWC5a (ORCPT + 99 others); Fri, 22 Nov 2019 21:57:30 -0500 Received: from mail-il1-f196.google.com ([209.85.166.196]:46406 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbfKWC5a (ORCPT ); Fri, 22 Nov 2019 21:57:30 -0500 Received: by mail-il1-f196.google.com with SMTP id q1so9038827ile.13 for ; Fri, 22 Nov 2019 18:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=yH4Y/VZBJNypI69fryRWHnM3YvLC5pprHhmD6xuLHHY=; b=jsczJLCKJeiUOE0FeT5APJ0lVv+av3CejiFSaMmNxx+LsgmHoO3KGk4ReoBi5gyl1f NQXxiuZVmj4UqhFzKKS8zkE4oDEQ4bKuw/qjCAstpPS1Y60GYq7O8yQRsxherm5aS3Gm 8Co9yLzOIXPfHsmC9e5D8WiXqxIwLMhTsyRRagWS+lujAlCV9WBed8XLTgtGaqcsmoZW yIg63k1GCH+D3BdqUhhNWKbY0fmYFTAKfm9TTDzCDKeN5yPXHIQOhqQWo3Vn03zWcYff 4gokQnx5rHFCIt0ldEW3XxWB/UsVDV1T/lYI0ts/r8SiwP8ElnolFikRqtJUQkGTyCFq NuHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=yH4Y/VZBJNypI69fryRWHnM3YvLC5pprHhmD6xuLHHY=; b=eo9BnVHgMA5b65KoKZwbfhIKHkDYpehHam+bl3i2APZrN5OkuLVm+LNC3Jl7SD8DVJ adwfMgrAl0yVchZxuW6Eg6UBTu2vSF6l+EhC0Ex3D+aIgJFascY1TL96pYXBCxkNtGm4 wYhQ2MnMtjQZtHesckGpi+NUEi3RyhL8h/9PcrmZToqNm39v7Q5qOSNnLquno+PGZBw9 uipkqyadG/CpgmtnMljE+CFCw/LOnYE96HewjoBZ0dlNm/pSemVVAm0yiQCV6TZLZdB7 Q99q7nqzt+w7wsi8cuzYzhl7flVsSdqhS40ChtcYDXJ0sVjwd0pOFNacIdslmQG5xJmG IRyQ== X-Gm-Message-State: APjAAAUPqMthuJAAN+Ii1zA5AK5F3Z74tYR+rI2B41fqOvBpu21FvA1h 2lWPmdSMnKzXTlx9s0xLMGx5Bw== X-Received: by 2002:a92:d7c6:: with SMTP id g6mr3671456ilq.282.1574477849400; Fri, 22 Nov 2019 18:57:29 -0800 (PST) Received: from localhost ([64.62.168.194]) by smtp.gmail.com with ESMTPSA id d23sm2823667iom.55.2019.11.22.18.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 18:57:28 -0800 (PST) Date: Fri, 22 Nov 2019 18:57:27 -0800 (PST) From: Paul Walmsley X-X-Sender: paulw@viisi.sifive.com To: Yash Shah cc: "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "palmer@dabbelt.com" , "aou@eecs.berkeley.edu" , "Anup.Patel@wdc.com" , "rppt@linux.ibm.com" , "logang@deltatee.com" , "ren_guo@c-sky.com" , "bmeng.cn@gmail.com" , "tglx@linutronix.de" , "wangkefeng.wang@huawei.com" , Sachin Ghadi Subject: Re: [PATCH v2] RISC-V: Add address map dumper In-Reply-To: <1574056694-28927-1-git-send-email-yash.shah@sifive.com> Message-ID: References: <1574056694-28927-1-git-send-email-yash.shah@sifive.com> User-Agent: Alpine 2.21.9999 (DEB 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 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 Reviewed-by: Logan Gunthorpe Reviewed-by: Anup Patel [paul.walmsley@sifive.com: dropped .init/.text/.data/.bss prints; added PCI legacy I/O region display] Signed-off-by: Paul Walmsley --- 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