Re: [PATCH v2 0/7] KSTATE: a mechanism to migrate some part of the kernel state across kexec

From: Cong Wang
Date: Mon Mar 10 2025 - 22:27:55 EST


Hi Andrey,

On Mon, Mar 10, 2025 at 5:04 AM Andrey Ryabinin <arbn@xxxxxxxxxxxxxxx> wrote:
> Each driver/subsystem has to solve this problem in their own way.
> Also if we use fdt properties for individual fields, that might be wastefull
> in terms of used memory, as these properties use strings as keys.
>
> While with KSTATE solves the same problem in more elegant way, with this:
> struct kstate_description a_state = {
> .name = "a_struct",
> .version_id = 1,
> .id = KSTATE_TEST_ID,
> .state_list = LIST_HEAD_INIT(test_state.state_list),
> .fields = (const struct kstate_field[]) {
> KSTATE_BASE_TYPE(i, struct a, int),
> KSTATE_BASE_TYPE(s, struct a, char [10]),
> KSTATE_POINTER(p_ulong, struct a),
> KSTATE_PAGE(page, struct a),
> KSTATE_END_OF_LIST()
> },
> };

Hmm, this still requires manual efforts to implement this, so potentially
a lot of work given how many drivers we have in-tree.

And those KSTATE_* stuffs look a lot similar to BTF:
https://docs.kernel.org/bpf/btf.html

So, any possibility to reuse BTF here? Note, BTF is automatically
generated by pahole, no manual effort is required.

Regards,
Cong Wang