Re: [PATCH bpf-next v1 7/8] libbpf: sync progs autoload with maps autocreate for struct_ops maps

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

 



On Tue, 2024-02-27 at 18:10 -0800, Martin KaFai Lau wrote:
[...]

> Instead of adding struct_ops_refs and autoload_user_set,
> 
> for BPF_PROG_TYPE_STRUCT_OPS, how about deciding to load it or not by checking 
> prog->attach_btf_id (non zero) alone. The prog->attach_btf_id is now decided at 
> load time and is only set if it is used by at least one autocreate map, if I 
> read patch 2 & 3 correctly.
> 
> Meaning ignore prog->autoload*. Load the struct_ops prog as long as it is used 
> by one struct_ops map with autocreate == true.
> 
> If the struct_ops prog is not used in any struct_ops map, the bpf prog cannot be 
> loaded even the autoload is set. If bpf prog is used in a struct_ops map and its 
> autoload is set to false, the struct_ops map will be in broken state. Thus, 
> prog->autoload does not fit very well with struct_ops prog and may as well 
> depend on whether the struct_ops prog is used by a struct_ops map alone?

This makes sense.
The drawback is that introspection capability to query which programs
would be loaded is lost, maybe that is not a big deal.
It could be put back by adding an ugly loop iterating over all maps in
bpf_program__autoload() for struct_ops programs.

I think I'll post v2 with changes you suggest and see what others have to say.





[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