Re: [PATCH RFC 02/20] ctlv: Add the UAPI wire format and family API
From: Jiri Pirko
Date: Tue Oct 27 2026 - 04:02:34 EST
Mon, Oct 26, 2026 at 07:55:12PM +0100, yeoreum.yun@xxxxxxx wrote:
>Hi,
>
>> From: Jiri Pirko <jiri@xxxxxxxxxx>
[..]
>> +#define CTLV_MAX_NEST_DEPTH 32
>
>JFYI, when I tested with CTLV_MAX_NEST_DEPTH as 32 and try to run
>ctlv_msg_test_as_deep_as_the_core_allows() message_kunit.c test,
>It experiences the *real stack overflow* on FVP
>(lesser value (e.g. 16) is fine):
>
>[ 3.834419] ok 22 ctlv_msg_test_the_bit_where_it_means_nothing
>[ 3.836499] ok 23 ctlv_msg_test_a_bit_no_version_declares
>[ 3.837852] Insufficient stack space to handle exception!
>[ 3.837875] ESR: 0x0000000096000047 -- DABT (current EL)
>[ 3.837916] FAR: 0xffff800084efffe0
>[ 3.837953] Task stack: [0xffff800084f00000..0xffff800084f04000]
>[ 3.838001] IRQ stack: [0xffff800083d50000..0xffff800083d54000]
>[ 3.838049] Overflow stack: [0xffff00087b7c3150..0xffff00087b7c4150]
>[ 3.838114] CPU: 7 UID: 0 PID: 257 Comm: kunit_try_catch Tainted: G N
>** replaying previous printk message **
>[ 3.838114] CPU: 7 UID: 0 PID: 257 Comm: kunit_try_catch Tainted: G N 7.3.0-rc4+ #1216 PREEMPTLAZY
>[ 3.838219] Tainted: [N]=TEST
>[ 3.838249] Hardware name: , BIOS
>[ 3.838279] pstate: 21400009 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
>[ 3.838360] pc : __kmalloc_flags_noprof+0x10/0x540
>[ 3.838433] lr : __alloc_empty_sheaf+0x48/0x88
>[ 3.838501] sp : ffff800084efffa0
>[ 3.838534] x29: ffff800084f00030 x28: 0000000000000400 x27: 0000000000000400
>[ 3.838657] x26: ffff000803d721c0 x25: 0000000000000000 x24: 0000000000400cc0
>[ 3.838780] x23: ffff00087b7e3398 x22: 16e0800080564b98 x21: ffff0008000a0900
>[ 3.838908] x20: 0000000000000000 x19: ffff000800013600 x18: 0000000000000000
>[ 3.839029] x17: 0000000000000001 x16: 0000000000000002 x15: ffffffff00000001
>[ 3.839150] x14: 0000001c000001c0 x13: ffffffff00000001 x12: ffff000800013500
>[ 3.839275] x11: ffff00080370a800 x10: 0000000000000060 x9 : ffff8000805627d0
>[ 3.839401] x8 : 0000000000000000 x7 : ffffffff00000001 x6 : 0000001d000001d0
>[ 3.839521] x5 : ffff800080567b68 x4 : 00000000ffffffff x3 : 0000000000000004
>[ 3.839640] x2 : 0000000000000dc0 x1 : 0000000000000008 x0 : 0000000000000080
>[ 3.839761] Kernel panic - not syncing: kernel stack overflow
>[ 3.841533] CPU: 7 UID: 0 PID: 257 Comm: kunit_try_catch Tainted: G N 7.3.0-rc4+ #1216 PREEMPTLAZY
>[ 3.841783] Tainted: [N]=TEST
>[ 3.841877] Hardware name: , BIOS
>[ 3.841980] Call trace:
>[ 3.842065] show_stack+0x20/0x40 (C)
>[ 3.842246] __dump_stack+0x28/0x48
>[ 3.842427] dump_stack_lvl+0x28/0xb0
>[ 3.842609] dump_stack+0x18/0x34
>[ 3.842788] vpanic+0x208/0x5b8
>[ 3.842944] panic+0x54/0x60
>[ 3.843096] nmi_panic+0xc0/0xc8
>[ 3.843273] panic_bad_stack+0x10c/0x128
>[ 3.843466] handle_bad_stack+0x34/0x38
>[ 3.843622] __bad_stack+0x98/0xa0
>[ 3.843773] __kmalloc_flags_noprof+0x10/0x540 (P)
>[ 3.843950] __pcs_replace_empty_main+0x2ac/0x3e8
>[ 3.844139] __kmalloc_node_track_caller_noprof+0x440/0x520
>[ 3.844328] krealloc_node_align_noprof+0x178/0x390
>[ 3.844509] kvrealloc_node_align_noprof+0x98/0x130
>[ 3.844690] ctlv_schema_index_scope_add+0xb0/0x3f8
>[ 3.844882] ctlv_schema_check_indexed_nest+0x1e8/0x958
>
>(repeat ctlv_schema_check_attr()/ctlv_schema_check_indexed_nest())
>
>[ 3.856919] ctlv_schema_check_attr+0x3dc/0x538
>[ 3.857105] ctlv_schema_check_indexed_nest+0x788/0x958
>[ 3.857301] ctlv_schema_validate+0x88/0x180
>[ 3.857482] ctlv_msg_test_as_deep_as_the_core_allows+0x11c/0x1e8
>[ 3.857698] kunit_try_run_case+0x64/0x188
>[ 3.857878] kunit_generic_run_threadfn_adapter+0x30/0x68
>[ 3.858086] kthread+0x10c/0x140
>[ 3.858245] ret_from_fork+0x10/0x20
>[ 3.858398] SMP: stopping secondary CPUs
>[ 3.858630] Kernel Offset: disabled
>[ 3.858720] CPU features: 0x0,00000000,00b0802e,9f190bc3,2affe72f
>[ 3.858872] Memory Limit: none
>[ 3.858976] ---[ end Kernel panic - not syncing: kernel stack overflow ]---
>
>[...]
>
>I think it might be good to configurable according to architecture
>unless it's not good to reduce the CTLV_MAX_NEST_DEPTH number
>otherwise, increasing stack size when CTLV is enabled seems unresonable...
Agreed, will lower it down. I think we should be okay with 8 for start.