LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/1] ftrace: add unit test for removing trace function
@ 2021-09-04 18:02 Carles Pey
  2021-09-04 18:02 ` [PATCH 1/1] " Carles Pey
  0 siblings, 1 reply; 3+ messages in thread
From: Carles Pey @ 2021-09-04 18:02 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar, linux-kernel; +Cc: Carles Pey

A self test is provided for the trace function removal functionality.

Carles Pey (1):
  ftrace: add unit test for removing trace function

 kernel/trace/trace_selftest.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

-- 
2.26.3


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

* [PATCH 1/1] ftrace: add unit test for removing trace function
  2021-09-04 18:02 [PATCH 0/1] ftrace: add unit test for removing trace function Carles Pey
@ 2021-09-04 18:02 ` Carles Pey
  2021-09-08  1:40   ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Carles Pey @ 2021-09-04 18:02 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar, linux-kernel; +Cc: Carles Pey

---
 kernel/trace/trace_selftest.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index adf7ef194005..875b4f1a0476 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -287,6 +287,40 @@ static int trace_selftest_ops(struct trace_array *tr, int cnt)
 	if (trace_selftest_test_probe3_cnt != 4)
 		goto out_free;
 
+	/* Remove trace function from probe 3 */
+	func1_name = "!" __stringify(DYN_FTRACE_TEST_NAME);
+	len1 = strlen(func1_name);
+
+	ftrace_set_filter(&test_probe3, func1_name, len1, 0);
+
+	DYN_FTRACE_TEST_NAME();
+
+	print_counts();
+
+	if (trace_selftest_test_probe1_cnt != 3)
+		goto out_free;
+	if (trace_selftest_test_probe2_cnt != 2)
+		goto out_free;
+	if (trace_selftest_test_probe3_cnt != 4)
+		goto out_free;
+	if (cnt > 1) {
+		if (trace_selftest_test_global_cnt == 0)
+			goto out_free;
+	}
+	if (trace_selftest_test_dyn_cnt == 0)
+		goto out_free;
+
+	DYN_FTRACE_TEST_NAME2();
+
+	print_counts();
+
+	if (trace_selftest_test_probe1_cnt != 3)
+		goto out_free;
+	if (trace_selftest_test_probe2_cnt != 3)
+		goto out_free;
+	if (trace_selftest_test_probe3_cnt != 5)
+		goto out_free;
+
 	ret = 0;
  out_free:
 	unregister_ftrace_function(dyn_ops);
-- 
2.26.3


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

* Re: [PATCH 1/1] ftrace: add unit test for removing trace function
  2021-09-04 18:02 ` [PATCH 1/1] " Carles Pey
@ 2021-09-08  1:40   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2021-09-08  1:40 UTC (permalink / raw)
  To: Carles Pey; +Cc: Ingo Molnar, linux-kernel

On Sat,  4 Sep 2021 22:02:48 +0400
Carles Pey <carles.pey@gmail.com> wrote:


Two errors here.

-ENOCHANGELOG
-ENOSIG

No matter how trivial the patch, you need a change log. The subject is
"what" the patch does, the change log is "why" it is done. What was the
motivation for this patch.

And more critical, I can't even take this patch because there's no
"Signed-off-by".

-- Steve


> ---
>  kernel/trace/trace_selftest.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
> index adf7ef194005..875b4f1a0476 100644
> --- a/kernel/trace/trace_selftest.c
> +++ b/kernel/trace/trace_selftest.c
> @@ -287,6 +287,40 @@ static int trace_selftest_ops(struct trace_array *tr, int cnt)
>  	if (trace_selftest_test_probe3_cnt != 4)
>  		goto out_free;
>  
> +	/* Remove trace function from probe 3 */
> +	func1_name = "!" __stringify(DYN_FTRACE_TEST_NAME);
> +	len1 = strlen(func1_name);
> +
> +	ftrace_set_filter(&test_probe3, func1_name, len1, 0);
> +
> +	DYN_FTRACE_TEST_NAME();
> +
> +	print_counts();
> +
> +	if (trace_selftest_test_probe1_cnt != 3)
> +		goto out_free;
> +	if (trace_selftest_test_probe2_cnt != 2)
> +		goto out_free;
> +	if (trace_selftest_test_probe3_cnt != 4)
> +		goto out_free;
> +	if (cnt > 1) {
> +		if (trace_selftest_test_global_cnt == 0)
> +			goto out_free;
> +	}
> +	if (trace_selftest_test_dyn_cnt == 0)
> +		goto out_free;
> +
> +	DYN_FTRACE_TEST_NAME2();
> +
> +	print_counts();
> +
> +	if (trace_selftest_test_probe1_cnt != 3)
> +		goto out_free;
> +	if (trace_selftest_test_probe2_cnt != 3)
> +		goto out_free;
> +	if (trace_selftest_test_probe3_cnt != 5)
> +		goto out_free;
> +
>  	ret = 0;
>   out_free:
>  	unregister_ftrace_function(dyn_ops);


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

end of thread, other threads:[~2021-09-08  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04 18:02 [PATCH 0/1] ftrace: add unit test for removing trace function Carles Pey
2021-09-04 18:02 ` [PATCH 1/1] " Carles Pey
2021-09-08  1:40   ` Steven Rostedt

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).