Re: [LKP] Re: db57e98d87 ("mm/sparse.c: fix ALIGN() without power of 2 in .."): BUG: kernel reboot-without-warning in early-boot stage, last printk: early console in setup code

Rong Chen
2020-07-17T08:07:53Z

On 7/17/20 6:06 AM, Andrew Morton wrote:
> On Thu, 16 Jul 2020 16:32:00 +0800 kernel test robot <lkp@intel.com> wrote:
>
>> Greetings,
>>
>> 0day kernel testing robot got the below dmesg and the first bad commit is
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>
>> commit db57e98d87908b8837352abe08515e42752270c1
>> Author: Lecopzer Chen <lecopzer.chen@mediatek.com>
>> AuthorDate: Mon Sep 23 15:36:24 2019 -0700
>> Commit: Linus Torvalds <torvalds@linux-foundation.org>
>> CommitDate: Tue Sep 24 15:54:09 2019 -0700
>>
>> mm/sparse.c: fix ALIGN() without power of 2 in sparse_buffer_alloc()
> Are we sure about this? That patch is a year old - has something
> in the test setup changed to make it visible at this late stage?

Hi Andrew,

The issue can be reproduced if CONFIG_SPARSEMEM_VMEMMAP is not set
$ grep CONFIG_SPARSEMEM .config
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not set

$
./reproduce-yocto-vm-yocto-23:20200619042212:x86_64-randconfig-r025-20200618:5.3.0-11836-gdb57e98d87908:1
vmlinuz-5.3.0-11836-gdb57e98d87908
early console in setup code

and kernel can boot if enable CONFIG_SPARSEMEM_VMEMMAP
$ grep CONFIG_SPARSEMEM .config
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y

$
./reproduce-yocto-vm-yocto-23:20200619042212:x86_64-randconfig-r025-20200618:5.3.0-11836-gdb57e98d87908:1
vmlinuz-5.3.0-11836-gdb57e98d87908.CONFIG_SPARSEMEM_VMEMMAP | head
early console in setup code
[    0.000000] Linux version 5.3.0-11836-gdb57e98d87908
(kbuild@6c2adaf8a115) (clang version 12.0.0
(git://gitmirror/llvm_project ed6b578040a85977026c93bf4188f996148f3218))
#1 SMP Fri Jul 17 15:41:47 CST 2020
[    0.000000] Command line: root=/dev/ram0 hung_task_panic=1 debug
apic=debug sysrq_always_enabled rcupdate.rcu_cpu_stall_timeout=100
net.ifnames=0 printk.devkmsg=on panic=-1 softlockup_panic=1
nmi_watchdog=panic oops=panic load_ramdisk=2 prompt_ramdisk=0
drbd.minor_count=8 systemd.log_level=err ignore_loglevel console=tty0
earlyprintk=ttyS0,115200 console=ttyS0,115200 vga=normal rw
rcuperf.shutdown=0 watchdog_thresh=60
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating
point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]: 256
[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832
bytes, using 'standard' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
qemu-system-x86_64: terminating on signal 2

Best Regards,
Rong Chen