From: Wei Xiao <xiaowei66@huawei.com>
To: <rostedt@goodmis.org>, <mingo@redhat.com>, <mcgrof@kernel.org>,
<keescook@chromium.org>, <yzaikin@google.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
<young.liuyang@huawei.com>, <zengweilin@huawei.com>,
<nixiaoming@huawei.com>, <xiaowei66@huawei.com>
Subject: [PATCH] ftrace: move sysctl_ftrace_enabled to ftrace.c
Date: Wed, 23 Feb 2022 09:23:11 +0800 [thread overview]
Message-ID: <20220223012311.134314-1-xiaowei66@huawei.com> (raw)
This moves ftrace_enabled to trace/ftrace.c.
Signed-off-by: Wei Xiao <xiaowei66@huawei.com>
---
include/linux/ftrace.h | 3 ---
kernel/sysctl.c | 9 ---------
kernel/trace/ftrace.c | 22 +++++++++++++++++++++-
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9999e29187de..659b2840563a 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -94,9 +94,6 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *val
#ifdef CONFIG_FUNCTION_TRACER
extern int ftrace_enabled;
-extern int
-ftrace_enable_sysctl(struct ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos);
#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 5ae443b2882e..55279ec66b28 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1906,15 +1906,6 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
-#ifdef CONFIG_FUNCTION_TRACER
- {
- .procname = "ftrace_enabled",
- .data = &ftrace_enabled,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = ftrace_enable_sysctl,
- },
-#endif
#ifdef CONFIG_STACK_TRACER
{
.procname = "stack_tracer_enabled",
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f9feb197b2da..4a5b4d6996a4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7846,7 +7846,8 @@ static bool is_permanent_ops_registered(void)
return false;
}
-int
+#ifdef CONFIG_SYSCTL
+static int
ftrace_enable_sysctl(struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
@@ -7889,3 +7890,22 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
mutex_unlock(&ftrace_lock);
return ret;
}
+
+static struct ctl_table ftrace_sysctls[] = {
+ {
+ .procname = "ftrace_enabled",
+ .data = &ftrace_enabled,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = ftrace_enable_sysctl,
+ },
+ {}
+};
+
+static int __init ftrace_sysctl_init(void)
+{
+ register_sysctl_init("kernel", ftrace_sysctls);
+ return 0;
+}
+late_initcall(ftrace_sysctl_init);
+#endif
--
2.19.1
next reply other threads:[~2022-02-23 1:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 1:23 Wei Xiao [this message]
2022-02-23 1:52 ` [PATCH] ftrace: move sysctl_ftrace_enabled to ftrace.c Luis Chamberlain
2022-02-23 2:13 ` Steven Rostedt
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=20220223012311.134314-1-xiaowei66@huawei.com \
--to=xiaowei66@huawei.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mingo@redhat.com \
--cc=nixiaoming@huawei.com \
--cc=rostedt@goodmis.org \
--cc=young.liuyang@huawei.com \
--cc=yzaikin@google.com \
--cc=zengweilin@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).