BPF List
 help / color / mirror / Atom feed
* [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench
@ 2022-11-16 10:02 Jiri Olsa
  2022-11-16 10:02 ` [PATCH bpf 2/2] selftests/bpf: Make test_bench_attach serial Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Olsa @ 2022-11-16 10:02 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo

Alexei hit following rcu warning when running prog_test -j.

  [  128.049567] WARNING: suspicious RCU usage
  [  128.049569] 6.1.0-rc2 #912 Tainted: G           O
  ...
  [  128.050944]  kprobe_multi_link_handler+0x6c/0x1d0
  [  128.050947]  ? kprobe_multi_link_handler+0x42/0x1d0
  [  128.050950]  ? __cpuidle_text_start+0x8/0x8
  [  128.050952]  ? __cpuidle_text_start+0x8/0x8
  [  128.050958]  fprobe_handler.part.1+0xac/0x150
  [  128.050964]  0xffffffffa02130c8
  [  128.050991]  ? default_idle+0x5/0x20
  [  128.050998]  default_idle+0x5/0x20

It's caused by bench test attaching kprobe_multi link to default_idle
function, which is not executed in rcu safe context so the kprobe
handler on top of it will trigger the rcu warning.

Filtering out default_idle function from the bench test.

Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
index d457a55ff408..b43928967515 100644
--- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
@@ -358,10 +358,12 @@ static int get_syms(char ***symsp, size_t *cntp)
 		 * We attach to almost all kernel functions and some of them
 		 * will cause 'suspicious RCU usage' when fprobe is attached
 		 * to them. Filter out the current culprits - arch_cpu_idle
-		 * and rcu_* functions.
+		 * default_idle and rcu_* functions.
 		 */
 		if (!strcmp(name, "arch_cpu_idle"))
 			continue;
+		if (!strcmp(name, "default_idle"))
+			continue;
 		if (!strncmp(name, "rcu_", 4))
 			continue;
 		if (!strcmp(name, "bpf_dispatcher_xdp_func"))
-- 
2.38.1


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

* [PATCH bpf 2/2] selftests/bpf: Make test_bench_attach serial
  2022-11-16 10:02 [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Jiri Olsa
@ 2022-11-16 10:02 ` Jiri Olsa
  2022-11-21 19:57 ` [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Alexei Starovoitov
  2022-11-21 20:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2022-11-16 10:02 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo

Alexei hit another rcu warnings because of this test.

Making test_bench_attach serial so it does not disrupts
other tests during parallel tests run.

While this change is not the fix, it should be less likely
to hit it with this test being executed serially.

Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
index b43928967515..a4b4133d39e9 100644
--- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
+++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
@@ -402,7 +402,7 @@ static int get_syms(char ***symsp, size_t *cntp)
 	return err;
 }
 
-static void test_bench_attach(void)
+void serial_test_kprobe_multi_bench_attach(void)
 {
 	LIBBPF_OPTS(bpf_kprobe_multi_opts, opts);
 	struct kprobe_multi_empty *skel = NULL;
@@ -470,6 +470,4 @@ void test_kprobe_multi_test(void)
 		test_attach_api_syms();
 	if (test__start_subtest("attach_api_fails"))
 		test_attach_api_fails();
-	if (test__start_subtest("bench_attach"))
-		test_bench_attach();
 }
-- 
2.38.1


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

* Re: [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench
  2022-11-16 10:02 [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Jiri Olsa
  2022-11-16 10:02 ` [PATCH bpf 2/2] selftests/bpf: Make test_bench_attach serial Jiri Olsa
@ 2022-11-21 19:57 ` Alexei Starovoitov
  2022-11-21 20:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2022-11-21 19:57 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, bpf,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo

On Wed, Nov 16, 2022 at 2:02 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> Alexei hit following rcu warning when running prog_test -j.
>
>   [  128.049567] WARNING: suspicious RCU usage
>   [  128.049569] 6.1.0-rc2 #912 Tainted: G           O
>   ...
>   [  128.050944]  kprobe_multi_link_handler+0x6c/0x1d0
>   [  128.050947]  ? kprobe_multi_link_handler+0x42/0x1d0
>   [  128.050950]  ? __cpuidle_text_start+0x8/0x8
>   [  128.050952]  ? __cpuidle_text_start+0x8/0x8
>   [  128.050958]  fprobe_handler.part.1+0xac/0x150
>   [  128.050964]  0xffffffffa02130c8
>   [  128.050991]  ? default_idle+0x5/0x20
>   [  128.050998]  default_idle+0x5/0x20
>
> It's caused by bench test attaching kprobe_multi link to default_idle
> function, which is not executed in rcu safe context so the kprobe
> handler on top of it will trigger the rcu warning.
>
> Filtering out default_idle function from the bench test.
>
> Reported-by: Alexei Starovoitov <ast@kernel.org>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

That fixed it for me. Thank you. Applied.

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

* Re: [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench
  2022-11-16 10:02 [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Jiri Olsa
  2022-11-16 10:02 ` [PATCH bpf 2/2] selftests/bpf: Make test_bench_attach serial Jiri Olsa
  2022-11-21 19:57 ` [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Alexei Starovoitov
@ 2022-11-21 20:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-21 20:00 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: ast, daniel, andrii, bpf, kafai, songliubraving, yhs,
	john.fastabend, kpsingh, sdf, haoluo

Hello:

This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 16 Nov 2022 11:02:27 +0100 you wrote:
> Alexei hit following rcu warning when running prog_test -j.
> 
>   [  128.049567] WARNING: suspicious RCU usage
>   [  128.049569] 6.1.0-rc2 #912 Tainted: G           O
>   ...
>   [  128.050944]  kprobe_multi_link_handler+0x6c/0x1d0
>   [  128.050947]  ? kprobe_multi_link_handler+0x42/0x1d0
>   [  128.050950]  ? __cpuidle_text_start+0x8/0x8
>   [  128.050952]  ? __cpuidle_text_start+0x8/0x8
>   [  128.050958]  fprobe_handler.part.1+0xac/0x150
>   [  128.050964]  0xffffffffa02130c8
>   [  128.050991]  ? default_idle+0x5/0x20
>   [  128.050998]  default_idle+0x5/0x20
> 
> [...]

Here is the summary with links:
  - [bpf,1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench
    https://git.kernel.org/bpf/bpf/c/2b506f20af2b
  - [bpf,2/2] selftests/bpf: Make test_bench_attach serial
    https://git.kernel.org/bpf/bpf/c/8be602dadb2f

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] 4+ messages in thread

end of thread, other threads:[~2022-11-21 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-16 10:02 [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Jiri Olsa
2022-11-16 10:02 ` [PATCH bpf 2/2] selftests/bpf: Make test_bench_attach serial Jiri Olsa
2022-11-21 19:57 ` [PATCH bpf 1/2] selftests/bpf: Filter out default_idle from kprobe_multi bench Alexei Starovoitov
2022-11-21 20:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox