Re: [PATCH v2 12/19] lib/stackdepot: use list_head for stack record links

From: Anders Roxell
Date: Sat Sep 16 2023 - 13:44:41 EST


On 2023-09-13 19:14, andrey.konovalov@xxxxxxxxx wrote:
> From: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
>
> Switch stack_record to use list_head for links in the hash table
> and in the freelist.
>
> This will allow removing entries from the hash table buckets.
>
> This is preparatory patch for implementing the eviction of stack records
> from the stack depot.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
>

Building on an arm64 kernel from linux-next tag next-20230915, and boot
that in QEMU. I see the following kernel panic.

[ 67.398850][ T1] Unable to handle kernel read from unreadable memory at virtual address 0000000000000010
[ 67.407996][ T1] Mem abort info:
[ 67.411023][ T1] ESR = 0x0000000096000004
[ 67.414757][ T1] EC = 0x25: DABT (current EL), IL = 32 bits
[ 67.419945][ T1] SET = 0, FnV = 0
[ 67.423172][ T1] EA = 0, S1PTW = 0
[ 67.426669][ T1] FSC = 0x04: level 0 translation fault
[ 67.431357][ T1] Data abort info:
[ 67.434593][ T1] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[ 67.439801][ T1] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 67.444948][ T1] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 67.449910][ T1] [0000000000000010] user address but active_mm is swapper
[ 67.456236][ T1] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 67.462181][ T1] Modules linked in:
[ 67.465435][ T1] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G T 6.6.0-rc1-next-20230915 #2 e95cf19845fbc1e6a5f0694214d59e527e463469
[ 67.477126][ T1] Hardware name: linux,dummy-virt (DT)
[ 67.481994][ T1] pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 67.488454][ T1] pc : stack_depot_save_flags+0x2a8/0x780
[ 67.493348][ T1] lr : stack_depot_save_flags+0x2a8/0x780
[ 67.498339][ T1] sp : ffff80008000b870
[ 67.501670][ T1] x29: ffff80008000b870 x28: 00000000650dddc5 x27: 0000000000000000
[ 67.508658][ T1] x26: ffff80008470a000 x25: ffff80008000b9e8 x24: 0000000000000001
[ 67.515564][ T1] x23: 000000000000000e x22: ffff80008000b988 x21: 0000000000000001
[ 67.522430][ T1] x20: ffff00007b40d070 x19: 000000006ee80007 x18: ffff80008000d080
[ 67.529365][ T1] x17: 0000000000000000 x16: 0000000000000000 x15: 2030303178302f30
[ 67.536101][ T1] x14: 0000000000000000 x13: 205d315420202020 x12: 0000000000000000
[ 67.542985][ T1] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
[ 67.549863][ T1] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
[ 67.556764][ T1] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
[ 67.563687][ T1] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
[ 67.570500][ T1] Call trace:
[ 67.573275][ T1] stack_depot_save_flags+0x2a8/0x780
[ 67.577794][ T1] stack_depot_save+0x4c/0xc0
[ 67.582062][ T1] ref_tracker_alloc+0x354/0x480
[ 67.586273][ T1] sk_alloc+0x280/0x5f8
[ 67.590064][ T1] __netlink_create+0x84/0x200
[ 67.594009][ T1] __netlink_kernel_create+0x11c/0x500
[ 67.598816][ T1] rtnetlink_net_init+0xc4/0x180
[ 67.603052][ T1] ops_init+0x100/0x2c0
[ 67.606827][ T1] register_pernet_operations+0x228/0x480
[ 67.611568][ T1] register_pernet_subsys+0x5c/0xc0
[ 67.616282][ T1] rtnetlink_init+0x60/0xb00
[ 67.620086][ T1] netlink_proto_init+0x374/0x400
[ 67.624465][ T1] do_one_initcall+0x2c8/0x840
[ 67.628518][ T1] do_initcalls+0x21c/0x340
[ 67.632527][ T1] kernel_init_freeable+0x3b0/0x480
[ 67.636905][ T1] kernel_init+0x58/0x380
[ 67.640768][ T1] ret_from_fork+0x10/0x40
[ 67.644606][ T1] Code: eb1b029f 540008c0 91004360 97caa437 (b9401360)
[ 67.650293][ T1] ---[ end trace 0000000000000000 ]---
[ 67.654948][ T1] Kernel panic - not syncing: Oops: Fatal exception
[ 67.660229][ T1] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---

The full log can be found [1] and the .config file [2]. I bisected down
to this commit, see the bisect log [3].

When reverted these two commits I managed to build and the kernel
booted.

47590ecf1166 ("lib/stackdepot: use list_head for stack record links")
8729f3c26fc2 ("lib/stackdepot: allow users to evict stack traces")


Cheers,
Anders
[1] http://ix.io/4GyE
[2] https://people.linaro.org/~anders.roxell/next-20230915.config
[3] http://ix.io/4GyG