History

bpf: Convert bpf_preload.ko to use light skeleton.

The main change is a move of the single line #include "iterators.lskel.h" from iterators/iterators.c to bpf_preload_kern.c. Which means that generated light skeleton can be used from user space or user mode driver like iterators.c or from the kernel module or the kernel itself. The direct use of light skeleton from the kernel module simplifies the code, since UMD is no longer necessary. The libbpf.a required user space and UMD. The CO-RE in the kernel and generated "loader bpf program" used by the light skeleton are capable to perform complex loading operations traditionally provided by libbpf. In addition UMD approach was launching UMD process every time bpffs has to be mounted. With light skeleton in the kernel the bpf_preload kernel module loads bpf iterators once and pins them multiple times into different bpffs mounts.

Alexei Starovoitov committed 4 years ago

Commit cb80ddc1 parent d7beb3d9 files · +70 −247Browse files

Showing the changes to kernel/bpf/syscall.c (1 of 9 files). Show all

Unified · Split

kernel/bpf/syscall.c+2−0
@@ -2490,6 +2490,7 @@ void bpf_link_put(struct bpf_link *link) · 2489 unmodified lines
24902490 bpf_link_free(link);
24912491 }
24922492 }
2493+EXPORT_SYMBOL(bpf_link_put);
24932494
24942495 static int bpf_link_release(struct inode *inode, struct file *filp)
24952496 {
@@ -2632,6 +2633,7 @@ struct bpf_link *bpf_link_get_from_fd(u32 ufd) · 136 unmodified lines
26322633
26332634 return link;
26342635 }
2636+EXPORT_SYMBOL(bpf_link_get_from_fd);
26352637
26362638 struct bpf_tracing_link {
26372639 struct bpf_link link;