public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <mhiramat@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, mingo@redhat.com, peterz@infradead.org,
	dle-develop@lists.sourceforge.net, fweisbec@gmail.com,
	rostedt@goodmis.org, jbaron@redhat.com, tglx@linutronix.de,
	mhiramat@redhat.com, systemtap@sources.redhat.com,
	linux-kernel@vger.kernel.org, hpa@zytor.com, fche@redhat.com,
	jkenisto@us.ibm.com, hch@infradead.org, ananth@in.ibm.com,
	srikar@linux.vnet.ibm.com, mingo@elte.hu,
	prasad@linux.vnet.ibm.com
Subject: [tip:perf/urgent] trace-kprobe: Support delete probe syntax
Date: Wed, 9 Dec 2009 07:26:01 GMT	[thread overview]
Message-ID: <tip-a7c312bed772c11138409c3a98531e85d690302e@git.kernel.org> (raw)
In-Reply-To: <20091208220316.10142.39192.stgit@dhcp-100-2-132.bos.redhat.com>

Commit-ID:  a7c312bed772c11138409c3a98531e85d690302e
Gitweb:     http://git.kernel.org/tip/a7c312bed772c11138409c3a98531e85d690302e
Author:     Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Tue, 8 Dec 2009 17:03:16 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 9 Dec 2009 07:26:53 +0100

trace-kprobe: Support delete probe syntax

Support delete probe syntax. The syntax is "-:[group/]event".

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
LKML-Reference: <20091208220316.10142.39192.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/trace/trace_kprobe.c |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index aff5f80..bf05fb4 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -606,23 +606,22 @@ static int create_trace_probe(int argc, char **argv)
 	 */
 	struct trace_probe *tp;
 	int i, ret = 0;
-	int is_return = 0;
+	int is_return = 0, is_delete = 0;
 	char *symbol = NULL, *event = NULL, *arg = NULL, *group = NULL;
 	unsigned long offset = 0;
 	void *addr = NULL;
 	char buf[MAX_EVENT_NAME_LEN];
 
-	if (argc < 2) {
-		pr_info("Probe point is not specified.\n");
-		return -EINVAL;
-	}
-
+	/* argc must be >= 1 */
 	if (argv[0][0] == 'p')
 		is_return = 0;
 	else if (argv[0][0] == 'r')
 		is_return = 1;
+	else if (argv[0][0] == '-')
+		is_delete = 1;
 	else {
-		pr_info("Probe definition must be started with 'p' or 'r'.\n");
+		pr_info("Probe definition must be started with 'p', 'r' or"
+			" '-'.\n");
 		return -EINVAL;
 	}
 
@@ -642,7 +641,29 @@ static int create_trace_probe(int argc, char **argv)
 			return -EINVAL;
 		}
 	}
+	if (!group)
+		group = KPROBE_EVENT_SYSTEM;
 
+	if (is_delete) {
+		if (!event) {
+			pr_info("Delete command needs an event name.\n");
+			return -EINVAL;
+		}
+		tp = find_probe_event(event, group);
+		if (!tp) {
+			pr_info("Event %s/%s doesn't exist.\n", group, event);
+			return -ENOENT;
+		}
+		/* delete an event */
+		unregister_trace_probe(tp);
+		free_trace_probe(tp);
+		return 0;
+	}
+
+	if (argc < 2) {
+		pr_info("Probe point is not specified.\n");
+		return -EINVAL;
+	}
 	if (isdigit(argv[1][0])) {
 		if (is_return) {
 			pr_info("Return probe point must be a symbol.\n");
@@ -671,8 +692,6 @@ static int create_trace_probe(int argc, char **argv)
 	argc -= 2; argv += 2;
 
 	/* setup a probe */
-	if (!group)
-		group = KPROBE_EVENT_SYSTEM;
 	if (!event) {
 		/* Make a new event name */
 		if (symbol)

  reply	other threads:[~2009-12-09  7:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 22:02 [PATCH -tip 0/8] perf-probe updates Masami Hiramatsu
2009-12-08 22:02 ` [PATCH -tip 1/8] perf probe: Change event list format Masami Hiramatsu
2009-12-09  7:24   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-08 22:02 ` [PATCH -tip 2/8] perf probe: Change probe-added message more user-friendly Masami Hiramatsu
2009-12-09  7:25   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-08 22:02 ` [PATCH -tip 3/8] perf probe: Fix add-probe command syntax without --add option Masami Hiramatsu
2009-12-09  7:25   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-08 22:03 ` [PATCH -tip 4/8] perf probe: Remove event suffix number _0 Masami Hiramatsu
2009-12-09  7:25   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-08 22:03 ` [PATCH -tip 5/8] perf probe: Support vmlinux on cwd by default Masami Hiramatsu
2009-12-09  7:25   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-08 22:03 ` [PATCH -tip 6/8] trace-kprobe: Support delete probe syntax Masami Hiramatsu
2009-12-09  7:26   ` tip-bot for Masami Hiramatsu [this message]
2009-12-08 22:03 ` [PATCH -tip 7/8] perf probe: Support --del option Masami Hiramatsu
2009-12-09  7:26   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-08 22:03 ` [PATCH -tip 8/8] perf probe: Update perf-probe document Masami Hiramatsu
2009-12-09  7:26   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-09  7:22 ` [PATCH -tip 0/8] perf-probe updates Ingo Molnar
2009-12-09  8:43   ` Ingo Molnar
2009-12-09 17:36     ` Masami Hiramatsu
2009-12-09 21:41       ` Masami Hiramatsu
2009-12-11 20:51         ` Arnaldo Carvalho de Melo
2009-12-11 21:15           ` Masami Hiramatsu
2009-12-11 21:29             ` Arnaldo Carvalho de Melo

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=tip-a7c312bed772c11138409c3a98531e85d690302e@git.kernel.org \
    --to=mhiramat@redhat.com \
    --cc=acme@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=fche@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=systemtap@sources.redhat.com \
    --cc=tglx@linutronix.de \
    /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