Re: [PATCH v2 3/5] mips: Print the kernel virtual mem layout on debugging

From: Paul Burton
Date: Mon May 06 2019 - 15:15:11 EST


Hi Serge,

On Fri, May 03, 2019 at 08:50:39PM +0300, Serge Semin wrote:
> It is useful at least for debugging to have the kernel virtual
> memory layout printed at boot time so to have the full information
> about the booted kernel. Make the printing optional and available
> only when DEBUG_KERNEL config is enabled so not to leak a sensitive
> kernel information.
>
> Signed-off-by: Serge Semin <fancer.lancer@xxxxxxxxx>
> ---
> arch/mips/mm/init.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)

FYI the rest of the series is in mips-next, but I left this one out
because it gives me compile errors for 64r6el_defconfig:

In file included from ./include/linux/printk.h:7,
from ./include/linux/kernel.h:15,
from ./include/asm-generic/bug.h:18,
from ./arch/mips/include/asm/bug.h:42,
from ./include/linux/bug.h:5,
from arch/mips/mm/init.c:11:
arch/mips/mm/init.c: In function âmem_print_kmap_infoâ:
./include/linux/kern_levels.h:5:18: error: format â%ldâ expects argument of type âlong intâ, but argument 4 has type âlong long unsigned intâ [-Werror=format=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^~~~~~
./include/linux/kern_levels.h:13:21: note: in expansion of macro âKERN_SOHâ
#define KERN_NOTICE KERN_SOH "5" /* normal but significant condition */
^~~~~~~~
./include/linux/printk.h:307:9: note: in expansion of macro âKERN_NOTICEâ
printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
arch/mips/mm/init.c:69:2: note: in expansion of macro âpr_noticeâ
pr_notice("Kernel virtual memory layout:\n"
^~~~~~~~~
arch/mips/mm/init.c:70:39: note: format string is defined here
" lowmem : 0x%px - 0x%px (%4ld MB)\n"
~~~^
%4lld
In file included from ./arch/mips/include/asm/bug.h:5,
from ./include/linux/bug.h:5,
from arch/mips/mm/init.c:11:
In function âmem_print_kmap_infoâ,
inlined from âmem_initâ at arch/mips/mm/init.c:530:2:
./include/linux/compiler.h:344:38: error: call to â__compiletime_assert_99â declared with attribute error: BUILD_BUG_ON failed: FIXADDR_TOP < PAGE_OFFSET
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
./include/linux/compiler.h:325:4: note: in definition of macro â__compiletime_assertâ
prefix ## suffix(); \
^~~~~~
./include/linux/compiler.h:344:2: note: in expansion of macro â_compiletime_assertâ
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro âcompiletime_assertâ
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro âBUILD_BUG_ON_MSGâ
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
arch/mips/mm/init.c:99:2: note: in expansion of macro âBUILD_BUG_ONâ
BUILD_BUG_ON(FIXADDR_TOP < PAGE_OFFSET);
^~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:278: arch/mips/mm/init.o] Error 1
make[2]: *** [scripts/Makefile.build:489: arch/mips/mm] Error 2

Thanks,
Paul