* [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups
@ 2022-04-05 13:08 Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 01/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdping Yafang Shao
` (27 more replies)
0 siblings, 28 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
We have switched to memcg based memory accouting and thus the rlimit is
not needed any more. LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK was introduced in
libbpf for backward compatibility, so we can use it instead now.
This patchset cleanups the usage of RLIMIT_MEMLOCK in tools/bpf/,
tools/testing/selftests/bpf and samples/bpf. The file
tools/testing/selftests/bpf/bpf_rlimit.h is removed. The included header
sys/resource.h is removed from many files as it is useless in these files.
- v3: Get rid of bpf_rlimit.h and fix some typos (Andrii)
- v2: Use libbpf_set_strict_mode instead. (Andrii)
- v1: https://lore.kernel.org/bpf/20220320060815.7716-2-laoar.shao@gmail.com/
Yafang Shao (27):
bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
xdping
bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
xdpxceiver
bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user
bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load
bpf: selftests: Set libbpf 1.0 API mode explicitly in
get_cgroup_id_user
bpf: selftests: Set libbpf 1.0 API mode explicitly in
test_cgroup_storage
bpf: selftests: Set libbpf 1.0 API mode explicitly in
get_cgroup_id_user
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map
bpf: selftests: Set libbpf 1.0 API mode explicitly in
test_skb_cgroup_id_user
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl
bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag
bpf: selftests: Set libbpf 1.0 API mode explicitly in
test_tcp_check_syncookie_user
bpf: selftests: Set libbpf 1.0 API mode explicitly in
test_verifier_log
bpf: samples: Set libbpf 1.0 API mode explicitly in hbm
bpf: selftests: Get rid of bpf_rlimit.h
bpf: selftests: No need to include sys/resource.h in some files
bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
xdpsock_user
bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
xsk_fwd
bpf: samples: No need to include sys/resource.h in many files
bpf: bpftool: Remove useless return value of libbpf_set_strict_mode
bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf
bpf: bpftool: remove RLIMIT_MEMLOCK
bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK
samples/bpf/cpustat_user.c | 1 -
samples/bpf/hbm.c | 5 ++--
samples/bpf/ibumad_user.c | 1 -
samples/bpf/map_perf_test_user.c | 1 -
samples/bpf/offwaketime_user.c | 1 -
samples/bpf/sockex2_user.c | 1 -
samples/bpf/sockex3_user.c | 1 -
samples/bpf/spintest_user.c | 1 -
samples/bpf/syscall_tp_user.c | 1 -
samples/bpf/task_fd_query_user.c | 1 -
samples/bpf/test_lru_dist.c | 1 -
samples/bpf/test_map_in_map_user.c | 1 -
samples/bpf/test_overhead_user.c | 1 -
samples/bpf/tracex2_user.c | 1 -
samples/bpf/tracex3_user.c | 1 -
samples/bpf/tracex4_user.c | 1 -
samples/bpf/tracex5_user.c | 1 -
samples/bpf/tracex6_user.c | 1 -
samples/bpf/xdp1_user.c | 1 -
samples/bpf/xdp_adjust_tail_user.c | 1 -
samples/bpf/xdp_monitor_user.c | 1 -
samples/bpf/xdp_redirect_cpu_user.c | 1 -
samples/bpf/xdp_redirect_map_multi_user.c | 1 -
samples/bpf/xdp_redirect_user.c | 1 -
samples/bpf/xdp_router_ipv4_user.c | 1 -
samples/bpf/xdp_rxq_info_user.c | 1 -
samples/bpf/xdp_sample_pkts_user.c | 1 -
samples/bpf/xdp_sample_user.c | 1 -
samples/bpf/xdp_tx_iptunnel_user.c | 1 -
samples/bpf/xdpsock_user.c | 9 ++----
samples/bpf/xsk_fwd.c | 7 ++---
tools/bpf/bpftool/common.c | 8 ------
tools/bpf/bpftool/feature.c | 2 --
tools/bpf/bpftool/main.c | 6 ++--
tools/bpf/bpftool/main.h | 2 --
tools/bpf/bpftool/map.c | 2 --
tools/bpf/bpftool/pids.c | 1 -
tools/bpf/bpftool/prog.c | 3 --
tools/bpf/bpftool/struct_ops.c | 2 --
tools/bpf/runqslower/runqslower.c | 18 ++----------
tools/testing/selftests/bpf/bench.c | 1 -
tools/testing/selftests/bpf/bpf_rlimit.h | 28 -------------------
.../selftests/bpf/flow_dissector_load.c | 6 ++--
.../selftests/bpf/get_cgroup_id_user.c | 4 ++-
tools/testing/selftests/bpf/prog_tests/btf.c | 1 -
.../selftests/bpf/test_cgroup_storage.c | 4 ++-
tools/testing/selftests/bpf/test_dev_cgroup.c | 4 ++-
tools/testing/selftests/bpf/test_lpm_map.c | 4 ++-
tools/testing/selftests/bpf/test_lru_map.c | 4 ++-
.../selftests/bpf/test_skb_cgroup_id_user.c | 4 ++-
tools/testing/selftests/bpf/test_sock.c | 4 ++-
tools/testing/selftests/bpf/test_sock_addr.c | 4 ++-
tools/testing/selftests/bpf/test_sockmap.c | 5 ++--
tools/testing/selftests/bpf/test_sysctl.c | 4 ++-
tools/testing/selftests/bpf/test_tag.c | 4 ++-
.../bpf/test_tcp_check_syncookie_user.c | 4 ++-
.../selftests/bpf/test_tcpnotify_user.c | 1 -
.../testing/selftests/bpf/test_verifier_log.c | 5 ++--
.../selftests/bpf/xdp_redirect_multi.c | 1 -
tools/testing/selftests/bpf/xdping.c | 8 ++----
tools/testing/selftests/bpf/xdpxceiver.c | 6 ++--
61 files changed, 57 insertions(+), 142 deletions(-)
delete mode 100644 tools/testing/selftests/bpf/bpf_rlimit.h
--
2.17.1
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 01/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdping
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 02/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpxceiver Yafang Shao
` (26 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Explicitly set libbpf 1.0 API mode, then we can avoid using the deprecated
RLIMIT_MEMLOCK.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/xdping.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/xdping.c b/tools/testing/selftests/bpf/xdping.c
index c567856fd1bc..5b6f977870f8 100644
--- a/tools/testing/selftests/bpf/xdping.c
+++ b/tools/testing/selftests/bpf/xdping.c
@@ -12,7 +12,6 @@
#include <string.h>
#include <unistd.h>
#include <libgen.h>
-#include <sys/resource.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -89,7 +88,6 @@ int main(int argc, char **argv)
{
__u32 mode_flags = XDP_FLAGS_DRV_MODE | XDP_FLAGS_SKB_MODE;
struct addrinfo *a, hints = { .ai_family = AF_INET };
- struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
__u16 count = XDPING_DEFAULT_COUNT;
struct pinginfo pinginfo = { 0 };
const char *optstr = "c:I:NsS";
@@ -167,10 +165,8 @@ int main(int argc, char **argv)
freeaddrinfo(a);
}
- if (setrlimit(RLIMIT_MEMLOCK, &r)) {
- perror("setrlimit(RLIMIT_MEMLOCK)");
- return 1;
- }
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 02/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpxceiver
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 01/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdping Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 03/27] bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user Yafang Shao
` (25 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Explicitly set libbpf 1.0 API mode, then we can avoid using the deprecated
RLIMIT_MEMLOCK.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/xdpxceiver.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 5f8296d29e77..cfcb031323c5 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -90,7 +90,6 @@
#include <string.h>
#include <stddef.h>
#include <sys/mman.h>
-#include <sys/resource.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <time.h>
@@ -1448,14 +1447,13 @@ static void ifobject_delete(struct ifobject *ifobj)
int main(int argc, char **argv)
{
- struct rlimit _rlim = { RLIM_INFINITY, RLIM_INFINITY };
struct pkt_stream *pkt_stream_default;
struct ifobject *ifobj_tx, *ifobj_rx;
struct test_spec test;
u32 i, j;
- if (setrlimit(RLIMIT_MEMLOCK, &_rlim))
- exit_with_error(errno);
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
ifobj_tx = ifobject_create();
if (!ifobj_tx)
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 03/27] bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 01/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdping Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 02/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpxceiver Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 04/27] bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load Yafang Shao
` (24 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
We have set libbpf 1.0 API mode explicitly, so don't need to include the
header bpf_rlimit.h any more.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_tcpnotify_user.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_tcpnotify_user.c b/tools/testing/selftests/bpf/test_tcpnotify_user.c
index 4c5114765b23..8284db8b0f13 100644
--- a/tools/testing/selftests/bpf/test_tcpnotify_user.c
+++ b/tools/testing/selftests/bpf/test_tcpnotify_user.c
@@ -19,7 +19,6 @@
#include <linux/perf_event.h>
#include <linux/err.h>
-#include "bpf_rlimit.h"
#include "bpf_util.h"
#include "cgroup_helpers.h"
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 04/27] bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (2 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 03/27] bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 05/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
` (23 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
We have set libbpf 1.0 API mode explicitly, so don't need to include the
header bpf_rlimit.h any more. This patch also removes the check of the
return value of libbpf_set_strict_mode as it always return 0.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/flow_dissector_load.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/flow_dissector_load.c b/tools/testing/selftests/bpf/flow_dissector_load.c
index 87fd1aa323a9..c8be6406777f 100644
--- a/tools/testing/selftests/bpf/flow_dissector_load.c
+++ b/tools/testing/selftests/bpf/flow_dissector_load.c
@@ -11,7 +11,6 @@
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
-#include "bpf_rlimit.h"
#include "flow_dissector_load.h"
const char *cfg_pin_path = "/sys/fs/bpf/flow_dissector";
@@ -25,9 +24,8 @@ static void load_and_attach_program(void)
int prog_fd, ret;
struct bpf_object *obj;
- ret = libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
- if (ret)
- error(1, 0, "failed to enable libbpf strict mode: %d", ret);
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
ret = bpf_flow_load(&obj, cfg_path_name, cfg_prog_name,
cfg_map_name, NULL, &prog_fd, NULL);
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 05/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (3 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 04/27] bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 06/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_cgroup_storage Yafang Shao
` (22 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/get_cgroup_id_user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/get_cgroup_id_user.c b/tools/testing/selftests/bpf/get_cgroup_id_user.c
index 3a7b82bd9e94..e021cc67dc02 100644
--- a/tools/testing/selftests/bpf/get_cgroup_id_user.c
+++ b/tools/testing/selftests/bpf/get_cgroup_id_user.c
@@ -20,7 +20,6 @@
#include "cgroup_helpers.h"
#include "testing_helpers.h"
-#include "bpf_rlimit.h"
#define CHECK(condition, tag, format...) ({ \
int __ret = !!(condition); \
@@ -67,6 +66,9 @@ int main(int argc, char **argv)
if (CHECK(cgroup_fd < 0, "cgroup_setup_and_join", "err %d errno %d\n", cgroup_fd, errno))
return 1;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
err = bpf_prog_test_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd);
if (CHECK(err, "bpf_prog_test_load", "err %d errno %d\n", err, errno))
goto cleanup_cgroup_env;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 06/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_cgroup_storage
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (4 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 05/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
` (21 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_cgroup_storage.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_cgroup_storage.c b/tools/testing/selftests/bpf/test_cgroup_storage.c
index d6a1be4d8020..059507445c6e 100644
--- a/tools/testing/selftests/bpf/test_cgroup_storage.c
+++ b/tools/testing/selftests/bpf/test_cgroup_storage.c
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <sys/sysinfo.h>
-#include "bpf_rlimit.h"
#include "cgroup_helpers.h"
#include "testing_helpers.h"
@@ -51,6 +50,9 @@ int main(int argc, char **argv)
goto err;
}
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
map_fd = bpf_map_create(BPF_MAP_TYPE_CGROUP_STORAGE, NULL, sizeof(key),
sizeof(value), 0, NULL);
if (map_fd < 0) {
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (5 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 06/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_cgroup_storage Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 20:46 ` Jeff Johnson
2022-04-05 13:08 ` [PATCH bpf-next v3 08/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map Yafang Shao
` (20 subsequent siblings)
27 siblings, 1 reply; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_dev_cgroup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_dev_cgroup.c b/tools/testing/selftests/bpf/test_dev_cgroup.c
index c299d3452695..7886265846a0 100644
--- a/tools/testing/selftests/bpf/test_dev_cgroup.c
+++ b/tools/testing/selftests/bpf/test_dev_cgroup.c
@@ -15,7 +15,6 @@
#include "cgroup_helpers.h"
#include "testing_helpers.h"
-#include "bpf_rlimit.h"
#define DEV_CGROUP_PROG "./dev_cgroup.o"
@@ -28,6 +27,9 @@ int main(int argc, char **argv)
int prog_fd, cgroup_fd;
__u32 prog_cnt;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
if (bpf_prog_test_load(DEV_CGROUP_PROG, BPF_PROG_TYPE_CGROUP_DEVICE,
&obj, &prog_fd)) {
printf("Failed to load DEV_CGROUP program\n");
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 08/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (6 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 09/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map Yafang Shao
` (19 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_lpm_map.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_lpm_map.c b/tools/testing/selftests/bpf/test_lpm_map.c
index aa294612e0a7..789c9748d241 100644
--- a/tools/testing/selftests/bpf/test_lpm_map.c
+++ b/tools/testing/selftests/bpf/test_lpm_map.c
@@ -26,7 +26,6 @@
#include <bpf/bpf.h>
#include "bpf_util.h"
-#include "bpf_rlimit.h"
struct tlpm_node {
struct tlpm_node *next;
@@ -791,6 +790,9 @@ int main(void)
/* we want predictable, pseudo random tests */
srand(0xf00ba1);
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
test_lpm_basic();
test_lpm_order();
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 09/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (7 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 08/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 10/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_skb_cgroup_id_user Yafang Shao
` (18 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_lru_map.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_lru_map.c b/tools/testing/selftests/bpf/test_lru_map.c
index 563bbe18c172..a6aa2d121955 100644
--- a/tools/testing/selftests/bpf/test_lru_map.c
+++ b/tools/testing/selftests/bpf/test_lru_map.c
@@ -18,7 +18,6 @@
#include <bpf/libbpf.h>
#include "bpf_util.h"
-#include "bpf_rlimit.h"
#include "../../../include/linux/filter.h"
#define LOCAL_FREE_TARGET (128)
@@ -878,6 +877,9 @@ int main(int argc, char **argv)
assert(nr_cpus != -1);
printf("nr_cpus:%d\n\n", nr_cpus);
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
for (f = 0; f < ARRAY_SIZE(map_flags); f++) {
unsigned int tgt_free = (map_flags[f] & BPF_F_NO_COMMON_LRU) ?
PERCPU_FREE_TARGET : LOCAL_FREE_TARGET;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 10/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_skb_cgroup_id_user
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (8 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 09/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 11/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr Yafang Shao
` (17 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_skb_cgroup_id_user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c b/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
index 4a64306728ab..3256de30f563 100644
--- a/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
+++ b/tools/testing/selftests/bpf/test_skb_cgroup_id_user.c
@@ -15,7 +15,6 @@
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
-#include "bpf_rlimit.h"
#include "cgroup_helpers.h"
#define CGROUP_PATH "/skb_cgroup_test"
@@ -160,6 +159,9 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
cgfd = cgroup_setup_and_join(CGROUP_PATH);
if (cgfd < 0)
goto err;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 11/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (9 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 10/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_skb_cgroup_id_user Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 12/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock Yafang Shao
` (16 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_sock_addr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_sock_addr.c b/tools/testing/selftests/bpf/test_sock_addr.c
index f3d5d7ac6505..458564fcfc82 100644
--- a/tools/testing/selftests/bpf/test_sock_addr.c
+++ b/tools/testing/selftests/bpf/test_sock_addr.c
@@ -19,7 +19,6 @@
#include <bpf/libbpf.h>
#include "cgroup_helpers.h"
-#include "bpf_rlimit.h"
#include "bpf_util.h"
#ifndef ENOTSUPP
@@ -1418,6 +1417,9 @@ int main(int argc, char **argv)
if (cgfd < 0)
goto err;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
if (run_tests(cgfd))
goto err;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 12/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (10 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 11/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 13/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap Yafang Shao
` (15 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_sock.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
index fe10f8134278..6c4494076bbf 100644
--- a/tools/testing/selftests/bpf/test_sock.c
+++ b/tools/testing/selftests/bpf/test_sock.c
@@ -14,7 +14,6 @@
#include "cgroup_helpers.h"
#include <bpf/bpf_endian.h>
-#include "bpf_rlimit.h"
#include "bpf_util.h"
#define CG_PATH "/foo"
@@ -541,6 +540,9 @@ int main(int argc, char **argv)
if (cgfd < 0)
goto err;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
if (run_tests(cgfd))
goto err;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 13/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (11 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 12/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 14/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl Yafang Shao
` (14 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h. This patch also removes the useless sys/resource.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_sockmap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index dfb4f5c0fcb9..0fbaccdc8861 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -18,7 +18,6 @@
#include <sched.h>
#include <sys/time.h>
-#include <sys/resource.h>
#include <sys/types.h>
#include <sys/sendfile.h>
@@ -37,7 +36,6 @@
#include <bpf/libbpf.h>
#include "bpf_util.h"
-#include "bpf_rlimit.h"
#include "cgroup_helpers.h"
int running;
@@ -2017,6 +2015,9 @@ int main(int argc, char **argv)
cg_created = 1;
}
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
if (test == SELFTESTS) {
err = test_selftest(cg_fd, &options);
goto out;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 14/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (12 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 13/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 15/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag Yafang Shao
` (13 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_sysctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c
index 4f6cf833b522..5bae25ca19fb 100644
--- a/tools/testing/selftests/bpf/test_sysctl.c
+++ b/tools/testing/selftests/bpf/test_sysctl.c
@@ -14,7 +14,6 @@
#include <bpf/libbpf.h>
#include <bpf/bpf_endian.h>
-#include "bpf_rlimit.h"
#include "bpf_util.h"
#include "cgroup_helpers.h"
#include "testing_helpers.h"
@@ -1618,6 +1617,9 @@ int main(int argc, char **argv)
if (cgfd < 0)
goto err;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
if (run_tests(cgfd))
goto err;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 15/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (13 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 14/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 16/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tcp_check_syncookie_user Yafang Shao
` (12 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_tag.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_tag.c b/tools/testing/selftests/bpf/test_tag.c
index 0851c42ee31c..5546b05a0486 100644
--- a/tools/testing/selftests/bpf/test_tag.c
+++ b/tools/testing/selftests/bpf/test_tag.c
@@ -20,7 +20,6 @@
#include <bpf/bpf.h>
#include "../../../include/linux/filter.h"
-#include "bpf_rlimit.h"
#include "testing_helpers.h"
static struct bpf_insn prog[BPF_MAXINSNS];
@@ -189,6 +188,9 @@ int main(void)
uint32_t tests = 0;
int i, fd_map;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
fd_map = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(int),
sizeof(int), 1, &opts);
assert(fd_map > 0);
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 16/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tcp_check_syncookie_user
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (14 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 15/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 17/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_verifier_log Yafang Shao
` (11 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c b/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
index b9e991d43155..b57f3f0467e5 100644
--- a/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
+++ b/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
@@ -15,7 +15,6 @@
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
-#include "bpf_rlimit.h"
#include "cgroup_helpers.h"
static int start_server(const struct sockaddr *addr, socklen_t len)
@@ -214,6 +213,9 @@ int main(int argc, char **argv)
exit(1);
}
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
results = get_map_fd_by_prog_id(atoi(argv[1]), &xdp);
if (results < 0) {
log_err("Can't get map");
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 17/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_verifier_log
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (15 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 16/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tcp_check_syncookie_user Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 18/27] bpf: samples: Set libbpf 1.0 API mode explicitly in hbm Yafang Shao
` (10 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/test_verifier_log.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_verifier_log.c b/tools/testing/selftests/bpf/test_verifier_log.c
index 8d6918c3b4a2..70feda97cee5 100644
--- a/tools/testing/selftests/bpf/test_verifier_log.c
+++ b/tools/testing/selftests/bpf/test_verifier_log.c
@@ -11,8 +11,6 @@
#include <bpf/bpf.h>
-#include "bpf_rlimit.h"
-
#define LOG_SIZE (1 << 20)
#define err(str...) printf("ERROR: " str)
@@ -141,6 +139,9 @@ int main(int argc, char **argv)
memset(log, 1, LOG_SIZE);
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
/* Test incorrect attr */
printf("Test log_level 0...\n");
test_log_bad(log, LOG_SIZE, 0);
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 18/27] bpf: samples: Set libbpf 1.0 API mode explicitly in hbm
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (16 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 17/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_verifier_log Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 19/27] bpf: selftests: Get rid of bpf_rlimit.h Yafang Shao
` (9 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
included bpf_rlimit.h. It also remove the useless sys/resource.h.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
samples/bpf/hbm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c
index 1fe5bcafb3bc..516fbac28b71 100644
--- a/samples/bpf/hbm.c
+++ b/samples/bpf/hbm.c
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
-#include <sys/resource.h>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>
@@ -46,7 +45,6 @@
#include <bpf/bpf.h>
#include <getopt.h>
-#include "bpf_rlimit.h"
#include "cgroup_helpers.h"
#include "hbm.h"
#include "bpf_util.h"
@@ -510,5 +508,8 @@ int main(int argc, char **argv)
prog = argv[optind];
printf("HBM prog: %s\n", prog != NULL ? prog : "NULL");
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+
return run_bpf_prog(prog, cg_id);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 19/27] bpf: selftests: Get rid of bpf_rlimit.h
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (17 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 18/27] bpf: samples: Set libbpf 1.0 API mode explicitly in hbm Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 20/27] bpf: selftests: No need to include sys/resource.h in some files Yafang Shao
` (8 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
All the files which included bpf_rlimit.h have been set strict mode
explicitly, so we can get rid of it now.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/bpf_rlimit.h | 28 ------------------------
1 file changed, 28 deletions(-)
delete mode 100644 tools/testing/selftests/bpf/bpf_rlimit.h
diff --git a/tools/testing/selftests/bpf/bpf_rlimit.h b/tools/testing/selftests/bpf/bpf_rlimit.h
deleted file mode 100644
index 9dac9b30f8ef..000000000000
--- a/tools/testing/selftests/bpf/bpf_rlimit.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <sys/resource.h>
-#include <stdio.h>
-
-static __attribute__((constructor)) void bpf_rlimit_ctor(void)
-{
- struct rlimit rlim_old, rlim_new = {
- .rlim_cur = RLIM_INFINITY,
- .rlim_max = RLIM_INFINITY,
- };
-
- getrlimit(RLIMIT_MEMLOCK, &rlim_old);
- /* For the sake of running the test cases, we temporarily
- * set rlimit to infinity in order for kernel to focus on
- * errors from actual test cases and not getting noise
- * from hitting memlock limits. The limit is on per-process
- * basis and not a global one, hence destructor not really
- * needed here.
- */
- if (setrlimit(RLIMIT_MEMLOCK, &rlim_new) < 0) {
- perror("Unable to lift memlock rlimit");
- /* Trying out lower limit, but expect potential test
- * case failures from this!
- */
- rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20);
- rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20);
- setrlimit(RLIMIT_MEMLOCK, &rlim_new);
- }
-}
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 20/27] bpf: selftests: No need to include sys/resource.h in some files
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (18 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 19/27] bpf: selftests: Get rid of bpf_rlimit.h Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 21/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpsock_user Yafang Shao
` (7 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
sys/resource.h is useless in these files.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/testing/selftests/bpf/bench.c | 1 -
tools/testing/selftests/bpf/prog_tests/btf.c | 1 -
tools/testing/selftests/bpf/xdp_redirect_multi.c | 1 -
3 files changed, 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/bench.c b/tools/testing/selftests/bpf/bench.c
index f973320e6dbf..f061cc20e776 100644
--- a/tools/testing/selftests/bpf/bench.c
+++ b/tools/testing/selftests/bpf/bench.c
@@ -8,7 +8,6 @@
#include <fcntl.h>
#include <pthread.h>
#include <sys/sysinfo.h>
-#include <sys/resource.h>
#include <signal.h>
#include "bench.h"
#include "testing_helpers.h"
diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c
index ec823561b912..84aae639ddb5 100644
--- a/tools/testing/selftests/bpf/prog_tests/btf.c
+++ b/tools/testing/selftests/bpf/prog_tests/btf.c
@@ -8,7 +8,6 @@
#include <linux/filter.h>
#include <linux/unistd.h>
#include <bpf/bpf.h>
-#include <sys/resource.h>
#include <libelf.h>
#include <gelf.h>
#include <string.h>
diff --git a/tools/testing/selftests/bpf/xdp_redirect_multi.c b/tools/testing/selftests/bpf/xdp_redirect_multi.c
index aaedbf4955c3..c03b3a75991f 100644
--- a/tools/testing/selftests/bpf/xdp_redirect_multi.c
+++ b/tools/testing/selftests/bpf/xdp_redirect_multi.c
@@ -10,7 +10,6 @@
#include <net/if.h>
#include <unistd.h>
#include <libgen.h>
-#include <sys/resource.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 21/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpsock_user
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (19 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 20/27] bpf: selftests: No need to include sys/resource.h in some files Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 22/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xsk_fwd Yafang Shao
` (6 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Explicitly set libbpf 1.0 API mode, then we can avoid using the deprecated
RLIMIT_MEMLOCK.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
samples/bpf/xdpsock_user.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index 6f3fe30ad283..be7d2572e3e6 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -25,7 +25,6 @@
#include <string.h>
#include <sys/capability.h>
#include <sys/mman.h>
-#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
@@ -1886,7 +1885,6 @@ int main(int argc, char **argv)
{
struct __user_cap_header_struct hdr = { _LINUX_CAPABILITY_VERSION_3, 0 };
struct __user_cap_data_struct data[2] = { { 0 } };
- struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
bool rx = false, tx = false;
struct sched_param schparam;
struct xsk_umem_info *umem;
@@ -1917,11 +1915,8 @@ int main(int argc, char **argv)
data[1].effective, data[1].inheritable, data[1].permitted);
}
} else {
- if (setrlimit(RLIMIT_MEMLOCK, &r)) {
- fprintf(stderr, "ERROR: setrlimit(RLIMIT_MEMLOCK) \"%s\"\n",
- strerror(errno));
- exit(EXIT_FAILURE);
- }
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
if (opt_num_xsks > 1)
load_xdp_program(argv, &obj);
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 22/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xsk_fwd
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (20 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 21/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpsock_user Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 23/27] bpf: samples: No need to include sys/resource.h in many files Yafang Shao
` (5 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Explicitly set libbpf 1.0 API mode, then we can avoid using the deprecated
RLIMIT_MEMLOCK.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
samples/bpf/xsk_fwd.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/samples/bpf/xsk_fwd.c b/samples/bpf/xsk_fwd.c
index 2220509588a0..2324e18ccc7e 100644
--- a/samples/bpf/xsk_fwd.c
+++ b/samples/bpf/xsk_fwd.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <time.h>
@@ -131,7 +130,6 @@ static struct bpool *
bpool_init(struct bpool_params *params,
struct xsk_umem_config *umem_cfg)
{
- struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
u64 n_slabs, n_slabs_reserved, n_buffers, n_buffers_reserved;
u64 slabs_size, slabs_reserved_size;
u64 buffers_size, buffers_reserved_size;
@@ -140,9 +138,8 @@ bpool_init(struct bpool_params *params,
u8 *p;
int status;
- /* mmap prep. */
- if (setrlimit(RLIMIT_MEMLOCK, &r))
- return NULL;
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
/* bpool internals dimensioning. */
n_slabs = (params->n_buffers + params->n_buffers_per_slab - 1) /
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 23/27] bpf: samples: No need to include sys/resource.h in many files
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (21 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 22/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xsk_fwd Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 24/27] bpf: bpftool: Remove useless return value of libbpf_set_strict_mode Yafang Shao
` (4 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
The included file sys/resource.h is useless in these files, so let's
remove it.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
samples/bpf/cpustat_user.c | 1 -
samples/bpf/ibumad_user.c | 1 -
samples/bpf/map_perf_test_user.c | 1 -
samples/bpf/offwaketime_user.c | 1 -
samples/bpf/sockex2_user.c | 1 -
samples/bpf/sockex3_user.c | 1 -
samples/bpf/spintest_user.c | 1 -
samples/bpf/syscall_tp_user.c | 1 -
samples/bpf/task_fd_query_user.c | 1 -
samples/bpf/test_lru_dist.c | 1 -
samples/bpf/test_map_in_map_user.c | 1 -
samples/bpf/test_overhead_user.c | 1 -
samples/bpf/tracex2_user.c | 1 -
samples/bpf/tracex3_user.c | 1 -
samples/bpf/tracex4_user.c | 1 -
samples/bpf/tracex5_user.c | 1 -
samples/bpf/tracex6_user.c | 1 -
samples/bpf/xdp1_user.c | 1 -
samples/bpf/xdp_adjust_tail_user.c | 1 -
samples/bpf/xdp_monitor_user.c | 1 -
samples/bpf/xdp_redirect_cpu_user.c | 1 -
samples/bpf/xdp_redirect_map_multi_user.c | 1 -
samples/bpf/xdp_redirect_user.c | 1 -
samples/bpf/xdp_router_ipv4_user.c | 1 -
samples/bpf/xdp_rxq_info_user.c | 1 -
samples/bpf/xdp_sample_pkts_user.c | 1 -
samples/bpf/xdp_sample_user.c | 1 -
samples/bpf/xdp_tx_iptunnel_user.c | 1 -
28 files changed, 28 deletions(-)
diff --git a/samples/bpf/cpustat_user.c b/samples/bpf/cpustat_user.c
index 96675985e9e0..ab90bb08a2b4 100644
--- a/samples/bpf/cpustat_user.c
+++ b/samples/bpf/cpustat_user.c
@@ -13,7 +13,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/resource.h>
#include <sys/wait.h>
#include <bpf/bpf.h>
diff --git a/samples/bpf/ibumad_user.c b/samples/bpf/ibumad_user.c
index 0746ca516097..d074c978aac7 100644
--- a/samples/bpf/ibumad_user.c
+++ b/samples/bpf/ibumad_user.c
@@ -19,7 +19,6 @@
#include <sys/types.h>
#include <limits.h>
-#include <sys/resource.h>
#include <getopt.h>
#include <net/if.h>
diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
index e69651a6902f..b6fc174ab1f2 100644
--- a/samples/bpf/map_perf_test_user.c
+++ b/samples/bpf/map_perf_test_user.c
@@ -13,7 +13,6 @@
#include <signal.h>
#include <string.h>
#include <time.h>
-#include <sys/resource.h>
#include <arpa/inet.h>
#include <errno.h>
diff --git a/samples/bpf/offwaketime_user.c b/samples/bpf/offwaketime_user.c
index 73a986876c1a..b6eedcb98fb9 100644
--- a/samples/bpf/offwaketime_user.c
+++ b/samples/bpf/offwaketime_user.c
@@ -8,7 +8,6 @@
#include <linux/perf_event.h>
#include <errno.h>
#include <stdbool.h>
-#include <sys/resource.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
#include "trace_helpers.h"
diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c
index 6a3fd369d3fc..2c18471336f0 100644
--- a/samples/bpf/sockex2_user.c
+++ b/samples/bpf/sockex2_user.c
@@ -7,7 +7,6 @@
#include "sock_example.h"
#include <unistd.h>
#include <arpa/inet.h>
-#include <sys/resource.h>
struct pair {
__u64 packets;
diff --git a/samples/bpf/sockex3_user.c b/samples/bpf/sockex3_user.c
index 6ae99ecc766c..cd6fa79df900 100644
--- a/samples/bpf/sockex3_user.c
+++ b/samples/bpf/sockex3_user.c
@@ -6,7 +6,6 @@
#include "sock_example.h"
#include <unistd.h>
#include <arpa/inet.h>
-#include <sys/resource.h>
struct flow_key_record {
__be32 src;
diff --git a/samples/bpf/spintest_user.c b/samples/bpf/spintest_user.c
index 0d7e1e5a8658..aadac14f748a 100644
--- a/samples/bpf/spintest_user.c
+++ b/samples/bpf/spintest_user.c
@@ -3,7 +3,6 @@
#include <unistd.h>
#include <string.h>
#include <assert.h>
-#include <sys/resource.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
#include "trace_helpers.h"
diff --git a/samples/bpf/syscall_tp_user.c b/samples/bpf/syscall_tp_user.c
index c55383068384..7a788bb837fc 100644
--- a/samples/bpf/syscall_tp_user.c
+++ b/samples/bpf/syscall_tp_user.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <linux/perf_event.h>
#include <errno.h>
-#include <sys/resource.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
diff --git a/samples/bpf/task_fd_query_user.c b/samples/bpf/task_fd_query_user.c
index c9a0ca8351fd..424718c0872c 100644
--- a/samples/bpf/task_fd_query_user.c
+++ b/samples/bpf/task_fd_query_user.c
@@ -10,7 +10,6 @@
#include <fcntl.h>
#include <linux/bpf.h>
#include <sys/ioctl.h>
-#include <sys/resource.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/perf_event.h>
diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c
index 75e877853596..be98ccb4952f 100644
--- a/samples/bpf/test_lru_dist.c
+++ b/samples/bpf/test_lru_dist.c
@@ -13,7 +13,6 @@
#include <sched.h>
#include <sys/wait.h>
#include <sys/stat.h>
-#include <sys/resource.h>
#include <fcntl.h>
#include <stdlib.h>
#include <time.h>
diff --git a/samples/bpf/test_map_in_map_user.c b/samples/bpf/test_map_in_map_user.c
index 472d65c70354..e8b4cc184ac9 100644
--- a/samples/bpf/test_map_in_map_user.c
+++ b/samples/bpf/test_map_in_map_user.c
@@ -2,7 +2,6 @@
/*
* Copyright (c) 2017 Facebook
*/
-#include <sys/resource.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdint.h>
diff --git a/samples/bpf/test_overhead_user.c b/samples/bpf/test_overhead_user.c
index 4821f9d99c1f..88717f8ec6ac 100644
--- a/samples/bpf/test_overhead_user.c
+++ b/samples/bpf/test_overhead_user.c
@@ -16,7 +16,6 @@
#include <linux/bpf.h>
#include <string.h>
#include <time.h>
-#include <sys/resource.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c
index 1626d51dfffd..dd6205c6b6a7 100644
--- a/samples/bpf/tracex2_user.c
+++ b/samples/bpf/tracex2_user.c
@@ -4,7 +4,6 @@
#include <stdlib.h>
#include <signal.h>
#include <string.h>
-#include <sys/resource.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
diff --git a/samples/bpf/tracex3_user.c b/samples/bpf/tracex3_user.c
index 33e16ba39f25..d5eebace31e6 100644
--- a/samples/bpf/tracex3_user.c
+++ b/samples/bpf/tracex3_user.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <stdbool.h>
#include <string.h>
-#include <sys/resource.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
diff --git a/samples/bpf/tracex4_user.c b/samples/bpf/tracex4_user.c
index 566e6440e8c2..227b05a0bc88 100644
--- a/samples/bpf/tracex4_user.c
+++ b/samples/bpf/tracex4_user.c
@@ -8,7 +8,6 @@
#include <stdbool.h>
#include <string.h>
#include <time.h>
-#include <sys/resource.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
diff --git a/samples/bpf/tracex5_user.c b/samples/bpf/tracex5_user.c
index 08dfdc77ad2a..e910dc265c31 100644
--- a/samples/bpf/tracex5_user.c
+++ b/samples/bpf/tracex5_user.c
@@ -7,7 +7,6 @@
#include <sys/prctl.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
-#include <sys/resource.h>
#include "trace_helpers.h"
#ifdef __mips__
diff --git a/samples/bpf/tracex6_user.c b/samples/bpf/tracex6_user.c
index 28296f40c133..8e83bf2a84a4 100644
--- a/samples/bpf/tracex6_user.c
+++ b/samples/bpf/tracex6_user.c
@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
-#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
index 631f0cabe139..288db3d3ee5f 100644
--- a/samples/bpf/xdp1_user.c
+++ b/samples/bpf/xdp1_user.c
@@ -11,7 +11,6 @@
#include <string.h>
#include <unistd.h>
#include <libgen.h>
-#include <sys/resource.h>
#include <net/if.h>
#include "bpf_util.h"
diff --git a/samples/bpf/xdp_adjust_tail_user.c b/samples/bpf/xdp_adjust_tail_user.c
index b3f6e49676ed..167646077c8f 100644
--- a/samples/bpf/xdp_adjust_tail_user.c
+++ b/samples/bpf/xdp_adjust_tail_user.c
@@ -14,7 +14,6 @@
#include <stdlib.h>
#include <string.h>
#include <net/if.h>
-#include <sys/resource.h>
#include <arpa/inet.h>
#include <netinet/ether.h>
#include <unistd.h>
diff --git a/samples/bpf/xdp_monitor_user.c b/samples/bpf/xdp_monitor_user.c
index fb9391a5ec62..58015eb2ffae 100644
--- a/samples/bpf/xdp_monitor_user.c
+++ b/samples/bpf/xdp_monitor_user.c
@@ -17,7 +17,6 @@ static const char *__doc_err_only__=
#include <ctype.h>
#include <unistd.h>
#include <locale.h>
-#include <sys/resource.h>
#include <getopt.h>
#include <net/if.h>
#include <time.h>
diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c
index 5f74a70a9021..a12381c37d2b 100644
--- a/samples/bpf/xdp_redirect_cpu_user.c
+++ b/samples/bpf/xdp_redirect_cpu_user.c
@@ -21,7 +21,6 @@ static const char *__doc__ =
#include <string.h>
#include <unistd.h>
#include <locale.h>
-#include <sys/resource.h>
#include <sys/sysinfo.h>
#include <getopt.h>
#include <net/if.h>
diff --git a/samples/bpf/xdp_redirect_map_multi_user.c b/samples/bpf/xdp_redirect_map_multi_user.c
index 315314716121..9e24f2705b67 100644
--- a/samples/bpf/xdp_redirect_map_multi_user.c
+++ b/samples/bpf/xdp_redirect_map_multi_user.c
@@ -15,7 +15,6 @@ static const char *__doc__ =
#include <net/if.h>
#include <unistd.h>
#include <libgen.h>
-#include <sys/resource.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/samples/bpf/xdp_redirect_user.c b/samples/bpf/xdp_redirect_user.c
index 7af5b07a7523..8663dd631b6e 100644
--- a/samples/bpf/xdp_redirect_user.c
+++ b/samples/bpf/xdp_redirect_user.c
@@ -18,7 +18,6 @@ static const char *__doc__ =
#include <unistd.h>
#include <libgen.h>
#include <getopt.h>
-#include <sys/resource.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
#include "bpf_util.h"
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 7828784612ec..878efe50d881 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -22,7 +22,6 @@
#include <sys/syscall.h>
#include "bpf_util.h"
#include <bpf/libbpf.h>
-#include <sys/resource.h>
#include <libgen.h>
#include <getopt.h>
#include "xdp_sample_user.h"
diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
index f2d90cba5164..05a24a712d7d 100644
--- a/samples/bpf/xdp_rxq_info_user.c
+++ b/samples/bpf/xdp_rxq_info_user.c
@@ -14,7 +14,6 @@ static const char *__doc__ = " XDP RX-queue info extract example\n\n"
#include <string.h>
#include <unistd.h>
#include <locale.h>
-#include <sys/resource.h>
#include <getopt.h>
#include <net/if.h>
#include <time.h>
diff --git a/samples/bpf/xdp_sample_pkts_user.c b/samples/bpf/xdp_sample_pkts_user.c
index 0a2b3e997aed..7df7163239ac 100644
--- a/samples/bpf/xdp_sample_pkts_user.c
+++ b/samples/bpf/xdp_sample_pkts_user.c
@@ -12,7 +12,6 @@
#include <signal.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
-#include <sys/resource.h>
#include <libgen.h>
#include <linux/if_link.h>
diff --git a/samples/bpf/xdp_sample_user.c b/samples/bpf/xdp_sample_user.c
index c4332d068b91..158682852162 100644
--- a/samples/bpf/xdp_sample_user.c
+++ b/samples/bpf/xdp_sample_user.c
@@ -25,7 +25,6 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <sys/resource.h>
#include <sys/signalfd.h>
#include <sys/sysinfo.h>
#include <sys/timerfd.h>
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c
index 2e811e4331cc..307baef6861a 100644
--- a/samples/bpf/xdp_tx_iptunnel_user.c
+++ b/samples/bpf/xdp_tx_iptunnel_user.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <string.h>
#include <net/if.h>
-#include <sys/resource.h>
#include <arpa/inet.h>
#include <netinet/ether.h>
#include <unistd.h>
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 24/27] bpf: bpftool: Remove useless return value of libbpf_set_strict_mode
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (22 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 23/27] bpf: samples: No need to include sys/resource.h in many files Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 25/27] bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf Yafang Shao
` (3 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
libbpf_set_strict_mode alwasy return 0, so we don't need to check whether
the return value is 0 or not.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/bpf/bpftool/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index e81227761f5d..451cefc2d0da 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -507,9 +507,7 @@ int main(int argc, char **argv)
* It will still be rejected if users use LIBBPF_STRICT_ALL
* mode for loading generated skeleton.
*/
- ret = libbpf_set_strict_mode(LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS);
- if (ret)
- p_err("failed to enable libbpf strict mode: %d", ret);
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS);
}
argc -= optind;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 25/27] bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (23 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 24/27] bpf: bpftool: Remove useless return value of libbpf_set_strict_mode Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 26/27] bpf: bpftool: remove RLIMIT_MEMLOCK Yafang Shao
` (2 subsequent siblings)
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK has already been set for non legacy
libbpf, let's also set it for legacy libbpf then we can avoid using the
deprecatred RLIMIT_MEMLOCK.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/bpf/bpftool/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 451cefc2d0da..9062ef2b8767 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -508,6 +508,8 @@ int main(int argc, char **argv)
* mode for loading generated skeleton.
*/
libbpf_set_strict_mode(LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS);
+ } else {
+ libbpf_set_strict_mode(LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK);
}
argc -= optind;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 26/27] bpf: bpftool: remove RLIMIT_MEMLOCK
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (24 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 25/27] bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 27/27] bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK Yafang Shao
2022-04-05 20:52 ` [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Andrii Nakryiko
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
As we have already set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK, we don't need to
bump RLIMIT_MEMLOCK any more.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/bpf/bpftool/common.c | 8 --------
tools/bpf/bpftool/feature.c | 2 --
tools/bpf/bpftool/main.h | 2 --
tools/bpf/bpftool/map.c | 2 --
tools/bpf/bpftool/pids.c | 1 -
tools/bpf/bpftool/prog.c | 3 ---
tools/bpf/bpftool/struct_ops.c | 2 --
7 files changed, 20 deletions(-)
diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index 0c1e06cf50b9..c740142c24d8 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -17,7 +17,6 @@
#include <linux/magic.h>
#include <net/if.h>
#include <sys/mount.h>
-#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/vfs.h>
@@ -119,13 +118,6 @@ static bool is_bpffs(char *path)
return (unsigned long)st_fs.f_type == BPF_FS_MAGIC;
}
-void set_max_rlimit(void)
-{
- struct rlimit rinf = { RLIM_INFINITY, RLIM_INFINITY };
-
- setrlimit(RLIMIT_MEMLOCK, &rinf);
-}
-
static int
mnt_fs(const char *target, const char *type, char *buff, size_t bufflen)
{
diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
index f041c4a6a1f2..be130e35462f 100644
--- a/tools/bpf/bpftool/feature.c
+++ b/tools/bpf/bpftool/feature.c
@@ -1136,8 +1136,6 @@ static int do_probe(int argc, char **argv)
__u32 ifindex = 0;
char *ifname;
- set_max_rlimit();
-
while (argc) {
if (is_prefix(*argv, "kernel")) {
if (target != COMPONENT_UNSPEC) {
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
index 6e9277ffc68c..aa99ffab451a 100644
--- a/tools/bpf/bpftool/main.h
+++ b/tools/bpf/bpftool/main.h
@@ -102,8 +102,6 @@ int detect_common_prefix(const char *arg, ...);
void fprint_hex(FILE *f, void *arg, unsigned int n, const char *sep);
void usage(void) __noreturn;
-void set_max_rlimit(void);
-
int mount_tracefs(const char *target);
struct obj_ref {
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index c26378f20831..877387ef79c7 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -1342,8 +1342,6 @@ static int do_create(int argc, char **argv)
goto exit;
}
- set_max_rlimit();
-
fd = bpf_map_create(map_type, map_name, key_size, value_size, max_entries, &attr);
if (fd < 0) {
p_err("map create failed: %s", strerror(errno));
diff --git a/tools/bpf/bpftool/pids.c b/tools/bpf/bpftool/pids.c
index bb6c969a114a..e2d00d3cd868 100644
--- a/tools/bpf/bpftool/pids.c
+++ b/tools/bpf/bpftool/pids.c
@@ -108,7 +108,6 @@ int build_obj_refs_table(struct hashmap **map, enum bpf_obj_type type)
p_err("failed to create hashmap for PID references");
return -1;
}
- set_max_rlimit();
skel = pid_iter_bpf__open();
if (!skel) {
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 8643b37d4e43..5c2c63df92e8 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -1604,8 +1604,6 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
}
}
- set_max_rlimit();
-
if (verifier_logs)
/* log_level1 + log_level2 + stats, but not stable UAPI */
open_opts.kernel_log_level = 1 + 2 + 4;
@@ -2303,7 +2301,6 @@ static int do_profile(int argc, char **argv)
}
}
- set_max_rlimit();
err = profiler_bpf__load(profile_obj);
if (err) {
p_err("failed to load profile_obj");
diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c
index e08a6ff2866c..2535f079ed67 100644
--- a/tools/bpf/bpftool/struct_ops.c
+++ b/tools/bpf/bpftool/struct_ops.c
@@ -501,8 +501,6 @@ static int do_register(int argc, char **argv)
if (libbpf_get_error(obj))
return -1;
- set_max_rlimit();
-
if (bpf_object__load(obj)) {
bpf_object__close(obj);
return -1;
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH bpf-next v3 27/27] bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (25 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 26/27] bpf: bpftool: remove RLIMIT_MEMLOCK Yafang Shao
@ 2022-04-05 13:08 ` Yafang Shao
2022-04-05 20:52 ` [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Andrii Nakryiko
27 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-05 13:08 UTC (permalink / raw)
To: andrii, ast, daniel, kafai, songliubraving, yhs, john.fastabend,
kpsingh, shuah
Cc: netdev, bpf, linux-kselftest, Yafang Shao
Explicitly set libbpf 1.0 API mode, then we can avoid using the deprecated
RLIMIT_MEMLOCK.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
tools/bpf/runqslower/runqslower.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/tools/bpf/runqslower/runqslower.c b/tools/bpf/runqslower/runqslower.c
index d78f4148597f..83c5993a139a 100644
--- a/tools/bpf/runqslower/runqslower.c
+++ b/tools/bpf/runqslower/runqslower.c
@@ -4,7 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/resource.h>
#include <time.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
@@ -88,16 +87,6 @@ int libbpf_print_fn(enum libbpf_print_level level,
return vfprintf(stderr, format, args);
}
-static int bump_memlock_rlimit(void)
-{
- struct rlimit rlim_new = {
- .rlim_cur = RLIM_INFINITY,
- .rlim_max = RLIM_INFINITY,
- };
-
- return setrlimit(RLIMIT_MEMLOCK, &rlim_new);
-}
-
void handle_event(void *ctx, int cpu, void *data, __u32 data_sz)
{
const struct runq_event *e = data;
@@ -133,11 +122,8 @@ int main(int argc, char **argv)
libbpf_set_print(libbpf_print_fn);
- err = bump_memlock_rlimit();
- if (err) {
- fprintf(stderr, "failed to increase rlimit: %d", err);
- return 1;
- }
+ /* Use libbpf 1.0 API mode */
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
obj = runqslower_bpf__open();
if (!obj) {
--
2.17.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user
2022-04-05 13:08 ` [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
@ 2022-04-05 20:46 ` Jeff Johnson
2022-04-06 14:33 ` Yafang Shao
0 siblings, 1 reply; 32+ messages in thread
From: Jeff Johnson @ 2022-04-05 20:46 UTC (permalink / raw)
To: Yafang Shao, andrii, ast, daniel, kafai, songliubraving, yhs,
john.fastabend, kpsingh, shuah
Cc: netdev, bpf, linux-kselftest
On 4/5/2022 6:08 AM, Yafang Shao wrote:
> Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
> included bpf_rlimit.h.
>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
> tools/testing/selftests/bpf/test_dev_cgroup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/test_dev_cgroup.c b/tools/testing/selftests/bpf/test_dev_cgroup.c
patch subject should refer to test_dev_cgroup
(currently has same subject as 05/27)
> index c299d3452695..7886265846a0 100644
> --- a/tools/testing/selftests/bpf/test_dev_cgroup.c
> +++ b/tools/testing/selftests/bpf/test_dev_cgroup.c
> @@ -15,7 +15,6 @@
>
> #include "cgroup_helpers.h"
> #include "testing_helpers.h"
> -#include "bpf_rlimit.h"
>
> #define DEV_CGROUP_PROG "./dev_cgroup.o"
>
> @@ -28,6 +27,9 @@ int main(int argc, char **argv)
> int prog_fd, cgroup_fd;
> __u32 prog_cnt;
>
> + /* Use libbpf 1.0 API mode */
> + libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
> +
> if (bpf_prog_test_load(DEV_CGROUP_PROG, BPF_PROG_TYPE_CGROUP_DEVICE,
> &obj, &prog_fd)) {
> printf("Failed to load DEV_CGROUP program\n");
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
` (26 preceding siblings ...)
2022-04-05 13:08 ` [PATCH bpf-next v3 27/27] bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK Yafang Shao
@ 2022-04-05 20:52 ` Andrii Nakryiko
2022-04-06 14:32 ` Yafang Shao
27 siblings, 1 reply; 32+ messages in thread
From: Andrii Nakryiko @ 2022-04-05 20:52 UTC (permalink / raw)
To: Yafang Shao
Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
Song Liu, Yonghong Song, john fastabend, KP Singh, Shuah Khan,
Networking, bpf, open list:KERNEL SELFTEST FRAMEWORK
On Tue, Apr 5, 2022 at 6:09 AM Yafang Shao <laoar.shao@gmail.com> wrote:
>
> We have switched to memcg based memory accouting and thus the rlimit is
> not needed any more. LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK was introduced in
> libbpf for backward compatibility, so we can use it instead now.
>
> This patchset cleanups the usage of RLIMIT_MEMLOCK in tools/bpf/,
> tools/testing/selftests/bpf and samples/bpf. The file
> tools/testing/selftests/bpf/bpf_rlimit.h is removed. The included header
> sys/resource.h is removed from many files as it is useless in these files.
>
> - v3: Get rid of bpf_rlimit.h and fix some typos (Andrii)
> - v2: Use libbpf_set_strict_mode instead. (Andrii)
> - v1: https://lore.kernel.org/bpf/20220320060815.7716-2-laoar.shao@gmail.com/
>
> Yafang Shao (27):
> bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> xdping
> bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> xdpxceiver
> bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user
> bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load
> bpf: selftests: Set libbpf 1.0 API mode explicitly in
> get_cgroup_id_user
> bpf: selftests: Set libbpf 1.0 API mode explicitly in
> test_cgroup_storage
> bpf: selftests: Set libbpf 1.0 API mode explicitly in
> get_cgroup_id_user
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map
> bpf: selftests: Set libbpf 1.0 API mode explicitly in
> test_skb_cgroup_id_user
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl
> bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag
> bpf: selftests: Set libbpf 1.0 API mode explicitly in
> test_tcp_check_syncookie_user
> bpf: selftests: Set libbpf 1.0 API mode explicitly in
> test_verifier_log
> bpf: samples: Set libbpf 1.0 API mode explicitly in hbm
> bpf: selftests: Get rid of bpf_rlimit.h
> bpf: selftests: No need to include sys/resource.h in some files
> bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> xdpsock_user
> bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> xsk_fwd
> bpf: samples: No need to include sys/resource.h in many files
> bpf: bpftool: Remove useless return value of libbpf_set_strict_mode
> bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf
> bpf: bpftool: remove RLIMIT_MEMLOCK
> bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK
>
Hey Yafang, thanks for the clean up! It looks good, but please make it
a bit more manageable in terms of number of patches. There is no need
to have so many tiny patches. Can you squash together all the
samples/bpf changes into one patch, all the selftests/bpf changes into
another, bpftool ones still can be just one patch. runqslower makes
sense to keep separate. Please also use customary subject prefixes for
those: "selftests/bpf: ", "bpftool: ", "samples/bpf: ". For runqslower
probably "tools/runqslower: " would be ok as well.
> samples/bpf/cpustat_user.c | 1 -
> samples/bpf/hbm.c | 5 ++--
> samples/bpf/ibumad_user.c | 1 -
> samples/bpf/map_perf_test_user.c | 1 -
> samples/bpf/offwaketime_user.c | 1 -
> samples/bpf/sockex2_user.c | 1 -
> samples/bpf/sockex3_user.c | 1 -
> samples/bpf/spintest_user.c | 1 -
> samples/bpf/syscall_tp_user.c | 1 -
> samples/bpf/task_fd_query_user.c | 1 -
> samples/bpf/test_lru_dist.c | 1 -
> samples/bpf/test_map_in_map_user.c | 1 -
> samples/bpf/test_overhead_user.c | 1 -
> samples/bpf/tracex2_user.c | 1 -
> samples/bpf/tracex3_user.c | 1 -
> samples/bpf/tracex4_user.c | 1 -
> samples/bpf/tracex5_user.c | 1 -
> samples/bpf/tracex6_user.c | 1 -
> samples/bpf/xdp1_user.c | 1 -
> samples/bpf/xdp_adjust_tail_user.c | 1 -
> samples/bpf/xdp_monitor_user.c | 1 -
> samples/bpf/xdp_redirect_cpu_user.c | 1 -
> samples/bpf/xdp_redirect_map_multi_user.c | 1 -
> samples/bpf/xdp_redirect_user.c | 1 -
> samples/bpf/xdp_router_ipv4_user.c | 1 -
> samples/bpf/xdp_rxq_info_user.c | 1 -
> samples/bpf/xdp_sample_pkts_user.c | 1 -
> samples/bpf/xdp_sample_user.c | 1 -
> samples/bpf/xdp_tx_iptunnel_user.c | 1 -
> samples/bpf/xdpsock_user.c | 9 ++----
> samples/bpf/xsk_fwd.c | 7 ++---
> tools/bpf/bpftool/common.c | 8 ------
> tools/bpf/bpftool/feature.c | 2 --
> tools/bpf/bpftool/main.c | 6 ++--
> tools/bpf/bpftool/main.h | 2 --
> tools/bpf/bpftool/map.c | 2 --
> tools/bpf/bpftool/pids.c | 1 -
> tools/bpf/bpftool/prog.c | 3 --
> tools/bpf/bpftool/struct_ops.c | 2 --
> tools/bpf/runqslower/runqslower.c | 18 ++----------
> tools/testing/selftests/bpf/bench.c | 1 -
> tools/testing/selftests/bpf/bpf_rlimit.h | 28 -------------------
> .../selftests/bpf/flow_dissector_load.c | 6 ++--
> .../selftests/bpf/get_cgroup_id_user.c | 4 ++-
> tools/testing/selftests/bpf/prog_tests/btf.c | 1 -
> .../selftests/bpf/test_cgroup_storage.c | 4 ++-
> tools/testing/selftests/bpf/test_dev_cgroup.c | 4 ++-
> tools/testing/selftests/bpf/test_lpm_map.c | 4 ++-
> tools/testing/selftests/bpf/test_lru_map.c | 4 ++-
> .../selftests/bpf/test_skb_cgroup_id_user.c | 4 ++-
> tools/testing/selftests/bpf/test_sock.c | 4 ++-
> tools/testing/selftests/bpf/test_sock_addr.c | 4 ++-
> tools/testing/selftests/bpf/test_sockmap.c | 5 ++--
> tools/testing/selftests/bpf/test_sysctl.c | 4 ++-
> tools/testing/selftests/bpf/test_tag.c | 4 ++-
> .../bpf/test_tcp_check_syncookie_user.c | 4 ++-
> .../selftests/bpf/test_tcpnotify_user.c | 1 -
> .../testing/selftests/bpf/test_verifier_log.c | 5 ++--
> .../selftests/bpf/xdp_redirect_multi.c | 1 -
> tools/testing/selftests/bpf/xdping.c | 8 ++----
> tools/testing/selftests/bpf/xdpxceiver.c | 6 ++--
> 61 files changed, 57 insertions(+), 142 deletions(-)
> delete mode 100644 tools/testing/selftests/bpf/bpf_rlimit.h
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups
2022-04-05 20:52 ` [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Andrii Nakryiko
@ 2022-04-06 14:32 ` Yafang Shao
0 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-06 14:32 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
Song Liu, Yonghong Song, john fastabend, KP Singh, Shuah Khan,
Networking, bpf, open list:KERNEL SELFTEST FRAMEWORK
On Wed, Apr 6, 2022 at 4:53 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Tue, Apr 5, 2022 at 6:09 AM Yafang Shao <laoar.shao@gmail.com> wrote:
> >
> > We have switched to memcg based memory accouting and thus the rlimit is
> > not needed any more. LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK was introduced in
> > libbpf for backward compatibility, so we can use it instead now.
> >
> > This patchset cleanups the usage of RLIMIT_MEMLOCK in tools/bpf/,
> > tools/testing/selftests/bpf and samples/bpf. The file
> > tools/testing/selftests/bpf/bpf_rlimit.h is removed. The included header
> > sys/resource.h is removed from many files as it is useless in these files.
> >
> > - v3: Get rid of bpf_rlimit.h and fix some typos (Andrii)
> > - v2: Use libbpf_set_strict_mode instead. (Andrii)
> > - v1: https://lore.kernel.org/bpf/20220320060815.7716-2-laoar.shao@gmail.com/
> >
> > Yafang Shao (27):
> > bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> > xdping
> > bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> > xdpxceiver
> > bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user
> > bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in
> > get_cgroup_id_user
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in
> > test_cgroup_storage
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in
> > get_cgroup_id_user
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in
> > test_skb_cgroup_id_user
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in
> > test_tcp_check_syncookie_user
> > bpf: selftests: Set libbpf 1.0 API mode explicitly in
> > test_verifier_log
> > bpf: samples: Set libbpf 1.0 API mode explicitly in hbm
> > bpf: selftests: Get rid of bpf_rlimit.h
> > bpf: selftests: No need to include sys/resource.h in some files
> > bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> > xdpsock_user
> > bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in
> > xsk_fwd
> > bpf: samples: No need to include sys/resource.h in many files
> > bpf: bpftool: Remove useless return value of libbpf_set_strict_mode
> > bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf
> > bpf: bpftool: remove RLIMIT_MEMLOCK
> > bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK
> >
>
> Hey Yafang, thanks for the clean up! It looks good, but please make it
> a bit more manageable in terms of number of patches. There is no need
> to have so many tiny patches. Can you squash together all the
> samples/bpf changes into one patch, all the selftests/bpf changes into
> another, bpftool ones still can be just one patch. runqslower makes
> sense to keep separate. Please also use customary subject prefixes for
> those: "selftests/bpf: ", "bpftool: ", "samples/bpf: ". For runqslower
> probably "tools/runqslower: " would be ok as well.
>
Thanks for your suggestion. I will change it.
--
Thanks
Yafang
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user
2022-04-05 20:46 ` Jeff Johnson
@ 2022-04-06 14:33 ` Yafang Shao
0 siblings, 0 replies; 32+ messages in thread
From: Yafang Shao @ 2022-04-06 14:33 UTC (permalink / raw)
To: Jeff Johnson
Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
Song Liu, Yonghong Song, john fastabend, KP Singh, shuah, netdev,
bpf, linux-kselftest
On Wed, Apr 6, 2022 at 4:47 AM Jeff Johnson <quic_jjohnson@quicinc.com> wrote:
>
> On 4/5/2022 6:08 AM, Yafang Shao wrote:
> > Let's set libbpf 1.0 API mode explicitly, then we can get rid of the
> > included bpf_rlimit.h.
> >
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > ---
> > tools/testing/selftests/bpf/test_dev_cgroup.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/test_dev_cgroup.c b/tools/testing/selftests/bpf/test_dev_cgroup.c
>
> patch subject should refer to test_dev_cgroup
> (currently has same subject as 05/27)
>
Thanks for pointing this out. It was caused by the copy-and-paste :(
--
Thanks
Yafang
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2022-04-06 17:12 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 13:08 [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 01/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdping Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 02/27] bpf: selftests: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpxceiver Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 03/27] bpf: selftests: No need to include bpf_rlimit.h in test_tcpnotify_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 04/27] bpf: selftests: No need to include bpf_rlimit.h in flow_dissector_load Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 05/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 06/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_cgroup_storage Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 07/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in get_cgroup_id_user Yafang Shao
2022-04-05 20:46 ` Jeff Johnson
2022-04-06 14:33 ` Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 08/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lpm_map Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 09/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_lru_map Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 10/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_skb_cgroup_id_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 11/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock_addr Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 12/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sock Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 13/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sockmap Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 14/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_sysctl Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 15/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tag Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 16/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_tcp_check_syncookie_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 17/27] bpf: selftests: Set libbpf 1.0 API mode explicitly in test_verifier_log Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 18/27] bpf: samples: Set libbpf 1.0 API mode explicitly in hbm Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 19/27] bpf: selftests: Get rid of bpf_rlimit.h Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 20/27] bpf: selftests: No need to include sys/resource.h in some files Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 21/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xdpsock_user Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 22/27] bpf: samples: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK in xsk_fwd Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 23/27] bpf: samples: No need to include sys/resource.h in many files Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 24/27] bpf: bpftool: Remove useless return value of libbpf_set_strict_mode Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 25/27] bpf: bpftool: Set LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK for legacy libbpf Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 26/27] bpf: bpftool: remove RLIMIT_MEMLOCK Yafang Shao
2022-04-05 13:08 ` [PATCH bpf-next v3 27/27] bpf: runqslower: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK Yafang Shao
2022-04-05 20:52 ` [PATCH bpf-next v3 00/27] bpf: RLIMIT_MEMLOCK cleanups Andrii Nakryiko
2022-04-06 14:32 ` Yafang Shao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).