Skip to contentSkip to conversation

selftests/ftrace: remove _do_fork() leftovers

PATCH In review Alexander Gordeev 4 participants 11 messages Oct 23, 2020 – Oct 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/ftrace: remove _do_fork() leftovers

The _do_fork() is not completely removed from selftests in favor of the kernel_clone().

Fixes eea11285dab3 ("tracing: switch to kernel_clone()")
Cc Steven Rostedt <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Masami Hiramatsu <[email protected]>
---
 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc | 2 +-
 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 -1
index acb17ce..0ddb948 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_notrace_pid
     echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 -1
index 9f0a968..71319b3 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_pid
     echo function > current_tracer
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · On Fri, 23 Oct 2020 10:52:03 +0200 Alexander Gordeev <[email protected]>…

The _do_fork() is not completely removed from selftests in favor of the kernel_clone().

Looks good to me.

Thank you!

Quoted 39 lines
Fixes eea11285dab3 ("tracing: switch to kernel_clone()")
Cc Steven Rostedt <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Masami Hiramatsu <[email protected]>
---
 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc | 2 +-
 tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 -1
index acb17ce..0ddb948 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_notrace_pid
     echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 -1
index 9f0a968..71319b3 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_pid
     echo function > current_tracer
Signature · 1 line
1.8.3.1
Signature · 1 line
Masami Hiramatsu <[email protected]>
maintainer
#2 lore raw
In reply to Alexander Gordeev
Quoted 18 lines · On Fri, 23 Oct 2020 10:52:03 +0200 Alexander Gordeev <[email protected]>…
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 -1
index acb17ce..0ddb948 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_notrace_pid
     echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +0 -0
index 9f0a968..71319b3 100644

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc do_test() { · line 45

Quoted 8 lines
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 -1
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_pid
     echo function > current_tracer

The issue I have with this, is that I run these tests on older kernels too, and tests that use to work on older kernels should still work. In fact, this fails on the kernel I'm currently adding new changes to!

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter

The above still seems to work for me.

-- Steve

#3 lore raw
Quoted 34 lines · Steven Rostedt
Quoted 18 lines · On Fri, 23 Oct 2020 10:52:03 +0200 Alexander Gordeev <[email protected]>…
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 -1
index acb17ce..0ddb948 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_notrace_pid
     echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +0 -0
index 9f0a968..71319b3 100644

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc do_test() { · line 45

Quoted 8 lines
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 -1
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_pid
     echo function > current_tracer

The issue I have with this, is that I run these tests on older kernels too, and tests that use to work on older kernels should still work. In fact, this fails on the kernel I'm currently adding new changes to!

Quoted 4 lines

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter

Would you suggest to do the same with all occurences in eea11285dab3 ("tracing: switch to kernel_clone()")? Otherwise it does not really make sense to just fix couple of tests out of dozens.

Quoted 3 lines

The above still seems to work for me.

-- Steve

maintainer
#4 lore raw
Quoted 9 lines · On Fri, 23 Oct 2020 17:12:44 +0200 Alexander Gordeev <[email protected]>…
Quoted 4 lines

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter  

Would you suggest to do the same with all occurences in eea11285dab3 ("tracing: switch to kernel_clone()")? Otherwise it does not really make sense to just fix couple of tests out of dozens.

Yes. I haven't pulled in the updated tests, so I haven't hit the errors yet (nor have I merged my work with the switch to the new name yet). So those will most definitely break my tests.

But because it's a more generic issue, we should have a way to find what to use. Perhaps add to the test.d/functions, something like:

FUNCTION_FORK=`(if grep '\bkernel_clone\b' /proc/kallsyms > /dev/null; then
echo kernel_clone; else echo '_do_fork'; fi)`

and use $FUNCTION_FORK everywhere that references it.

-- Steve

maintainer
#5 lore raw
Quoted 17 lines · On Fri, 23 Oct 2020 11:49:48 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 9 lines · On Fri, 23 Oct 2020 17:12:44 +0200 Alexander Gordeev <[email protected]>…
Quoted 4 lines

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter    

Would you suggest to do the same with all occurences in eea11285dab3 ("tracing: switch to kernel_clone()")? Otherwise it does not really make sense to just fix couple of tests out of dozens.

Yes. I haven't pulled in the updated tests, so I haven't hit the errors yet (nor have I merged my work with the switch to the new name yet). So those will most definitely break my tests.

Quoted 9 lines

But because it's a more generic issue, we should have a way to find what to use. Perhaps add to the test.d/functions, something like:

FUNCTION_FORK=`(if grep '\bkernel_clone\b' /proc/kallsyms > /dev/null; then
echo kernel_clone; else echo '_do_fork'; fi)`

and use $FUNCTION_FORK everywhere that references it.

Let me pull in the latest changes, and whip up a patch that works on both the older kernels as well as the newer ones.

-- Steve

maintainer
#6 lore raw
Quoted 26 lines · Steven Rostedt
Quoted 23 lines · On Fri, 23 Oct 2020 11:49:48 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 9 lines · On Fri, 23 Oct 2020 17:12:44 +0200 Alexander Gordeev <[email protected]>…
Quoted 4 lines

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter

Would you suggest to do the same with all occurences in eea11285dab3 ("tracing: switch to kernel_clone()")? Otherwise it does not really make sense to just fix couple of tests out of dozens.

Yes. I haven't pulled in the updated tests, so I haven't hit the errors yet (nor have I merged my work with the switch to the new name yet). So those will most definitely break my tests.

But because it's a more generic issue, we should have a way to find what to use. Perhaps add to the test.d/functions, something like:

FUNCTION_FORK=`(if grep '\bkernel_clone\b' /proc/kallsyms > /dev/null; then
echo kernel_clone; else echo '_do_fork'; fi)`

Quoted 9 lines
Quoted 3 lines

and use $FUNCTION_FORK everywhere that references it.

Let me pull in the latest changes, and whip up a patch that works on both the older kernels as well as the newer ones.

-- Steve

Assume this is handled by

selftests/ftrace: Use $FUNCTION_FORK to reference kernel fork function
https://patchwork.kernel.org/project/linux-kselftest/patch/[email protected]/

Just making sure.

thanks,
-- Shuah

maintainer
#7 lore raw
Quoted 6 lines · On Tue, 27 Oct 2020 15:55:32 -0600 Shuah Khan <[email protected]> wrote:
Quoted 5 lines

Let me pull in the latest changes, and whip up a patch that works on both the older kernels as well as the newer ones.

-- Steve

Quoted 6 lines

Assume this is handled by

selftests/ftrace: Use $FUNCTION_FORK to reference kernel fork function
https://patchwork.kernel.org/project/linux-kselftest/patch/[email protected]/

Just making sure.

Yep, that was the result of this thread.

Thanks Shuah,

-- Steve

maintainer
#8 lore raw
Quoted 1 line · On Tue, 27 Oct 2020 22:46:57 -0400 Steven Rostedt <[email protected]> wrote:

Yep, that was the result of this thread.

And if it's not clear. That thread supersedes this one.

-- Steve

maintainer
#9 lore raw
In reply to Steven Rostedt
Quoted 34 lines · On Fri, 23 Oct 2020 09:35:23 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 18 lines · On Fri, 23 Oct 2020 10:52:03 +0200 Alexander Gordeev <[email protected]>…
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 -1
index acb17ce..0ddb948 100644
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_notrace_pid
     echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +0 -0
index 9f0a968..71319b3 100644

tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc do_test() { · line 45

Quoted 8 lines
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 -1
@@ -39,7 +39,7 @@ do_test() {
     disable_tracing
 
     echo do_execve* > set_ftrace_filter
-    echo *do_fork >> set_ftrace_filter
+    echo kernel_clone >> set_ftrace_filter
 
     echo $PID > set_ftrace_pid
     echo function > current_tracer

The issue I have with this, is that I run these tests on older kernels too, and tests that use to work on older kernels should still work. In fact, this fails on the kernel I'm currently adding new changes to!

Quoted 4 lines

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter

Good catch. BTW, can we check the filter-bility by grep the pattern from set_ftrace_filter?

Thank you,

Signature · 1 line
Masami Hiramatsu <[email protected]>
maintainer
#10 lore raw
Quoted 6 lines · On Sat, 24 Oct 2020 10:31:12 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines

Perhaps we should have:

	# older kernels have do_fork, but newer kernels have kernel_clone
	echo kernel_clone >> set_ftrace_filter || echo *do_fork >> set_ftrace_filter  

Good catch. BTW, can we check the filter-bility by grep the pattern from set_ftrace_filter?

I think we need to use /proc/kallsyms, as the kprobe code should still work if function tracing is disabled, and the function filter files will not exist.

-- Steve