Re: [PATCH bpf-next v2 08/15] libbpf: sync progs autoload with maps autocreate for struct_ops maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2024-03-02 at 03:19 +0200, Eduard Zingerman wrote:
> Automatically select which struct_ops programs to load depending on
> which struct_ops maps are selected for automatic creation.
> E.g. for the BPF code below:
> 
>     SEC("struct_ops/test_1") int BPF_PROG(foo) { ... }
>     SEC("struct_ops/test_2") int BPF_PROG(bar) { ... }
> 
>     SEC(".struct_ops.link")
>     struct test_ops___v1 A = {
>         .foo = (void *)foo
>     };
> 
>     SEC(".struct_ops.link")
>     struct test_ops___v2 B = {
>         .foo = (void *)foo,
>         .bar = (void *)bar,
>     };
> 
> And the following libbpf API calls:
> 
>     bpf_map__set_autocreate(skel->maps.A, true);
>     bpf_map__set_autocreate(skel->maps.B, false);
> 
> The autoload would be enabled for program 'foo' and disabled for
> program 'bar'.
> 
> To achieve this:
> - for struct_ops programs referenced from struct_ops maps set autoload
>   property at open() to false;
> - when creating struct_ops maps set autoload property of referenced
>   programs to true.
> 
> (Note: struct_ops programs not referenced from any map would have
>  their autoload property set to true by default.
>  If attach_btf_id and expected_attach_type properties would not be
>  specified for such programs manually, the load phase would fail).
> 
> Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx>
> ---

I talked to Andrii today and he asked to move all logic related to
these things to "load" phase. Will post v3 shortly.

[...]





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux