mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
To: mingo@redhat.com, acme@kernel.org, mhiramat@kernel.org
Cc: brendan.d.gregg@gmail.com, peterz@infradead.org,
	alexander.shishkin@linux.intel.com, wangnan0@huawei.com,
	jolsa@kernel.org, ak@linux.intel.com, treeze.taeung@gmail.com,
	mathieu.poirier@linaro.org, hekuang@huawei.com,
	sukadev@linux.vnet.ibm.com, ananth@in.ibm.com,
	naveen.n.rao@linux.vnet.ibm.com, adrian.hunter@intel.com,
	linux-kernel@vger.kernel.org, hemant@linux.vnet.ibm.com,
	Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Subject: [PATCH v4 4/7] perf/sdt: Clean uprobe_events when event(out of multiple events) parsing fails
Date: Mon,  6 Mar 2017 18:43:01 +0530	[thread overview]
Message-ID: <20170306131304.1625-5-ravi.bangoria@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170306131304.1625-1-ravi.bangoria@linux.vnet.ibm.com>

User may ask for multiple events in the same record command like,

  perf record -a -e sdt_1:* -e sdt_2:*

If sdt_1:* events are already added to uprobe_events and sdt_2:*
event parsing fails, clean sdt_1:* events from uprobe_events.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
---
 tools/perf/builtin-record.c  | 7 +++----
 tools/perf/perf.h            | 1 +
 tools/perf/util/probe-file.c | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e87b19b..46d447e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1517,11 +1517,10 @@ bool is_cmd_record(void)
 	return (record.evlist != NULL);
 }
 
-static void
-sdt_event_list__remove(struct list_head *sdt_event_list __maybe_unused)
+void sdt_event_list__remove(void)
 {
 #ifdef HAVE_LIBELF_SUPPORT
-	return remove_sdt_event_list(sdt_event_list);
+	return remove_sdt_event_list(&record.sdt_event_list);
 #endif
 }
 
@@ -1864,7 +1863,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 	perf_evlist__delete(rec->evlist);
 	symbol__exit();
 	auxtrace_record__free(rec->itr);
-	sdt_event_list__remove(&rec->sdt_event_list);
+	sdt_event_list__remove();
 	return err;
 }
 
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 9d8e5fe..8a411f1 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -77,4 +77,5 @@ struct option;
 extern const char * const *record_usage;
 extern struct option *record_options;
 bool is_cmd_record(void);
+void sdt_event_list__remove(void);
 #endif
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 47b624a..358ca98 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -1192,8 +1192,10 @@ int add_sdt_event(char *event, struct list_head *sdt_evlist)
 	ret = 0;
 
 free_pev:
-	if (ret < 0)
+	if (ret < 0) {
 		free_sdt_list(sdt_evlist);
+		sdt_event_list__remove();
+	}
 	cleanup_perf_probe_events(pev, 1);
 	clear_probe_trace_events(exst_tevs, exst_ntevs);
 	free(pev);
-- 
2.9.3

  parent reply	other threads:[~2017-03-06 16:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 13:12 [PATCH v4 0/7] perf/sdt: Directly record SDT events with 'perf record' Ravi Bangoria
2017-03-06 13:12 ` [PATCH v4 1/7] perf/sdt: Introduce util func is_sdt_event() Ravi Bangoria
2017-03-06 13:12 ` [PATCH v4 2/7] perf/sdt: Directly record SDT events with 'perf record' Ravi Bangoria
2017-03-08 11:41   ` Masami Hiramatsu
2017-03-06 13:13 ` [PATCH v4 3/7] perf/sdt: Allow recording of existing events Ravi Bangoria
2017-03-06 13:13 ` Ravi Bangoria [this message]
2017-03-06 13:13 ` [PATCH v4 5/7] perf/sdt: Warn when number of events recorded are not equal to cached events Ravi Bangoria
2017-03-06 13:13 ` [PATCH v4 6/7] perf/sdt: List events fetched from uprobe_events Ravi Bangoria
2017-03-06 13:13 ` [PATCH v4 7/7] perf/sdt: Remove stale warning Ravi Bangoria

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=20170306131304.1625-5-ravi.bangoria@linux.vnet.ibm.com \
    --to=ravi.bangoria@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ananth@in.ibm.com \
    --cc=brendan.d.gregg@gmail.com \
    --cc=hekuang@huawei.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=treeze.taeung@gmail.com \
    --cc=wangnan0@huawei.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

all inboxes | Powered by JetHome®