On Fri, Jul 26, 2024 at 11:21 AM Yonghong Song <yonghong.song@xxxxxxxxx> wrote: > > > On 7/24/24 2:13 AM, Ming Lei wrote: > > On Tue, Jul 23, 2024 at 09:43:12PM -0700, Kui-Feng Lee wrote: > >> > >> On 7/23/24 20:19, Ming Lei wrote: > >>> Export btf_find_by_name_kind and bpf_base_func_proto, so that kernel > >>> module can use them. > >>> > >>> Almost all existed struct_ops users(hid, sched_ext, ...) need the two APIs. > >>> > >>> Without this change, hid-bpf can't be built as module. > >> Could you give me more context? > >> Give me a link of an example code or something? > >> Or explain the use case? > > The merged patchset "Registrating struct_ops types from modules" is > > trying to allow module to register struct_ops, which often needs > > bpf_base_func_proto()(for allowing generic helpers available in > > prog) and btf_find_by_name_kind() (for implementing .btf_struct_access). > > > > One example is hid-bpf, which is a driver and supposed to build as module, > > but it can't be done because the two APIs aren't exported. > > Could you give more specific examples about where these two APIs are > used in hid-bpf? Sure, hid-bpf struct_ops has been merged to linus tree already. However, it can't be built as module because the two APIs aren't exported: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/hid/bpf/hid_bpf_struct_ops.c Thanks, Ming