Re: [PATCH v6 4/5] mm/sparse: Optimize memmap allocation during sparse_init()

From: Pavel Tatashin
Date: Thu Jun 28 2018 - 10:10:18 EST


> Is this at a point in boot where a BUG_ON() generally produces useful
> output, or will it just produce and early-boot silent hang with no
> console output?

Probably depends on the platform, but in KVM, I see a nice panic
message (inserted BUG_ON(1) into sparse_init()):

[ 0.000000] kernel BUG at mm/sparse.c:490!
PANIC: early exception 0x06 IP 10:ffffffffb6bd43d9 error 0 cr2
0xffff898747575000
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc2_pt_sparse #6
[ 0.000000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.11.0-20171110_100015-anatol 04/01/2014
[ 0.000000] RIP: 0010:sparse_init+0x0/0x2
[ 0.000000] Code: fe 3b 05 ba d0 16 00 7e 06 89 05 b2 d0 16 00 49
83 08 01 48 81 c3 00 80 00 00 e9 73 ff ff ff 48 83 c4 10 5b 5d 41 5c
41 5d c3 <0f> 0b 48 8b 05 ae 46 8f ff 48 c1 e2 15 48 01 d0 c3 41 56 48
8b 05
[ 0.000000] RSP: 0000:ffffffffb6603e98 EFLAGS: 00010086 ORIG_RAX:
0000000000000000
[ 0.000000] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffffb6603e80
[ 0.000000] RDX: ffffffffb6603e78 RSI: 0000000000000040 RDI: ffffffffb6603e70
[ 0.000000] RBP: 0000000007f7ec00 R08: ffffffffb6603e74 R09: 0000000000007fe0
[ 0.000000] R10: 0000000000000100 R11: 0000000007fd6000 R12: 0000000000000000
[ 0.000000] R13: ffffffffb6603f18 R14: 0000000000000000 R15: 0000000000000000
[ 0.000000] FS: 0000000000000000(0000) GS:ffffffffb6b82000(0000)
knlGS:0000000000000000
[ 0.000000] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.000000] CR2: ffff898747575000 CR3: 0000000006e0a000 CR4: 00000000000606b0
[ 0.000000] Call Trace:
[ 0.000000] ? paging_init+0xf/0x2c
[ 0.000000] ? setup_arch+0xae8/0xc17
[ 0.000000] ? printk+0x53/0x6a
[ 0.000000] ? start_kernel+0x62/0x4b3
[ 0.000000] ? load_ucode_bsp+0x3d/0x129
[ 0.000000] ? secondary_startup_64+0xa5/0xb0