summaryrefslogtreecommitdiff
path: root/kernel/bpf/sysfs_btf.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2020-05-13 09:58:49 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-05-15 08:18:53 -0700
commit0ee52c0f6c67e187ff1906f6048af7c96df320c7 (patch)
tree58be0afc7de627f5b4ca43e603af0eae37940f3f /kernel/bpf/sysfs_btf.c
parent5cc5924d8315a53e03e7dbfa7a3067cde7a81ded (diff)
bpf, bpftool: Allow probing for CONFIG_HZ from kernel config
In Cilium we've recently switched to make use of bpf_jiffies64() for parts of our tc and XDP datapath since bpf_ktime_get_ns() is more expensive and high-precision is not needed for our timeouts we have anyway. Our agent has a probe manager which picks up the json of bpftool's feature probe and we also use the macro output in our C programs e.g. to have workarounds when helpers are not available on older kernels. Extend the kernel config info dump to also include the kernel's CONFIG_HZ, and rework the probe_kernel_image_config() for allowing a macro dump such that CONFIG_HZ can be propagated to BPF C code as a simple define if available via config. Latter allows to have _compile- time_ resolution of jiffies <-> sec conversion in our code since all are propagated as known constants. Given we cannot generally assume availability of kconfig everywhere, we also have a kernel hz probe [0] as a fallback. Potentially, bpftool could have an integrated probe fallback as well, although to derive it, we might need to place it under 'bpftool feature probe full' or similar given it would slow down the probing process overall. Yet 'full' doesn't fit either for us since we don't want to pollute the kernel log with warning messages from bpf_probe_write_user() and bpf_trace_printk() on agent startup; I've left it out for the time being. [0] https://github.com/cilium/cilium/blob/master/bpf/cilium-probe-kernel-hz.c Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Cc: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20200513075849.20868-1-daniel@iogearbox.net
Diffstat (limited to 'kernel/bpf/sysfs_btf.c')
0 files changed, 0 insertions, 0 deletions