linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/3] ftrace: Add cleanup to unregister_ftrace_direct_multi
Date: Mon,  6 Dec 2021 00:20:35 +0100	[thread overview]
Message-ID: <20211205232036.51996-3-jolsa@kernel.org> (raw)
In-Reply-To: <20211205232036.51996-1-jolsa@kernel.org>

Adding ops cleanup to unregister_ftrace_direct_multi,
so it can be reused in another register call.

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, 4 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7f0594e28226..be5f6b32a012 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5542,6 +5542,10 @@ int unregister_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
 	err = unregister_ftrace_function(ops);
 	remove_direct_functions_hash(hash, addr);
 	mutex_unlock(&direct_mutex);
+
+	/* cleanup for possible another register call */
+	ops->func = NULL;
+	ops->trampoline = 0;
 	return err;
 }
 EXPORT_SYMBOL_GPL(unregister_ftrace_direct_multi);
-- 
2.33.1


  parent reply	other threads:[~2021-12-05 23:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2021-12-05 23:20 ` Jiri Olsa [this message]
2021-12-05 23:20 ` [PATCH 3/3] ftrace/samples: Add module to test multi direct modify interface Jiri Olsa
2021-12-06 11:25   ` Heiko Carstens
2021-12-06 12:28     ` Jiri Olsa
2021-12-06 18:20 [PATCHv2 0/3] ftrace: Add ftrace-direct-multi-modify sample module Jiri Olsa
2021-12-06 18:20 ` [PATCH 2/3] ftrace: Add cleanup to unregister_ftrace_direct_multi 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=20211205232036.51996-3-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 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).