From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 4/5] ftrace: Convert "filter_hash" and "inc" to bool in ftrace_hash_rec_update_modify()
Date: Tue, 04 Jun 2024 17:28:21 -0400 [thread overview]
Message-ID: <20240604212855.046127611@goodmis.org> (raw)
In-Reply-To: 20240604212817.384103202@goodmis.org
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The parameters "filter_hash" and "inc" in the function
ftrace_hash_rec_update_modify() are boolean. Change them to be such.
Also add documentation to what the function does.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index de652201c86c..021024164938 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1915,8 +1915,31 @@ static bool ftrace_hash_rec_enable(struct ftrace_ops *ops)
return __ftrace_hash_rec_update(ops, true, 1);
}
+/*
+ * This function will update what functions @ops traces when its filter
+ * changes. @filter_hash is set to true when modifying the filter_hash
+ * and set to false when modifying the notrace_hash.
+ *
+ * For example, if the user does: echo schedule > set_ftrace_filter
+ * that would call: ftrace_hash_rec_update_modify(ops, true, true);
+ *
+ * For: echo schedule >> set_ftrace_notrace
+ * That would call: ftrace_hash_rec_enable(ops, false, true);
+ *
+ * The @inc states if the @ops callbacks are going to be added or removed.
+ * The dyn_ftrace records are update via:
+ *
+ * ftrace_hash_rec_disable_modify(ops, filter_hash);
+ * ops->hash = new_hash
+ * ftrace_hash_rec_enable_modify(ops, filter_hash);
+ *
+ * Where the @ops is removed from all the records it is tracing using
+ * its old hash. The @ops hash is updated to the new hash, and then
+ * the @ops is added back to the records so that it is tracing all
+ * the new functions.
+ */
static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,
- int filter_hash, int inc)
+ bool filter_hash, bool inc)
{
struct ftrace_ops *op;
@@ -1939,15 +1962,15 @@ static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops,
}
static void ftrace_hash_rec_disable_modify(struct ftrace_ops *ops,
- int filter_hash)
+ bool filter_hash)
{
- ftrace_hash_rec_update_modify(ops, filter_hash, 0);
+ ftrace_hash_rec_update_modify(ops, filter_hash, false);
}
static void ftrace_hash_rec_enable_modify(struct ftrace_ops *ops,
- int filter_hash)
+ bool filter_hash)
{
- ftrace_hash_rec_update_modify(ops, filter_hash, 1);
+ ftrace_hash_rec_update_modify(ops, filter_hash, true);
}
/*
--
2.43.0
next prev parent reply other threads:[~2024-06-04 21:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 21:28 [PATCH 0/5] ftrace: Clean up and comment code Steven Rostedt
2024-06-04 21:28 ` [PATCH 1/5] ftrace: Rename dup_hash() and comment it Steven Rostedt
2024-06-05 21:46 ` Masami Hiramatsu
2024-06-04 21:28 ` [PATCH 2/5] ftrace: Comment __ftrace_hash_rec_update() and make filter_hash bool Steven Rostedt
2024-06-05 10:15 ` Mark Rutland
2024-06-05 14:18 ` Steven Rostedt
2024-06-05 16:06 ` Steven Rostedt
2024-06-04 21:28 ` [PATCH 3/5] ftrace: Remove "filter_hash" parameter from ftrace_hash_rec_disable/enable() Steven Rostedt
2024-06-05 10:17 ` Mark Rutland
2024-06-05 18:05 ` Steven Rostedt
2024-06-05 21:50 ` Masami Hiramatsu
2024-06-05 21:54 ` Steven Rostedt
2024-06-04 21:28 ` Steven Rostedt [this message]
2024-06-05 1:12 ` [PATCH 4/5] ftrace: Convert "filter_hash" and "inc" to bool in ftrace_hash_rec_update_modify() kernel test robot
2024-06-05 1:57 ` Steven Rostedt
2024-06-05 5:15 ` kernel test robot
2024-06-05 10:22 ` Mark Rutland
2024-06-04 21:28 ` [PATCH 5/5] ftrace: Add comments to ftrace_hash_move() and friends 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=20240604212855.046127611@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.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