mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Huafei <lihuafei1@huawei.com>
To: <jolsa@redhat.com>
Cc: <rostedt@goodmis.org>, <mingo@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] tracing: Reset the function filter after completing trampoline/graph selftest
Date: Mon, 18 Apr 2022 15:39:58 +0800	[thread overview]
Message-ID: <20220418073958.104029-1-lihuafei1@huawei.com> (raw)

The direct trampoline and graph coexistence test sets global_ops to
trace only 'trace_selftest_dynamic_test_func', but does not reset it
after the test is completed, resulting in the function filter being set
already after the system starts. Although it can be reset through the
tracefs interface, it is more or less confusing to the user, and we
should reset it to trace all functions after the trampoline/graph test
completes.

Fixes: 130c08065848 ("tracing: Add trampoline/graph selftest")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
 kernel/trace/trace_selftest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index abcadbe933bb..e89f72571f8e 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -866,12 +866,12 @@ trace_selftest_startup_function_graph(struct tracer *trace,
 	ret = register_ftrace_direct((unsigned long) DYN_FTRACE_TEST_NAME,
 				     (unsigned long) trace_direct_tramp);
 	if (ret)
-		goto out;
+		goto reset_filter;
 
 	ret = register_ftrace_graph(&fgraph_ops);
 	if (ret) {
 		warn_failed_init_tracer(trace, ret);
-		goto out;
+		goto reset_filter;
 	}
 
 	DYN_FTRACE_TEST_NAME();
@@ -887,14 +887,18 @@ trace_selftest_startup_function_graph(struct tracer *trace,
 	ret = unregister_ftrace_direct((unsigned long) DYN_FTRACE_TEST_NAME,
 				       (unsigned long) trace_direct_tramp);
 	if (ret)
-		goto out;
+		goto reset_filter;
 
 	tracing_start();
 
 	if (!ret && !count) {
 		ret = -1;
-		goto out;
+		goto reset_filter;
 	}
+
+reset_filter:
+	/* Enable tracing on all functions again */
+	ftrace_set_global_filter(NULL, 0, 1);
 #endif
 
 	/* Don't test dynamic tracing, the function tracer already did */
-- 
2.17.1


             reply	other threads:[~2022-04-18  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18  7:39 Li Huafei [this message]
2022-04-25 22:58 ` Steven Rostedt
2022-04-26  8:00   ` Li Huafei
2022-04-26 15:31     ` Steven Rostedt
2022-04-27  1:39       ` Li Huafei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220418073958.104029-1-lihuafei1@huawei.com \
    --to=lihuafei1@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®