summaryrefslogtreecommitdiffstats
path: root/Documentation/locking/lglock.txt
diff options
context:
space:
mode:
authorWang Nan2015-11-16 13:10:09 +0100
committerArnaldo Carvalho de Melo2015-11-18 21:51:03 +0100
commitb580563e38487d9db8e94080149644da71c533c1 (patch)
tree7c4f1b69a9b99706c1aaec7c818cb09221673b03 /Documentation/locking/lglock.txt
parenttools: Clone the kernel's strtobool function (diff)
downloadkernel-qcow2-linux-b580563e38487d9db8e94080149644da71c533c1.tar.gz
kernel-qcow2-linux-b580563e38487d9db8e94080149644da71c533c1.tar.xz
kernel-qcow2-linux-b580563e38487d9db8e94080149644da71c533c1.zip
bpf tools: Load a program with different instances using preprocessor
This patch is a preparation for BPF prologue support which allows generating a series of BPF bytecode for fetching kernel data before calling program code. With the newly introduced multiple instances support, perf is able to create different prologues for different kprobe points. Before this patch, a bpf_program can be loaded into kernel only once, and get the only resulting fd. What this patch does is to allow creating and loading different variants of one bpf_program, then fetching their fds. Here we describe the basic idea in this patch. The detailed description of the newly introduced APIs can be found in comments in the patch body. The key of this patch is the new mechanism in bpf_program__load(). Instead of loading BPF program into kernel directly, it calls a 'pre-processor' to generate program instances which would be finally loaded into the kernel based on the original code. To enable the generation of multiple instances, libbpf passes an index to the pre-processor so it know which instance is being loaded. Pre-processor should be called from libbpf's user (perf) using bpf_program__set_prep(). The number of instances and the relationship between indices and the target instance should be clear when calling bpf_program__set_prep(). To retrieve a fd for a specific instance of a program, bpf_program__nth_fd() is introduced. It returns the resulting fd according to index. Signed-off-by: He Kuang <hekuang@huawei.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: He Kuang <hekuang@huawei.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1447675815-166222-8-git-send-email-wangnan0@huawei.com Signed-off-by: Wang Nan <wangnan0@huawei.com> [ Enclosed multi-line if/else blocks with {}, (*func_ptr)() -> func_ptr() ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'Documentation/locking/lglock.txt')
0 files changed, 0 insertions, 0 deletions