Subject: Re: [powerpc] kernel BUG at mm/mmap.c:3164! w/ltp(mmapstress03)

From: Sachin Sant <[email-masked]>
Date: Fri, 29 Apr 2022 18:57:50 +0530

> On 28-Apr-2022, at 10:26 PM, Sachin Sant <[email-masked]> wrote:
> 
> While running LTP tests (mmapstress03 specifically) against 5.18.0-rc4-next-20220428
> booted on IBM Power server mentioned BUG is encountered.
> 
> # ./mmapstress03
> mmapstress03    0  TINFO  :  uname.machine=ppc64le kernel is 64bit
> mmapstress03: errno = 12: failed to fiddle with brk at the end
> mmapstress03    1  TFAIL  :  mmapstress03.c:212: Test failed
> [   32.396145] mmap: mmapstress03 (3023): VmData 18446744073706799104 exceed data ulimit 18446744073709551615. Update limits or use boot option ignore_rlimit_data.
> [   32.396192] ------------[ cut here ]------------
> [   32.396193] kernel BUG at mm/mmap.c:3164!
> [   32.396195] Oops: Exception in kernel mode, sig: 5 [#1]

This BUG_ON was introduced with following patch
commit d2367e383cf5
mm: remove the vma linked list

I tried removing the following three commits to see if it helps.
commit 49d281fa016f2906346f1707e5059b6f7674a948
commit e7ecf47d211aae50f3a1dd3dc75e5afd47745bb6
commit d2367e383cf5ecf93622e64a7b858f7034f3df62

Although I do not see the BUG_ON trace (as it is removed) but
the test still fails:

# ./mmapstress03
mmapstress03    0  TINFO  :  uname.machine=ppc64le kernel is 64bit
mmapstress03: errno = 12: failed to fiddle with brk at the end
mmapstress03    1  TFAIL  :  mmapstress03.c:212: Test failed
 [  579.877217] mmap: mmapstress03 (4287): VmData 18446744073706799104 exceed data ulimit 18446744073709551615. Update limits or use boot option ignore_rlimit_data.
[  579.970138] BUG: non-zero pgtables_bytes on freeing mm: 8192
# 

> [   32.396210] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
> [   32.396213] Modules linked in: dm_mod mptcp_diag xsk_diag tcp_diag udp_diag raw_diag inet_diag unix_diag af_packet_diag netlink_diag nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set bonding tls nf_tables nfnetlink sunrpc binfmt_misc pseries_rng drm drm_panel_orientation_quirks xfs libcrc32c sd_mod t10_pi sr_mod crc64_rocksoft_generic cdrom crc64_rocksoft crc64 sg ibmvscsi scsi_transport_srp ibmveth xts vmx_crypto fuse
> [   32.396262] CPU: 5 PID: 3023 Comm: mmapstress03 Not tainted 5.18.0-rc4-next-20220428 #16
> [   32.396267] NIP:  c0000000004c4750 LR: c0000000004c4730 CTR: c0000000004bf5d0
> [   32.396270] REGS: c00000001abeb810 TRAP: 0700   Not tainted  (5.18.0-rc4-next-20220428)
> [   32.396274] MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 22002224  XER: 00000000
> [   32.396283] CFAR: c0000000008af740 IRQMASK: 0 
> [   32.396283] GPR00: c0000000004c4730 c00000001abebab0 c000000002a71300 0000000000000000 
> [   32.396283] GPR04: c000000079dcd000 ffffffffffffffff 0000000000000008 ffffffffffffffff 
> [   32.396283] GPR08: 0000000000000008 0000000000000001 0000000000000000 c000000079dcd040 
> [   32.396283] GPR12: c000000079dcd008 c00000087fffa300 0000000000000000 0000000000000000 
> [   32.396283] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
> [   32.396283] GPR20: 0000000000000000 0000000000000000 0000000000000000 c000000002aaae85 
> [   32.396283] GPR24: 0000000000000000 0000000000000000 00007fffaa5c1200 c000000020de3660 
> [   32.396283] GPR28: 000000000000000c c000000020de3600 000000000000000d 0000000000000000 
> [   32.396320] NIP [c0000000004c4750] exit_mmap+0x190/0x390
> [   32.396327] LR [c0000000004c4730] exit_mmap+0x170/0x390
> [   32.396332] Call Trace:
> [   32.396334] [c00000001abebab0] [c0000000004c4730] exit_mmap+0x170/0x390 (unreliable)
> [   32.396340] [c00000001abebbd0] [c0000000001700f4] __mmput+0x54/0x200
> [   32.396344] [c00000001abebc10] [c00000000017fe5c] exit_mm+0xfc/0x190
> [   32.396348] [c00000001abebc50] [c00000000018016c] do_exit+0x27c/0x5a0
> [   32.396352] [c00000001abebcf0] [c00000000018063c] do_group_exit+0x4c/0xd0
> [   32.396356] [c00000001abebd30] [c0000000001806e4] sys_exit_group+0x24/0x30
> [   32.396360] [c00000001abebd50] [c000000000037084] system_call_exception+0x254/0x550
> [   32.396364] [c00000001abebe10] [c00000000000bfe8] system_call_vectored_common+0xe8/0x278
> [   32.396369] --- interrupt: 3000 at 0x7fffaa318d04
> [   32.396374] NIP:  00007fffaa318d04 LR: 0000000000000000 CTR: 0000000000000000
> [   32.396377] REGS: c00000001abebe80 TRAP: 3000   Not tainted  (5.18.0-rc4-next-20220428)
> [   32.396380] MSR:  800000000280f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE>  CR: 42002222  XER: 00000000
> [   32.396389] IRQMASK: 0 
> [   32.396389] GPR00: 00000000000000ea 00007fffe43f3420 00007fffaa457100 0000000000000001 
> [   32.396389] GPR04: 0000000000000000 0000000011a602a0 00007fffaa5c1200 0000000000000000 
> [   32.396389] GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
> [   32.396389] GPR12: 0000000000000000 00007fffaa5ca500 0000000000000000 0000000000000000 
> [   32.396389] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
> [   32.396389] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000001 
> [   32.396389] GPR24: 00007fffaa450938 0000000000000000 0000000000000001 00007fffaa4529f8 
> [   32.396389] GPR28: 0000000000000001 00007fffaa5c3510 fffffffffffff000 0000000000000001 
> [   32.396425] NIP [00007fffaa318d04] 0x7fffaa318d04
> [   32.396427] LR [0000000000000000] 0x0
> [   32.396429] --- interrupt: 3000
> [   32.396431] Instruction dump:
> [   32.396433] 60000000 3880ffff 38610020 483eff5d 60000000 7c7f1b79 4082ffb8 813d0058 
> [   32.396439] 7d29f278 7d290034 5529d97e 69290001 <0b090000> 60000000 7fa3eb78 483e328d 
> [   32.396447] ---[ end trace 0000000000000000 ]---
> [   32.398759] 
> [   33.398760] Kernel panic - not syncing: Fatal exception
> 
> This problem was introduced with 5.18.0-rc4-next-20220427. I am unable to
> complete the git bisect due to build failure related to mapletree-vs-khugepaged
> issue.
> 
> Thanks
> -Sachin