Re: [RFC PATCH bpf-next 01/17] bpf: Link shimlink directly in trampoline

Song Liu
2022-08-08T17:41:40Z

On Mon, Aug 8, 2022 at 7:06 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> We are going to get rid of struct bpf_tramp_link in following
> changes and cgroup_shim_find logic does not fit to that.
>
> We can store the link directly in the trampoline and omit the
> cgroup_shim_find searching logic.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> include/linux/bpf.h | 3 +++
> kernel/bpf/trampoline.c | 23 +++--------------------
> 2 files changed, 6 insertions(+), 20 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 20c26aed7896..ed2a921094bc 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -841,6 +841,8 @@ struct bpf_tramp_image {
> };
> };
>
> +struct bpf_shim_tramp_link;
> +
> struct bpf_trampoline {
> /* hlist for trampoline_table */
> struct hlist_node hlist;
> @@ -868,6 +870,7 @@ struct bpf_trampoline {
> struct bpf_tramp_image *cur_image;
> u64 selector;
> struct module *mod;
> + struct bpf_shim_tramp_link *shim_link;
> };

Hi Stanislav,

Is it possible to have multiple shim_link per bpf_trampoline? If so, I guess
this won't work.

Thanks,
Song …