Skip to content

Commit 45f5df4

Browse files
chenhengqiyonghong-song
authored andcommitted
libbpf-tools: Remove map flag BPF_F_NO_PREALLOC
Using hash maps with BPF_F_NO_PREALLOC flag triggers a warning ([0]), and according to kernel [commit 94dacdbd5d2d](torvalds/linux@94dacdbd5d2d), this may cause deadlocks. Remove the flag from libbpf tools. [0]: https://github.com/torvalds/linux/blob/v5.18/kernel/bpf/verifier.c#L11972-L12000 Signed-off-by: Hengqi Chen <[email protected]>
1 parent 70e8a9b commit 45f5df4

File tree

9 files changed

+0
-15
lines changed

9 files changed

+0
-15
lines changed

libbpf-tools/biolatency.bpf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ struct {
3535
__uint(max_entries, MAX_ENTRIES);
3636
__type(key, struct request *);
3737
__type(value, u64);
38-
__uint(map_flags, BPF_F_NO_PREALLOC);
3938
} start SEC(".maps");
4039

4140
static struct hist initial_hist;
@@ -45,7 +44,6 @@ struct {
4544
__uint(max_entries, MAX_ENTRIES);
4645
__type(key, struct hist_key);
4746
__type(value, struct hist);
48-
__uint(map_flags, BPF_F_NO_PREALLOC);
4947
} hists SEC(".maps");
5048

5149
static __always_inline

libbpf-tools/biopattern.bpf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ struct {
1414
__uint(max_entries, 64);
1515
__type(key, u32);
1616
__type(value, struct counter);
17-
__uint(map_flags, BPF_F_NO_PREALLOC);
1817
} counters SEC(".maps");
1918

2019
SEC("tracepoint/block/block_rq_complete")

libbpf-tools/biosnoop.bpf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct {
3636
__uint(max_entries, MAX_ENTRIES);
3737
__type(key, struct request *);
3838
__type(value, struct piddata);
39-
__uint(map_flags, BPF_F_NO_PREALLOC);
4039
} infobyreq SEC(".maps");
4140

4241
struct stage {

libbpf-tools/biostacks.bpf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ struct {
2828
__uint(max_entries, MAX_ENTRIES);
2929
__type(key, struct request *);
3030
__type(value, struct internal_rqinfo);
31-
__uint(map_flags, BPF_F_NO_PREALLOC);
3231
} rqinfos SEC(".maps");
3332

3433
struct {
3534
__uint(type, BPF_MAP_TYPE_HASH);
3635
__uint(max_entries, MAX_ENTRIES);
3736
__type(key, struct rqinfo);
3837
__type(value, struct hist);
39-
__uint(map_flags, BPF_F_NO_PREALLOC);
4038
} hists SEC(".maps");
4139

4240
static struct hist zero;

libbpf-tools/bitesize.bpf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ struct {
2222
__uint(max_entries, 10240);
2323
__type(key, struct hist_key);
2424
__type(value, struct hist);
25-
__uint(map_flags, BPF_F_NO_PREALLOC);
2625
} hists SEC(".maps");
2726

2827
static struct hist initial_hist;

libbpf-tools/numamove.bpf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ struct {
99
__uint(max_entries, 10240);
1010
__type(key, u32);
1111
__type(value, u64);
12-
__uint(map_flags, BPF_F_NO_PREALLOC);
1312
} start SEC(".maps");
1413

1514
__u64 latency = 0;

libbpf-tools/readahead.bpf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ struct {
1313
__uint(max_entries, MAX_ENTRIES);
1414
__type(key, u32);
1515
__type(value, u64);
16-
__uint(map_flags, BPF_F_NO_PREALLOC);
1716
} in_readahead SEC(".maps");
1817

1918
struct {
2019
__uint(type, BPF_MAP_TYPE_HASH);
2120
__uint(max_entries, MAX_ENTRIES);
2221
__type(key, struct page *);
2322
__type(value, u64);
24-
__uint(map_flags, BPF_F_NO_PREALLOC);
2523
} birth SEC(".maps");
2624

2725
struct hist hist = {};

libbpf-tools/syscount.bpf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ struct {
2828
__uint(max_entries, MAX_ENTRIES);
2929
__type(key, u32);
3030
__type(value, u64);
31-
__uint(map_flags, BPF_F_NO_PREALLOC);
3231
} start SEC(".maps");
3332

3433
struct {
3534
__uint(type, BPF_MAP_TYPE_HASH);
3635
__uint(max_entries, MAX_ENTRIES);
3736
__type(key, u32);
3837
__type(value, struct data_t);
39-
__uint(map_flags, BPF_F_NO_PREALLOC);
4038
} data SEC(".maps");
4139

4240
static __always_inline

libbpf-tools/tcpconnect.bpf.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,20 @@ struct {
2626
__uint(max_entries, MAX_ENTRIES);
2727
__type(key, u32);
2828
__type(value, struct sock *);
29-
__uint(map_flags, BPF_F_NO_PREALLOC);
3029
} sockets SEC(".maps");
3130

3231
struct {
3332
__uint(type, BPF_MAP_TYPE_HASH);
3433
__uint(max_entries, MAX_ENTRIES);
3534
__type(key, struct ipv4_flow_key);
3635
__type(value, u64);
37-
__uint(map_flags, BPF_F_NO_PREALLOC);
3836
} ipv4_count SEC(".maps");
3937

4038
struct {
4139
__uint(type, BPF_MAP_TYPE_HASH);
4240
__uint(max_entries, MAX_ENTRIES);
4341
__type(key, struct ipv6_flow_key);
4442
__type(value, u64);
45-
__uint(map_flags, BPF_F_NO_PREALLOC);
4643
} ipv6_count SEC(".maps");
4744

4845
struct {

0 commit comments

Comments
 (0)