arm: lockdep complaining about static memory allocations
From: Jan Kardell
Date: Sat Nov 21 2020 - 08:10:07 EST
Jan Kardell skrev:
Hi,
I'm lifting our old barrier_braker code on an omap am3552 custom
board, and building it on master per 13 november. I currently run it
as an zImage-initramfs, but the board normally uses ubifs on nand
flash. I get exceptions logged to dmesg, included snippets from the
logs as attachment. I also saw it with an older kernel, 5.4.68 from
september. I'm not sure how to debug this and would be happy if
someone can point me in the right direction. It looks to me it is
something wrong with allocating/freeing net devices in the kernel.
Maybe there are OpenWrt patches affecting this?
Regards
//Jan
Turns out this is not an OpenWrt thing. After enabling CONFIG_PREEMT i
started to see allocation of net devices in the memory that previously
was initmem, and lockdep detect that as static memory. To linux 5.2 a
patch for s390 in commit 7a5da02de8d6eafba99556f8c98e5313edebb449 added
the function arch_is_kernel_initmem_freed(). It has later been added for
powerpc and x86 too. I now believe that is needed for arm as well.
Though I don't know the inner workings of memory management so I don't
know if an identical solution as s390 and powerpc will do for arm. The
commit message for s390 says "virt == phys", but that seems not to be
the case for my arm system.
I did a "dummy" arch_is_kernel_initmem_freed() with a printk to verify
that the address is in the initmem area:
|[ 73.966965] Address 0xc0e6e630 is in initmem! [ 73.978934]
------------[ cut here ]------------ [ 74.001003] WARNING: CPU: 0 PID:
2008 at kernel/locking/lockdep.c:1119 alloc_netdev_mqs+0xb4/0x3b0|
This also makes me wonder if more archs needs this and maybe a more
general solution, but that's definitely out of my league...
//Jan
--
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
- Bjarne Stroustrup
[ 92.168789] ------------[ cut here ]------------
[ 92.198989] WARNING: CPU: 0 PID: 2015 at kernel/locking/lockdep.c:1119 alloc_netdev_mqs+0xb4/0x3b0
[ 92.230384] Modules linked in: pppoe ppp_async option usb_wwan pppox ppp_generic pl2303 ipt_REJECT ftdi_sio cp210x xt_time xt_tcpudp xt_state xt_recent xt_policy xt_nat xt_multiport xt_mark xt_mac xt_limit xt_helper xt_esp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_MASQUERADE xt_LOG usbserial slhc nf_reject_ipv4 nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack_netlink nf_conncount iptable_nat iptable_mangle iptable_filter ipt_ah ip_tables cdc_acm tps65217_poweroff xt_set ip_set_list_set ip_set_hash_netportnet ip_set_hash_netport ip_set_hash_netnet ip_set_hash_netiface ip_set_hash_net ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set nfnetlink ip6table_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_NPT nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT
[ 92.230683] x_tables nf_reject_ipv6 ipip tunnel4 ip_tunnel nls_utf8 nls_iso8859_15 ecdh_generic ecc crypto_user algif_skcipher algif_rng algif_hash algif_aead af_alg kpp cmac arc4 usb_storage mii
[ 92.559823] CPU: 0 PID: 2015 Comm: netifd Not tainted 5.4.75 #0
[ 92.566083] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 92.572538] [<c010e654>] (unwind_backtrace) from [<c010b3d8>] (show_stack+0x10/0x14)
[ 92.580705] [<c010b3d8>] (show_stack) from [<c077fb50>] (dump_stack+0x94/0xa8)
[ 92.588324] [<c077fb50>] (dump_stack) from [<c0129410>] (__warn+0xbc/0xd8)
[ 92.595564] [<c0129410>] (__warn) from [<c012947c>] (warn_slowpath_fmt+0x50/0x94)
[ 92.603456] [<c012947c>] (warn_slowpath_fmt) from [<c060de64>] (alloc_netdev_mqs+0xb4/0x3b0)
[ 92.612357] [<c060de64>] (alloc_netdev_mqs) from [<c073ba04>] (br_add_bridge+0x28/0x70)
[ 92.620783] [<c073ba04>] (br_add_bridge) from [<c073d944>] (br_ioctl_deviceless_stub+0x20c/0x408)
[ 92.630122] [<c073d944>] (br_ioctl_deviceless_stub) from [<c05f0dd4>] (sock_ioctl+0x248/0x5ac)
[ 92.639184] [<c05f0dd4>] (sock_ioctl) from [<c023d7dc>] (do_vfs_ioctl+0xa0/0x918)
[ 92.647060] [<c023d7dc>] (do_vfs_ioctl) from [<c023e0b0>] (ksys_ioctl+0x5c/0x80)
[ 92.654843] [<c023e0b0>] (ksys_ioctl) from [<c0101000>] (ret_fast_syscall+0x0/0x54)
[ 92.662894] Exception stack(0xc0e81fa8 to 0xc0e81ff0)
[ 92.668216] 1fa0: b6f01280 b6f012e0 00000008 000089a0 b6f012e0 be992a10
[ 92.676821] 1fc0: b6f01280 b6f012e0 b6f4af20 00000036 be992b38 b6f4adb0 0002e68f b6f4af44
[ 92.685422] 1fe0: 0003fd2c be9929f8 0001e778 b6fa8844
[ 92.845970] ---[ end trace af697b21708fc24a ]---
[ 806.192698] ------------[ cut here ]------------
[ 806.197644] WARNING: CPU: 0 PID: 2606 at kernel/locking/lockdep.c:5188 free_netdev+0xa8/0x108
[ 806.241216] Modules linked in: pppoe ppp_async option usb_wwan pppox ppp_generic pl2303 ipt_REJECT ftdi_sio cp210x xt_time xt_tcpudp xt_state xt_recent xt_policy xt_nat xt_multiport xt_mark xt_mac xt_limit xt_helper xt_esp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_MASQUERADE xt_LOG usbserial slhc nf_reject_ipv4 nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack_netlink nf_conncount iptable_nat iptable_mangle iptable_filter ipt_ah ip_tables cdc_acm tps65217_poweroff xt_set ip_set_list_set ip_set_hash_netportnet ip_set_hash_netport ip_set_hash_netnet ip_set_hash_netiface ip_set_hash_net ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set nfnetlink ip6table_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_NPT nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT
[ 806.241846] x_tables nf_reject_ipv6 ipip tunnel4 ip_tunnel nls_utf8 nls_iso8859_15 ecdh_generic ecc crypto_user algif_skcipher algif_rng algif_hash algif_aead af_alg kpp cmac arc4 usb_storage mii
[ 806.483041] CPU: 0 PID: 2606 Comm: pppd Tainted: G W 5.4.75 #0
[ 806.490574] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 806.497033] [<c010e654>] (unwind_backtrace) from [<c010b3d8>] (show_stack+0x10/0x14)
[ 806.505196] [<c010b3d8>] (show_stack) from [<c077fb50>] (dump_stack+0x94/0xa8)
[ 806.512815] [<c077fb50>] (dump_stack) from [<c0129410>] (__warn+0xbc/0xd8)
[ 806.520053] [<c0129410>] (__warn) from [<c012947c>] (warn_slowpath_fmt+0x50/0x94)
[ 806.527942] [<c012947c>] (warn_slowpath_fmt) from [<c060cde8>] (free_netdev+0xa8/0x108)
[ 806.536406] [<c060cde8>] (free_netdev) from [<bf293de8>] (ppp_release+0x84/0x9c [ppp_generic])
[ 806.545575] [<bf293de8>] (ppp_release [ppp_generic]) from [<c022b59c>] (__fput+0x88/0x220)
[ 806.554295] [<c022b59c>] (__fput) from [<c0146cac>] (task_work_run+0x8c/0xa8)
[ 806.561810] [<c0146cac>] (task_work_run) from [<c010a710>] (do_work_pending+0xa0/0x528)
[ 806.570233] [<c010a710>] (do_work_pending) from [<c010106c>] (slow_work_pending+0xc/0x20)
[ 806.578830] Exception stack(0xc3039fb0 to 0xc3039ff8)
[ 806.584150] 9fa0: 00000000 00000000 00000000 00000000
[ 806.592754] 9fc0: 00000000 00000000 004d0040 00000006 004d3730 00000004 004e1994 00000000
[ 806.601356] 9fe0: bea26ac8 bea26ab8 b6f45538 b6f449f8 60000010 0000000f
[ 806.775231] ---[ end trace af697b21708fc24b ]---