From: Miroslav Benes <mbenes@suse.cz>
To: rostedt@goodmis.org, mingo@redhat.com, jpoimboe@redhat.com,
jikos@kernel.org, pmladek@suse.com, joe.lawrence@redhat.com
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
Miroslav Benes <mbenes@suse.cz>
Subject: [PATCH 1/3] ftrace: Make test_rec_ops_needs_regs() generic
Date: Mon, 7 Oct 2019 10:17:12 +0200 [thread overview]
Message-ID: <20191007081714.20259-2-mbenes@suse.cz> (raw)
In-Reply-To: <20191007081714.20259-1-mbenes@suse.cz>
Function test_rec_ops_needs_regs() tests whether ftrace_ops registered
on a record needs saved regs. That is, it tests for
FTRACE_OPS_FL_SAVE_REGS being set.
The same logic will be reused for newly introduced
FTRACE_OPS_FL_PERMANENT flag, so make the function generic.
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
---
kernel/trace/ftrace.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 62a50bf399d6..a37c1127599c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1602,24 +1602,24 @@ int ftrace_text_reserved(const void *start, const void *end)
return (int)!!ret;
}
-/* Test if ops registered to this rec needs regs */
-static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec)
+/* Test if ops registered to this rec needs to have a specified flag set */
+static bool test_rec_ops_needs_flag(struct dyn_ftrace *rec, int flag)
{
struct ftrace_ops *ops;
- bool keep_regs = false;
+ bool keep_flag = false;
for (ops = ftrace_ops_list;
ops != &ftrace_list_end; ops = ops->next) {
/* pass rec in as regs to have non-NULL val */
if (ftrace_ops_test(ops, rec->ip, rec)) {
- if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
- keep_regs = true;
+ if (ops->flags & flag) {
+ keep_flag = true;
break;
}
}
}
- return keep_regs;
+ return keep_flag;
}
static struct ftrace_ops *
@@ -1750,7 +1750,8 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
if (ftrace_rec_count(rec) > 0 &&
rec->flags & FTRACE_FL_REGS &&
ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
- if (!test_rec_ops_needs_regs(rec))
+ if (!test_rec_ops_needs_flag(rec,
+ FTRACE_OPS_FL_SAVE_REGS))
rec->flags &= ~FTRACE_FL_REGS;
}
--
2.23.0
next prev parent reply other threads:[~2019-10-07 8:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 8:17 [PATCH 0/3] ftrace: Introduce PERMANENT ftrace_ops flag Miroslav Benes
2019-10-07 8:17 ` Miroslav Benes [this message]
2019-10-07 8:17 ` [PATCH 2/3] " Miroslav Benes
2019-10-07 8:17 ` [PATCH 3/3] livepatch: Use FTRACE_OPS_FL_PERMANENT Miroslav Benes
2019-10-08 19:35 ` [PATCH 0/3] ftrace: Introduce PERMANENT ftrace_ops flag Joe Lawrence
2019-10-08 19:50 ` Steven Rostedt
2019-10-09 10:33 ` Miroslav Benes
2019-10-09 11:22 ` Petr Mladek
2019-10-09 14:23 ` Joe Lawrence
2019-10-09 14:26 ` Steven Rostedt
2019-10-10 8:50 ` Petr Mladek
2019-10-10 13:14 ` Steven Rostedt
2019-10-10 13:38 ` Miroslav Benes
2019-10-10 13:43 ` Steven Rostedt
2019-10-10 13:44 ` 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=20191007081714.20259-2-mbenes@suse.cz \
--to=mbenes@suse.cz \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pmladek@suse.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;
as well as URLs for NNTP newsgroup(s).