2020-11-21 13:12:13

by Jan Kardell

[permalink] [raw]
Subject: arm: lockdep complaining about static memory allocations

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


Attachments:
dmesg-5.4.75.txt (5.45 kB)