From: "Steven Rostedt (Google)" <[email protected]>
The functions ftrace_hash_rec_disable() and ftrace_hash_rec_enable()
always has 1 passed to its "ftrace_hash" parameter. Remove the parameter
and pass in true to __ftrace_hash_rec_update().
Also add some comments to both those functions explaining what they do.
Signed-off-by: Steven Rostedt (Google) <[email protected]>
---
kernel/trace/ftrace.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 93c7c5fd4249..de652201c86c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1895,16 +1895,24 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
return update;
}
-static bool ftrace_hash_rec_disable(struct ftrace_ops *ops,
- int filter_hash)
+/*
+ * This is called when an ops is removed from tracing. It will decrement
+ * the counters of the dyn_ftrace records for all the functions that
+ * the @ops attached to.
+ */
+static bool ftrace_hash_rec_disable(struct ftrace_ops *ops)
{
- return __ftrace_hash_rec_update(ops, filter_hash, 0);
+ return __ftrace_hash_rec_update(ops, true, 0);
}
-static bool ftrace_hash_rec_enable(struct ftrace_ops *ops,
- int filter_hash)
+/*
+ * This is called when an ops is added to tracing. It will increment
+ * the counters of the dyn_ftrace records for all the functions that
+ * the @ops attached to.
+ */
+static bool ftrace_hash_rec_enable(struct ftrace_ops *ops)
{
- return __ftrace_hash_rec_update(ops, filter_hash, 1);
+ return __ftrace_hash_rec_update(ops, true, 1);
}
static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,
@@ -3062,7 +3070,7 @@ int ftrace_startup(struct ftrace_ops *ops, int command)
return ret;
}
- if (ftrace_hash_rec_enable(ops, 1))
+ if (ftrace_hash_rec_enable(ops))
command |= FTRACE_UPDATE_CALLS;
ftrace_startup_enable(command);
@@ -3104,7 +3112,7 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command)
/* Disabling ipmodify never fails */
ftrace_hash_ipmodify_disable(ops);
- if (ftrace_hash_rec_disable(ops, 1))
+ if (ftrace_hash_rec_disable(ops))
command |= FTRACE_UPDATE_CALLS;
ops->flags &= ~FTRACE_OPS_FL_ENABLED;
--
2.43.0
On Tue, Jun 04, 2024 at 05:28:20PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <[email protected]>
>
> The functions ftrace_hash_rec_disable() and ftrace_hash_rec_enable()
> always has 1 passed to its "ftrace_hash" parameter. Remove the parameter
> and pass in true to __ftrace_hash_rec_update().
>
> Also add some comments to both those functions explaining what they do.
>
> Signed-off-by: Steven Rostedt (Google) <[email protected]>
Looks good to me.
Acked-by: Mark Rutland <[email protected]>
Mark.
> ---
> kernel/trace/ftrace.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 93c7c5fd4249..de652201c86c 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1895,16 +1895,24 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
> return update;
> }
>
> -static bool ftrace_hash_rec_disable(struct ftrace_ops *ops,
> - int filter_hash)
> +/*
> + * This is called when an ops is removed from tracing. It will decrement
> + * the counters of the dyn_ftrace records for all the functions that
> + * the @ops attached to.
> + */
> +static bool ftrace_hash_rec_disable(struct ftrace_ops *ops)
> {
> - return __ftrace_hash_rec_update(ops, filter_hash, 0);
> + return __ftrace_hash_rec_update(ops, true, 0);
> }
>
> -static bool ftrace_hash_rec_enable(struct ftrace_ops *ops,
> - int filter_hash)
> +/*
> + * This is called when an ops is added to tracing. It will increment
> + * the counters of the dyn_ftrace records for all the functions that
> + * the @ops attached to.
> + */
> +static bool ftrace_hash_rec_enable(struct ftrace_ops *ops)
> {
> - return __ftrace_hash_rec_update(ops, filter_hash, 1);
> + return __ftrace_hash_rec_update(ops, true, 1);
> }
>
> static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,
> @@ -3062,7 +3070,7 @@ int ftrace_startup(struct ftrace_ops *ops, int command)
> return ret;
> }
>
> - if (ftrace_hash_rec_enable(ops, 1))
> + if (ftrace_hash_rec_enable(ops))
> command |= FTRACE_UPDATE_CALLS;
>
> ftrace_startup_enable(command);
> @@ -3104,7 +3112,7 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command)
> /* Disabling ipmodify never fails */
> ftrace_hash_ipmodify_disable(ops);
>
> - if (ftrace_hash_rec_disable(ops, 1))
> + if (ftrace_hash_rec_disable(ops))
> command |= FTRACE_UPDATE_CALLS;
>
> ops->flags &= ~FTRACE_OPS_FL_ENABLED;
> --
> 2.43.0
>
>
On Wed, 5 Jun 2024 11:17:31 +0100
Mark Rutland <[email protected]> wrote:
> On Tue, Jun 04, 2024 at 05:28:20PM -0400, Steven Rostedt wrote:
> > From: "Steven Rostedt (Google)" <[email protected]>
> >
> > The functions ftrace_hash_rec_disable() and ftrace_hash_rec_enable()
> > always has 1 passed to its "ftrace_hash" parameter. Remove the parameter
> > and pass in true to __ftrace_hash_rec_update().
> >
> > Also add some comments to both those functions explaining what they do.
> >
> > Signed-off-by: Steven Rostedt (Google) <[email protected]>
>
> Looks good to me.
>
> Acked-by: Mark Rutland <[email protected]>
I removed your Ack from v2 as it changed enough that I believe it
requires a new Ack.
-- Steve
On Tue, 04 Jun 2024 17:28:20 -0400
Steven Rostedt <[email protected]> wrote:
> From: "Steven Rostedt (Google)" <[email protected]>
>
> The functions ftrace_hash_rec_disable() and ftrace_hash_rec_enable()
> always has 1 passed to its "ftrace_hash" parameter. Remove the parameter
> and pass in true to __ftrace_hash_rec_update().
>
> Also add some comments to both those functions explaining what they do.
>
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <[email protected]>
Thank you,
> Signed-off-by: Steven Rostedt (Google) <[email protected]>
> ---
> kernel/trace/ftrace.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 93c7c5fd4249..de652201c86c 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1895,16 +1895,24 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
> return update;
> }
>
> -static bool ftrace_hash_rec_disable(struct ftrace_ops *ops,
> - int filter_hash)
> +/*
> + * This is called when an ops is removed from tracing. It will decrement
> + * the counters of the dyn_ftrace records for all the functions that
> + * the @ops attached to.
> + */
> +static bool ftrace_hash_rec_disable(struct ftrace_ops *ops)
> {
> - return __ftrace_hash_rec_update(ops, filter_hash, 0);
> + return __ftrace_hash_rec_update(ops, true, 0);
> }
>
> -static bool ftrace_hash_rec_enable(struct ftrace_ops *ops,
> - int filter_hash)
> +/*
> + * This is called when an ops is added to tracing. It will increment
> + * the counters of the dyn_ftrace records for all the functions that
> + * the @ops attached to.
> + */
> +static bool ftrace_hash_rec_enable(struct ftrace_ops *ops)
> {
> - return __ftrace_hash_rec_update(ops, filter_hash, 1);
> + return __ftrace_hash_rec_update(ops, true, 1);
> }
>
> static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,
> @@ -3062,7 +3070,7 @@ int ftrace_startup(struct ftrace_ops *ops, int command)
> return ret;
> }
>
> - if (ftrace_hash_rec_enable(ops, 1))
> + if (ftrace_hash_rec_enable(ops))
> command |= FTRACE_UPDATE_CALLS;
>
> ftrace_startup_enable(command);
> @@ -3104,7 +3112,7 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command)
> /* Disabling ipmodify never fails */
> ftrace_hash_ipmodify_disable(ops);
>
> - if (ftrace_hash_rec_disable(ops, 1))
> + if (ftrace_hash_rec_disable(ops))
> command |= FTRACE_UPDATE_CALLS;
>
> ops->flags &= ~FTRACE_OPS_FL_ENABLED;
> --
> 2.43.0
>
>
--
Masami Hiramatsu (Google) <[email protected]>
On Thu, 6 Jun 2024 06:50:18 +0900
Masami Hiramatsu (Google) <[email protected]> wrote:
> On Tue, 04 Jun 2024 17:28:20 -0400
> Steven Rostedt <[email protected]> wrote:
>
> > From: "Steven Rostedt (Google)" <[email protected]>
> >
> > The functions ftrace_hash_rec_disable() and ftrace_hash_rec_enable()
> > always has 1 passed to its "ftrace_hash" parameter. Remove the parameter
> > and pass in true to __ftrace_hash_rec_update().
> >
> > Also add some comments to both those functions explaining what they do.
> >
>
> Looks good to me.
>
> Reviewed-by: Masami Hiramatsu (Google) <[email protected]>
Thanks Masami, but I sent out a v2. Could you review those patches
instead?
https://lore.kernel.org/all/[email protected]/
-- Steve