From: Jiri Olsa <jolsa@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>, Heiko Carstens <hca@linux.ibm.com>
Subject: [PATCH 1/3] ftrace: Use direct_ops hash in unregister_ftrace_direct
Date: Mon, 6 Dec 2021 19:20:30 +0100 [thread overview]
Message-ID: <20211206182032.87248-2-jolsa@kernel.org> (raw)
In-Reply-To: <20211206182032.87248-1-jolsa@kernel.org>
Now when we have *direct_multi interface the direct_functions
hash is no longer owned just by direct_ops. It's also used by
any other ftrace_ops passed to *direct_multi interface.
Thus to find out that we are unregistering the last function
from direct_ops, we need to check directly direct_ops's hash.
Fixes: f64dd4627ec6 ("ftrace: Add multi direct register/unregister interface")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
kernel/trace/ftrace.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 30bc880c3849..7f0594e28226 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5217,6 +5217,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
{
struct ftrace_direct_func *direct;
struct ftrace_func_entry *entry;
+ struct ftrace_hash *hash;
int ret = -ENODEV;
mutex_lock(&direct_mutex);
@@ -5225,7 +5226,8 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
if (!entry)
goto out_unlock;
- if (direct_functions->count == 1)
+ hash = direct_ops.func_hash->filter_hash;
+ if (hash->count == 1)
unregister_ftrace_function(&direct_ops);
ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0);
--
2.33.1
next prev parent reply other threads:[~2021-12-06 18:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 18:20 [PATCHv2 0/3] ftrace: Add ftrace-direct-multi-modify sample module Jiri Olsa
2021-12-06 18:20 ` Jiri Olsa [this message]
2021-12-06 18:20 ` [PATCH 2/3] ftrace: Add cleanup to unregister_ftrace_direct_multi Jiri Olsa
2021-12-06 18:20 ` [PATCH 3/3] ftrace/samples: Add module to test multi direct modify interface Jiri Olsa
-- strict thread matches above, loose matches on Subject: below --
2021-12-05 23:20 [PATCH 0/3] ftrace: Add ftrace-direct-multi-modify sample module Jiri Olsa
2021-12-05 23:20 ` [PATCH 1/3] ftrace: Use direct_ops hash in unregister_ftrace_direct Jiri Olsa
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=20211206182032.87248-2-jolsa@kernel.org \
--to=jolsa@redhat.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.