All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bpf: bpftool: fix print error when show bpf map
@ 2022-03-20  6:08 Yafang Shao
  2022-03-20  6:08 ` [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK Yafang Shao
  2022-03-21 15:20 ` [PATCH] bpf: bpftool: fix print error when show bpf map patchwork-bot+netdevbpf
  0 siblings, 2 replies; 8+ messages in thread
From: Yafang Shao @ 2022-03-20  6:08 UTC (permalink / raw)
  To: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh
  Cc: netdev, bpf, Yafang Shao, Joanne Koong

If there is no btf_id or frozen, it will not show the pids,
but the pids doesn't depends on any one of them.

Below is the result after this change,
$ ./bpftool map show
2: lpm_trie  flags 0x1
	key 8B  value 8B  max_entries 1  memlock 4096B
	pids systemd(1)
3: lpm_trie  flags 0x1
	key 20B  value 8B  max_entries 1  memlock 4096B
	pids systemd(1)

While before this change, the 'pids systemd(1)' can't be displayed.

Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Joanne Koong <joannekoong@fb.com>
---
 tools/bpf/bpftool/map.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index f91d9bf9054e..c26378f20831 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -620,17 +620,14 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
 					    u32_as_hash_field(info->id))
 			printf("\n\tpinned %s", (char *)entry->value);
 	}
-	printf("\n");
 
 	if (frozen_str) {
 		frozen = atoi(frozen_str);
 		free(frozen_str);
 	}
 
-	if (!info->btf_id && !frozen)
-		return 0;
-
-	printf("\t");
+	if (info->btf_id || frozen)
+		printf("\n\t");
 
 	if (info->btf_id)
 		printf("btf_id %d", info->btf_id);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK
  2022-03-20  6:08 [PATCH] bpf: bpftool: fix print error when show bpf map Yafang Shao
@ 2022-03-20  6:08 ` Yafang Shao
  2022-03-20 16:58   ` Roman Gushchin
  2022-03-21 15:20 ` [PATCH] bpf: bpftool: fix print error when show bpf map patchwork-bot+netdevbpf
  1 sibling, 1 reply; 8+ messages in thread
From: Yafang Shao @ 2022-03-20  6:08 UTC (permalink / raw)
  To: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend, kpsingh
  Cc: netdev, bpf, Yafang Shao, Roman Gushchin

Since we have alread switched to memcg-based memory accouting and control,
we don't need RLIMIT_MEMLOCK any more.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>

---
RLIMIT_MEMLOCK is still used in bpftool and libbpf, but it may be useful
for backward compatibility, so I don't cleanup them.

---
 tools/testing/selftests/bpf/bpf_rlimit.h      | 28 -------------------
 .../selftests/bpf/flow_dissector_load.c       |  1 -
 .../selftests/bpf/get_cgroup_id_user.c        |  1 -
 .../selftests/bpf/map_tests/sk_storage_map.c  | 15 ----------
 .../selftests/bpf/test_cgroup_storage.c       |  1 -
 tools/testing/selftests/bpf/test_dev_cgroup.c |  1 -
 tools/testing/selftests/bpf/test_lpm_map.c    |  1 -
 tools/testing/selftests/bpf/test_lru_map.c    |  1 -
 .../selftests/bpf/test_skb_cgroup_id_user.c   |  1 -
 tools/testing/selftests/bpf/test_sock.c       |  1 -
 tools/testing/selftests/bpf/test_sock_addr.c  |  1 -
 tools/testing/selftests/bpf/test_sockmap.c    |  1 -
 tools/testing/selftests/bpf/test_sysctl.c     |  1 -
 tools/testing/selftests/bpf/test_tag.c        |  1 -
 .../bpf/test_tcp_check_syncookie_user.c       |  1 -
 .../selftests/bpf/test_tcpnotify_user.c       |  1 -
 .../testing/selftests/bpf/test_verifier_log.c |  2 --
 tools/testing/selftests/bpf/xdping.c          |  7 -----
 tools/testing/selftests/bpf/xdpxceiver.c      |  5 ----
 19 files changed, 71 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);
-	}
-}
diff --git a/tools/testing/selftests/bpf/flow_dissector_load.c b/tools/testing/selftests/bpf/flow_dissector_load.c
index 87fd1aa323a9..e9df470e3253 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";
diff --git a/tools/testing/selftests/bpf/get_cgroup_id_user.c b/tools/testing/selftests/bpf/get_cgroup_id_user.c
index 3a7b82bd9e94..2c027c7ef49d 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);			\
diff --git a/tools/testing/selftests/bpf/map_tests/sk_storage_map.c b/tools/testing/selftests/bpf/map_tests/sk_storage_map.c
index 099eb4dfd4f7..864422241960 100644
--- a/tools/testing/selftests/bpf/map_tests/sk_storage_map.c
+++ b/tools/testing/selftests/bpf/map_tests/sk_storage_map.c
@@ -3,7 +3,6 @@
 #include <linux/compiler.h>
 #include <linux/err.h>
 
-#include <sys/resource.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <linux/btf.h>
@@ -395,11 +394,8 @@ static void stop_handler(int signum)
 
 static void test_sk_storage_map_stress_free(void)
 {
-	struct rlimit rlim_old, rlim_new = {};
 	int err;
 
-	getrlimit(RLIMIT_NOFILE, &rlim_old);
-
 	signal(SIGTERM, stop_handler);
 	signal(SIGINT, stop_handler);
 	if (runtime_s > 0) {
@@ -407,14 +403,6 @@ static void test_sk_storage_map_stress_free(void)
 		alarm(runtime_s);
 	}
 
-	if (rlim_old.rlim_cur < nr_sk_threads * nr_sk_per_thread) {
-		rlim_new.rlim_cur = nr_sk_threads * nr_sk_per_thread + 128;
-		rlim_new.rlim_max = rlim_new.rlim_cur + 128;
-		err = setrlimit(RLIMIT_NOFILE, &rlim_new);
-		CHECK(err, "setrlimit(RLIMIT_NOFILE)", "rlim_new:%lu errno:%d",
-		      rlim_new.rlim_cur, errno);
-	}
-
 	err = do_sk_storage_map_stress_free();
 
 	signal(SIGTERM, SIG_DFL);
@@ -424,9 +412,6 @@ static void test_sk_storage_map_stress_free(void)
 		alarm(0);
 	}
 
-	if (rlim_new.rlim_cur)
-		setrlimit(RLIMIT_NOFILE, &rlim_old);
-
 	CHECK(err, "test_sk_storage_map_stress_free", "err:%d\n", err);
 }
 
diff --git a/tools/testing/selftests/bpf/test_cgroup_storage.c b/tools/testing/selftests/bpf/test_cgroup_storage.c
index d6a1be4d8020..d8bea0439ec9 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"
 
diff --git a/tools/testing/selftests/bpf/test_dev_cgroup.c b/tools/testing/selftests/bpf/test_dev_cgroup.c
index c299d3452695..5ac8279f3f93 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"
 
diff --git a/tools/testing/selftests/bpf/test_lpm_map.c b/tools/testing/selftests/bpf/test_lpm_map.c
index baa3e3ecae82..790ff32c735a 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;
diff --git a/tools/testing/selftests/bpf/test_lru_map.c b/tools/testing/selftests/bpf/test_lru_map.c
index 563bbe18c172..41cea43cd6d5 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)
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..de7b230023a2 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"
diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
index fe10f8134278..c83e1872d2a6 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"
diff --git a/tools/testing/selftests/bpf/test_sock_addr.c b/tools/testing/selftests/bpf/test_sock_addr.c
index f3d5d7ac6505..fd047567ee63 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
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index dfb4f5c0fcb9..3eeebe915903 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -37,7 +37,6 @@
 #include <bpf/libbpf.h>
 
 #include "bpf_util.h"
-#include "bpf_rlimit.h"
 #include "cgroup_helpers.h"
 
 int running;
diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c
index 4f6cf833b522..dd6fd170b11a 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"
diff --git a/tools/testing/selftests/bpf/test_tag.c b/tools/testing/selftests/bpf/test_tag.c
index 0851c42ee31c..4f745de802cf 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];
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..894eb0710d6f 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)
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"
 
diff --git a/tools/testing/selftests/bpf/test_verifier_log.c b/tools/testing/selftests/bpf/test_verifier_log.c
index 8d6918c3b4a2..4bca0a7344cc 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)
diff --git a/tools/testing/selftests/bpf/xdping.c b/tools/testing/selftests/bpf/xdping.c
index c567856fd1bc..bc5eadf2d0f8 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,11 +165,6 @@ int main(int argc, char **argv)
 		freeaddrinfo(a);
 	}
 
-	if (setrlimit(RLIMIT_MEMLOCK, &r)) {
-		perror("setrlimit(RLIMIT_MEMLOCK)");
-		return 1;
-	}
-
 	snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
 
 	if (bpf_prog_test_load(filename, BPF_PROG_TYPE_XDP, &obj, &prog_fd)) {
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 5f8296d29e77..5fbaebe89e14 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,15 +1447,11 @@ 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);
-
 	ifobj_tx = ifobject_create();
 	if (!ifobj_tx)
 		exit_with_error(ENOMEM);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK
  2022-03-20  6:08 ` [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK Yafang Shao
@ 2022-03-20 16:58   ` Roman Gushchin
  2022-03-22  0:13     ` Andrii Nakryiko
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Gushchin @ 2022-03-20 16:58 UTC (permalink / raw)
  To: Yafang Shao
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, netdev, bpf


> On Mar 19, 2022, at 11:08 PM, Yafang Shao <laoar.shao@gmail.com> wrote:
> 
> Since we have alread switched to memcg-based memory accouting and control,
> we don't need RLIMIT_MEMLOCK any more.
> 
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> 
> ---
> RLIMIT_MEMLOCK is still used in bpftool and libbpf, but it may be useful
> for backward compatibility, so I don't cleanup them.

Hi Yafang!

As I remember, we haven’t cleaned selftests up with the same logic: it’s nice to be able to run the same version of tests on older kernels.

Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] bpf: bpftool: fix print error when show bpf map
  2022-03-20  6:08 [PATCH] bpf: bpftool: fix print error when show bpf map Yafang Shao
  2022-03-20  6:08 ` [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK Yafang Shao
@ 2022-03-21 15:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-21 15:20 UTC (permalink / raw)
  To: Yafang Shao
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, netdev, bpf, joannekoong

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Sun, 20 Mar 2022 06:08:14 +0000 you wrote:
> If there is no btf_id or frozen, it will not show the pids,
> but the pids doesn't depends on any one of them.
> 
> Below is the result after this change,
> $ ./bpftool map show
> 2: lpm_trie  flags 0x1
> 	key 8B  value 8B  max_entries 1  memlock 4096B
> 	pids systemd(1)
> 3: lpm_trie  flags 0x1
> 	key 20B  value 8B  max_entries 1  memlock 4096B
> 	pids systemd(1)
> 
> [...]

Here is the summary with links:
  - bpf: bpftool: fix print error when show bpf map
    https://git.kernel.org/bpf/bpf-next/c/1824d8ea75f2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK
  2022-03-20 16:58   ` Roman Gushchin
@ 2022-03-22  0:13     ` Andrii Nakryiko
  2022-03-22  2:15       ` Roman Gushchin
  2022-03-22 16:13       ` Yafang Shao
  0 siblings, 2 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-03-22  0:13 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: Yafang Shao, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
	john fastabend, KP Singh, Networking, bpf

On Sun, Mar 20, 2022 at 9:58 AM Roman Gushchin <roman.gushchin@linux.dev> wrote:
>
>
> > On Mar 19, 2022, at 11:08 PM, Yafang Shao <laoar.shao@gmail.com> wrote:
> >
> > Since we have alread switched to memcg-based memory accouting and control,
> > we don't need RLIMIT_MEMLOCK any more.
> >
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > Cc: Roman Gushchin <roman.gushchin@linux.dev>
> >
> > ---
> > RLIMIT_MEMLOCK is still used in bpftool and libbpf, but it may be useful
> > for backward compatibility, so I don't cleanup them.
>
> Hi Yafang!
>
> As I remember, we haven’t cleaned selftests up with the same logic: it’s nice to be able to run the same version of tests on older kernels.
>

It should be fine, at least for test_progs and test_progs-no_alu32.
Libbpf now does this automatically if running in "libbpf 1.0" mode.

Yafang, please make sure that all the test binaries you are cleaning
up have libbpf_set_strict_mode(LIBBPF_STRICT_ALL) (test_progs does
already). You might need to clean up some SEC() definitions, in case
we still missed some non-conforming ones, though.

> Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK
  2022-03-22  0:13     ` Andrii Nakryiko
@ 2022-03-22  2:15       ` Roman Gushchin
  2022-03-22 17:24         ` Andrii Nakryiko
  2022-03-22 16:13       ` Yafang Shao
  1 sibling, 1 reply; 8+ messages in thread
From: Roman Gushchin @ 2022-03-22  2:15 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Yafang Shao, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
	john fastabend, KP Singh, Networking, bpf


> On Mar 21, 2022, at 5:13 PM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> 
> On Sun, Mar 20, 2022 at 9:58 AM Roman Gushchin <roman.gushchin@linux.dev> wrote:
>> 
>> 
>>>> On Mar 19, 2022, at 11:08 PM, Yafang Shao <laoar.shao@gmail.com> wrote:
>>> 
>>> Since we have alread switched to memcg-based memory accouting and control,
>>> we don't need RLIMIT_MEMLOCK any more.
>>> 
>>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>>> Cc: Roman Gushchin <roman.gushchin@linux.dev>
>>> 
>>> ---
>>> RLIMIT_MEMLOCK is still used in bpftool and libbpf, but it may be useful
>>> for backward compatibility, so I don't cleanup them.
>> 
>> Hi Yafang!
>> 
>> As I remember, we haven’t cleaned selftests up with the same logic: it’s nice to be able to run the same version of tests on older kernels.
>> 
> 
> It should be fine, at least for test_progs and test_progs-no_alu32.
> Libbpf now does this automatically if running in "libbpf 1.0" mode.

Didn’t know this, thanks! Do we link all tests with it?

> 
> Yafang, please make sure that all the test binaries you are cleaning
> up have libbpf_set_strict_mode(LIBBPF_STRICT_ALL) (test_progs does
> already). You might need to clean up some SEC() definitions, in case
> we still missed some non-conforming ones, though.

If so, no objections to the patch from my side.

Thank you!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK
  2022-03-22  0:13     ` Andrii Nakryiko
  2022-03-22  2:15       ` Roman Gushchin
@ 2022-03-22 16:13       ` Yafang Shao
  1 sibling, 0 replies; 8+ messages in thread
From: Yafang Shao @ 2022-03-22 16:13 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Roman Gushchin, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
	john fastabend, KP Singh, Networking, bpf

On Tue, Mar 22, 2022 at 8:13 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sun, Mar 20, 2022 at 9:58 AM Roman Gushchin <roman.gushchin@linux.dev> wrote:
> >
> >
> > > On Mar 19, 2022, at 11:08 PM, Yafang Shao <laoar.shao@gmail.com> wrote:
> > >
> > > Since we have alread switched to memcg-based memory accouting and control,
> > > we don't need RLIMIT_MEMLOCK any more.
> > >
> > > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > > Cc: Roman Gushchin <roman.gushchin@linux.dev>
> > >
> > > ---
> > > RLIMIT_MEMLOCK is still used in bpftool and libbpf, but it may be useful
> > > for backward compatibility, so I don't cleanup them.
> >
> > Hi Yafang!
> >
> > As I remember, we haven’t cleaned selftests up with the same logic: it’s nice to be able to run the same version of tests on older kernels.
> >
>
> It should be fine, at least for test_progs and test_progs-no_alu32.
> Libbpf now does this automatically if running in "libbpf 1.0" mode.
>
> Yafang, please make sure that all the test binaries you are cleaning
> up have libbpf_set_strict_mode(LIBBPF_STRICT_ALL) (test_progs does
> already). You might need to clean up some SEC() definitions, in case
> we still missed some non-conforming ones, though.
>

Thanks for the suggestion. I will do it.

-- 
Thanks
Yafang

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK
  2022-03-22  2:15       ` Roman Gushchin
@ 2022-03-22 17:24         ` Andrii Nakryiko
  0 siblings, 0 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-03-22 17:24 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: Yafang Shao, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song,
	john fastabend, KP Singh, Networking, bpf

On Mon, Mar 21, 2022 at 7:15 PM Roman Gushchin <roman.gushchin@linux.dev> wrote:
>
>
> > On Mar 21, 2022, at 5:13 PM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> >
> > On Sun, Mar 20, 2022 at 9:58 AM Roman Gushchin <roman.gushchin@linux.dev> wrote:
> >>
> >>
> >>>> On Mar 19, 2022, at 11:08 PM, Yafang Shao <laoar.shao@gmail.com> wrote:
> >>>
> >>> Since we have alread switched to memcg-based memory accouting and control,
> >>> we don't need RLIMIT_MEMLOCK any more.
> >>>
> >>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> >>> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> >>>
> >>> ---
> >>> RLIMIT_MEMLOCK is still used in bpftool and libbpf, but it may be useful
> >>> for backward compatibility, so I don't cleanup them.
> >>
> >> Hi Yafang!
> >>
> >> As I remember, we haven’t cleaned selftests up with the same logic: it’s nice to be able to run the same version of tests on older kernels.
> >>
> >
> > It should be fine, at least for test_progs and test_progs-no_alu32.
> > Libbpf now does this automatically if running in "libbpf 1.0" mode.
>
> Didn’t know this, thanks! Do we link all tests with it?

Yep, every selftest inevitably relies on libbpf. We just need to make
sure to enable that 1.0 mode with libbpf_set_strict_mode() call.

>
> >
> > Yafang, please make sure that all the test binaries you are cleaning
> > up have libbpf_set_strict_mode(LIBBPF_STRICT_ALL) (test_progs does
> > already). You might need to clean up some SEC() definitions, in case
> > we still missed some non-conforming ones, though.
>
> If so, no objections to the patch from my side.
>
> Thank you!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-22 17:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-20  6:08 [PATCH] bpf: bpftool: fix print error when show bpf map Yafang Shao
2022-03-20  6:08 ` [PATCH] bpf: selftests: cleanup RLIMIT_MEMLOCK Yafang Shao
2022-03-20 16:58   ` Roman Gushchin
2022-03-22  0:13     ` Andrii Nakryiko
2022-03-22  2:15       ` Roman Gushchin
2022-03-22 17:24         ` Andrii Nakryiko
2022-03-22 16:13       ` Yafang Shao
2022-03-21 15:20 ` [PATCH] bpf: bpftool: fix print error when show bpf map patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.