From: Steven Rostedt <rostedt@goodmis.org>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Wei Xiao <xiaowei66@huawei.com>,
mingo@redhat.com, keescook@chromium.org, yzaikin@google.com,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
young.liuyang@huawei.com, zengweilin@huawei.com,
nixiaoming@huawei.com
Subject: Re: [PATCH] ftrace: move sysctl_ftrace_enabled to ftrace.c
Date: Tue, 22 Feb 2022 21:13:03 -0500 [thread overview]
Message-ID: <20220222211303.402e3e4d@rorschach.local.home> (raw)
In-Reply-To: <YhWTezoFrIOEWXBZ@bombadil.infradead.org>
On Tue, 22 Feb 2022 17:52:59 -0800
Luis Chamberlain <mcgrof@kernel.org> wrote:
> On Wed, Feb 23, 2022 at 09:23:11AM +0800, Wei Xiao wrote:
> > This moves ftrace_enabled to trace/ftrace.c.
>
> Hey Wei, thanks for you patch!
>
> This does not explain how this is being to help with maitenance as
> otherwise this makes kernel/sysctl.c hard to maintain and we also tend
> to get many conflicts. It also does not explain how all the filesystem
> sysctls are not gone and that this is just the next step, moving slowly
> the rest of the sysctls. Explaining this in the commit log will help
> patch review and subsystem maintainers understand the conext / logic
> behind the move.
>
> I'd be more than happy to take this if ftrace folks Ack. To avoid conflicts
> I can route this through sysctl-next which is put forward in particular
> to avoid conflicts across trees for this effort. Let me know.
I'm fine with this change going through another tree.
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
for your convenience.
>
> > 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
>
> Is the ifdef really needed? It was not there before, ie, does
> ftrace not depend on sysctls? I don't see a direct relationship
> but I do wonder if its implicit.
I think because the function is now static, and that it now includes the
structure itself, that the #ifdef is added. When I first saw it, I was
a bit uncomfortable with adding more #ifdefs, but for this use case, I
believe it's OK.
>
> > 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
>
> There's other __init calls already on ftrace, would this be better
> placed in one of them, and then have this be a no-op iff we determine
> ftrace can be built without sysctls and then have a no-op for when
> sysctls are disabled.
I rather have the initcall here, as the other initcalls are special
needs, and not generic functions.
-- Steve
prev parent reply other threads:[~2022-02-23 2:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 1:23 [PATCH] ftrace: move sysctl_ftrace_enabled to ftrace.c Wei Xiao
2022-02-23 1:52 ` Luis Chamberlain
2022-02-23 2:13 ` Steven Rostedt [this message]
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=20220222211303.402e3e4d@rorschach.local.home \
--to=rostedt@goodmis.org \
--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=xiaowei66@huawei.com \
--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).