Received: by 10.223.185.116 with SMTP id b49csp3684085wrg; Tue, 13 Feb 2018 06:14:18 -0800 (PST) X-Google-Smtp-Source: AH8x225A7kKUOjUFkcmvGJMDXz41ZK/Q84tkBd286vbBqGjRBQersPhvGBbuGXNqQXuv8k8UEFFd X-Received: by 10.98.36.81 with SMTP id r78mr1391880pfj.196.1518531258765; Tue, 13 Feb 2018 06:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518531258; cv=none; d=google.com; s=arc-20160816; b=nI6WOUzrpJQPDooeXdkNvmJDX28fMsOjWOAsH61kfRktPx2S90UU6IYYDHMKX+I4xM vXSl2DvNycmn6o4LOk3Ycc7+3caKBgWwe14WTEUY0BcMnuJNqAfk5gw3BoccEHzYxMRG jHmGNbK/k0v0F062nDLfB01aqtSIn07OPsrkYyJq8Sn1GZUbXL4ghs3a43qk0vKDgF3G kRHvbVaLGLmLO3OL4PCDYD8gEtHTNSd6yCsLCpQcmcmhbNK+RSBJevd5IrfxFX6xo+/g 0NIS99ZmqTlevN0ACvMv1qhzmse8wpi9RH56Ee2f0HZzcIUip6kU9j58CDWr+WG0IhPB W9CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=lT8PAWHYBwdL0Wi4a32azunvgYOiy2+sh/N2Lo4mE+k=; b=zpmlSnpI9NQxOGfnvtBoYFCw93cEW4WYuDkH/A3tVoUbck9IQX2aWdpi44XHaBVGMA fG0U/8/aMhMP90Hfp7jmVXTiEF0idurJqWAjtkUmPTbpA/1/IDjJFe9PbX/WAJdufdjk 8AQkeyNYCNX2SuwsE16YRJdqmiZxlkgdTS5xlZKX1xL3uX5931Kom2pbt3pce11azz5Z b4G0q9kZBISuks1FTZPy+j6OOXGDJgTfUW+O983o81DLL1BoAnHEZpTJR0m4n8Un3Srr Imb4FGWtsqCiPJafdVs6WJR0zL9h3ttSdhWaBvMtnMqhB2bO/dAqJh/9hGkY78k3H7VQ lJTA== ARC-Authentication-Results: i=1; mx.google.com; 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 l6si1264697pgs.367.2018.02.13.06.14.03; Tue, 13 Feb 2018 06:14:18 -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; 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 S965056AbeBMONR (ORCPT + 99 others); Tue, 13 Feb 2018 09:13:17 -0500 Received: from 9pmail.ess.barracuda.com ([64.235.150.224]:50224 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964935AbeBMONP (ORCPT ); Tue, 13 Feb 2018 09:13:15 -0500 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx30.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Tue, 13 Feb 2018 14:11:08 +0000 Received: from [10.150.130.83] (10.150.130.83) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 13 Feb 2018 06:05:36 -0800 Subject: Re: [PATCH v2 12/15] MIPS: memblock: Print out kernel virtual mem layout To: Serge Semin , , , , , , , , , CC: , , , , , , , References: <20180117222312.14763-1-fancer.lancer@gmail.com> <20180202035458.30456-1-fancer.lancer@gmail.com> <20180202035458.30456-13-fancer.lancer@gmail.com> From: Matt Redfearn Message-ID: <0448b8d7-48f1-7519-693c-47cdd162d000@mips.com> Date: Tue, 13 Feb 2018 14:05:31 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180202035458.30456-13-fancer.lancer@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.150.130.83] X-BESS-ID: 1518531066-637140-1058-164716-11 X-BESS-VER: 2018.1-r1801291959 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.189978 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Serge, On 02/02/18 03:54, Serge Semin wrote: > It is useful to have the kernel virtual memory layout printed > at boot time so to have the full information about the booted > kernel. In some cases it might be unsafe to have virtual > addresses freely visible in logs, so the %pK format is used if > one want to hide them. Please could you update the commit message to reflect the guard on CONFIG_DEBUG_KERNEL, and the %pK format is no longer used. It would be better to have this patch either at the start of the series, or the end, since it is not strictly involved in switching between bootmem and memblock. It would be better to have a short sequence of patches to make that transition, with patches to lead up to that or clean up afterwards at the beginning and end of the series. It will just make any future bisection easier. Thanks, Matt > > Signed-off-by: Serge Semin > --- > arch/mips/mm/init.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > > diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c > index 84b7b592b834..eec92194d4dc 100644 > --- a/arch/mips/mm/init.c > +++ b/arch/mips/mm/init.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -60,6 +61,53 @@ EXPORT_SYMBOL_GPL(empty_zero_page); > EXPORT_SYMBOL(zero_page_mask); > > /* > + * Print out the kernel virtual memory layout > + */ > +#define MLK(b, t) (void *)b, (void *)t, ((t) - (b)) >> 10 > +#define MLM(b, t) (void *)b, (void *)t, ((t) - (b)) >> 20 > +#define MLK_ROUNDUP(b, t) (void *)b, (void *)t, DIV_ROUND_UP(((t) - (b)), SZ_1K) > +static void __init mem_print_kmap_info(void) > +{ > +#ifdef CONFIG_DEBUG_KERNEL > + pr_notice("Kernel virtual memory layout:\n" > + " lowmem : 0x%px - 0x%px (%4ld MB)\n" > + " .text : 0x%px - 0x%px (%4td kB)\n" > + " .data : 0x%px - 0x%px (%4td kB)\n" > + " .init : 0x%px - 0x%px (%4td kB)\n" > + " .bss : 0x%px - 0x%px (%4td kB)\n" > + " vmalloc : 0x%px - 0x%px (%4ld MB)\n" > +#ifdef CONFIG_HIGHMEM > + " pkmap : 0x%px - 0x%px (%4ld MB)\n" > +#endif > + " fixmap : 0x%px - 0x%px (%4ld kB)\n", > + MLM(PAGE_OFFSET, (unsigned long)high_memory), > + MLK_ROUNDUP(_text, _etext), > + MLK_ROUNDUP(_sdata, _edata), > + MLK_ROUNDUP(__init_begin, __init_end), > + MLK_ROUNDUP(__bss_start, __bss_stop), > + MLM(VMALLOC_START, VMALLOC_END), > +#ifdef CONFIG_HIGHMEM > + MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE)), > +#endif > + MLK(FIXADDR_START, FIXADDR_TOP)); > + > + /* Check some fundamental inconsistencies. May add something else? */ > +#ifdef CONFIG_HIGHMEM > + BUILD_BUG_ON(VMALLOC_END < PAGE_OFFSET); > + BUG_ON(VMALLOC_END < (unsigned long)high_memory); > + BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET); > + BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < > + (unsigned long)high_memory); > +#endif > + BUILD_BUG_ON(FIXADDR_TOP < PAGE_OFFSET); > + BUG_ON(FIXADDR_TOP < (unsigned long)high_memory); > +#endif /* CONFIG_DEBUG_KERNEL */ > +} > +#undef MLK > +#undef MLM > +#undef MLK_ROUNDUP > + > +/* > * Not static inline because used by IP27 special magic initialization code > */ > void setup_zero_pages(void) > @@ -468,6 +516,7 @@ void __init mem_init(void) > free_all_bootmem(); > setup_zero_pages(); /* Setup zeroed pages. */ > mem_init_free_highmem(); > + mem_print_kmap_info(); > mem_init_print_info(NULL); > > #ifdef CONFIG_64BIT >