From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Tom Zanussi <tom.zanussi@linux.intel.com>,
Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Subject: [RFC PATCH 1/5] tracing/uprobes: Add busy check when cleanup all uprobes
Date: Fri, 28 Sep 2018 00:59:02 +0900 [thread overview]
Message-ID: <153806394273.18458.15673352612088639322.stgit@devbox> (raw)
In-Reply-To: <153806391326.18458.3927382953014694981.stgit@devbox>
Add a busy check loop in cleanup_all_probes() before
trying to remove all events in uprobe_events as same as
kprobe_events does.
Without this change, writing null to uprobe_events will
try to remove events but if one of them is enabled, it
stopped there but some of events are already cleared.
With this change, writing null to uprobe_events make
sure all events are not enabled before removing events.
So, it clears all events, or return an error (-EBUSY)
with keeping all events.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/trace/trace_uprobe.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 3a7c73c40007..a49583ece5fd 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -609,12 +609,19 @@ static int cleanup_all_probes(void)
int ret = 0;
mutex_lock(&uprobe_lock);
+ /* Ensure no probe is in use. */
+ list_for_each_entry(tu, &uprobe_list, list)
+ if (trace_probe_is_enabled(&tu->tp)) {
+ ret = -EBUSY;
+ goto end;
+ }
while (!list_empty(&uprobe_list)) {
tu = list_entry(uprobe_list.next, struct trace_uprobe, list);
ret = unregister_trace_uprobe(tu);
if (ret)
break;
}
+end:
mutex_unlock(&uprobe_lock);
return ret;
}
next prev parent reply other threads:[~2018-09-27 15:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 15:58 [RFC PATCH 0/5] tracing: Unifying dynamic event interface Masami Hiramatsu
2018-09-27 15:59 ` Masami Hiramatsu [this message]
2018-09-27 15:59 ` [RFC PATCH 2/5] tracing: Add a unified dynamic event framework Masami Hiramatsu
2018-09-27 15:59 ` [RFC PATCH 3/5] tracing/kprobes: Use dyn_event framework for kprobe events Masami Hiramatsu
2018-09-27 16:00 ` [RFC PATCH 4/5] tracing/uprobes: Use dyn_event framework for uprobe events Masami Hiramatsu
2018-09-27 16:00 ` [RFC PATCH 5/5] tracing: Add generic event-name based remove event method Masami Hiramatsu
2018-10-01 13:49 ` [RFC PATCH 0/5] tracing: Unifying dynamic event interface Tom Zanussi
2018-10-02 7:45 ` Masami Hiramatsu
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=153806394273.18458.15673352612088639322.stgit@devbox \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=tom.zanussi@linux.intel.com \
/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