summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2022-11-16 15:23:48 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-19 12:41:02 +0100
commit0a81076a3681f30a9c35ff4b16ac93d09a98120c (patch)
treeb18e6729da7d38af6b3679b254aa5fb7088f4e57 /tools/lib
parent1798b62d642e7b3d4ea3403914c3caf4e438465d (diff)
libbpf: Use page size as max_entries when probing ring buffer map
[ Upstream commit 689eb2f1ba46b4b02195ac2a71c55b96d619ebf8 ] Using page size as max_entries when probing ring buffer map, else the probe may fail on host with 64KB page size (e.g., an ARM64 host). After the fix, the output of "bpftool feature" on above host will be correct. Before : eBPF map_type ringbuf is NOT available eBPF map_type user_ringbuf is NOT available After : eBPF map_type ringbuf is available eBPF map_type user_ringbuf is available Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20221116072351.1168938-2-houtao@huaweicloud.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/libbpf_probes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
index 6d495656f554c..29f7cde107418 100644
--- a/tools/lib/bpf/libbpf_probes.c
+++ b/tools/lib/bpf/libbpf_probes.c
@@ -233,7 +233,7 @@ static int probe_map_create(enum bpf_map_type map_type)
case BPF_MAP_TYPE_RINGBUF:
key_size = 0;
value_size = 0;
- max_entries = 4096;
+ max_entries = sysconf(_SC_PAGE_SIZE);
break;
case BPF_MAP_TYPE_STRUCT_OPS:
/* we'll get -ENOTSUPP for invalid BTF type ID for struct_ops */