On Mon, Nov 22, 2021 at 6:47 AM Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> wrote: > > resolve_btfids prints a warning when it finds an unresolved symbol, > (id == 0) in id_patch. This can be the case for BTF sets that are empty > (due to disabled config options), hence printing warnings for certain > builds, most recently seen in [0]. > > The reason behind this is because id->cnt aliases id->id in btf_id > struct, leading to empty set showing up as ID 0 when we get to id_patch, > which triggers the warning. Since sets are an exception here, accomodate > by reusing hole in btf_id for bool is_set member, setting it to true for > BTF set when setting id->cnt, and use that to skip extraneous warning. > > [0]: https://lore.kernel.org/all/1b99ae14-abb4-d18f-cc6a-d7e523b25542@xxxxxxxxx > > Before: > > ; ./tools/bpf/resolve_btfids/resolve_btfids -v -b vmlinux net/ipv4/tcp_cubic.ko > adding symbol tcp_cubic_kfunc_ids > WARN: resolve_btfids: unresolved symbol tcp_cubic_kfunc_ids > patching addr 0: ID 0 [tcp_cubic_kfunc_ids] > sorting addr 4: cnt 0 [tcp_cubic_kfunc_ids] > update ok for net/ipv4/tcp_cubic.ko > > After: > > ; ./tools/bpf/resolve_btfids/resolve_btfids -v -b vmlinux net/ipv4/tcp_cubic.ko > adding symbol tcp_cubic_kfunc_ids > patching addr 0: ID 0 [tcp_cubic_kfunc_ids] > sorting addr 4: cnt 0 [tcp_cubic_kfunc_ids] > update ok for net/ipv4/tcp_cubic.ko > > Cc: Jiri Olsa <jolsa@xxxxxxxxxx> > Fixes: 0e32dfc80bae ("bpf: Enable TCP congestion control kfunc from modules") > Reported-by: Pavel Skripkin <paskripkin@xxxxxxxxx> > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> Acked-by: Song Liu <songliubraving@xxxxxx>