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
2490 bpf_link_free(link);2490 bpf_link_free(link);
2491 }2491 }
2492}2492}
2493EXPORT_SYMBOL(bpf_link_put);
2493 2494
2494static int bpf_link_release(struct inode *inode, struct file *filp)2495static int bpf_link_release(struct inode *inode, struct file *filp)
2495{2496{
@@ -2632,6 +2633,7 @@ struct bpf_link *bpf_link_get_from_fd(u32 ufd) · 136 unmodified lines
2632 2633
2633 return link;2634 return link;
2634}2635}
2636EXPORT_SYMBOL(bpf_link_get_from_fd);
2635 2637
2636struct bpf_tracing_link {2638struct bpf_tracing_link {
2637 struct bpf_link link;2639 struct bpf_link link;