public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Richard Weinberger <richard@nod.at>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 25/25] perf probe: Fix an error when deleting probes successfully
Date: Wed, 27 May 2015 12:39:10 -0300	[thread overview]
Message-ID: <1432741150-28551-26-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1432741150-28551-1-git-send-email-acme@kernel.org>

From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Fix a bug in del_perf_probe_events() which returns an error (-ENOENT)
even if the probes are successfully deleted.

This happens only if the probes are on user-apps and not on kernel,
simply because it doesn't clear the previous error.

So, without this fix, we get an error even though events are being
successfully removed.

  ------
  # ./perf probe -x ./perf del_perf_probe_events
  Added new event:
    probe_perf:del_perf_probe_events (on del_perf_probe_events in ...

  You can now use it in all perf tools, such as:

          perf record -e probe_perf:del_perf_probe_events -aR sleep 1

  # ./perf probe -d \*:\*
  Removed event: probe_perf:del_perf_probe_events
    Error: Failed to delete events.
  ------

This fixes the above error.
  ------
  # ./perf probe -d \*:\*
  Removed event: probe_perf:del_perf_probe_events
  ------

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Link: http://lkml.kernel.org/r/20150527083725.23880.45209.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index f5be411bc69c..97da98481d89 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2811,13 +2811,14 @@ int del_perf_probe_events(struct strfilter *filter)
 		goto error;
 
 	ret2 = del_trace_probe_events(ufd, filter, unamelist);
-	if (ret2 < 0 && ret2 != -ENOENT)
+	if (ret2 < 0 && ret2 != -ENOENT) {
 		ret = ret2;
-	else if (ret == -ENOENT && ret2 == -ENOENT) {
+		goto error;
+	}
+	if (ret == -ENOENT && ret2 == -ENOENT)
 		pr_debug("\"%s\" does not hit any event.\n", str);
 		/* Note that this is silently ignored */
-		ret = 0;
-	}
+	ret = 0;
 
 error:
 	if (kfd >= 0) {
-- 
2.1.0


  parent reply	other threads:[~2015-05-27 15:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 15:38 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 01/25] perf tools: Separate the tests and tools in installation Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 02/25] perf tools: Fix function declarations needed by parse-events.y Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 03/25] perf tools: Fix parse_events_error dereferences Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 04/25] perf build: Fix libunwind feature detection on 32-bit x86 Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 05/25] perf session: Fix perf_session__peek_event() Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 06/25] perf hists: Reducing arguments of hist_entry_iter__add() Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 07/25] perf hists: Rename add_hist_entry to hists__findnew_entry Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 08/25] perf comm: Use atomic.h for refcounting Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 09/25] perf machine: Do not call map_groups__delete(), drop refcnt instead Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 10/25] perf tools: Fix dso__data_read_offset() file opening Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 11/25] perf tools: Get rid of dso__data_fd() from dso__data_size() Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 12/25] perf tools: Add dso__data_get/put_fd() Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 13/25] perf tools: Rename maps__next Arnaldo Carvalho de Melo
2015-05-27 15:38 ` [PATCH 14/25] perf tools: Remove redundant initialization of thread linkage members Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 15/25] perf tools: Nuke unused map_groups__flush() Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 16/25] perf tools: Import rb_erase_init from block/ in the kernel sources Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 17/25] perf machine: Mark removed threads as such Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 18/25] perf tools: Leave DSO destruction to the map destruction Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 19/25] perf tools: Use maps__first()/map__next() Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 20/25] perf tools: Assign default value for some pointers Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 21/25] perf tools: Improve setting of gcc debug option Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 22/25] perf sched: Add option to merge like comms to lat output Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 23/25] perf tools: Disallow PMU events intel_pt and intel_bts until there is support Arnaldo Carvalho de Melo
2015-05-27 15:39 ` [PATCH 24/25] perf probe: Show the error reason comes from invalid DSO Arnaldo Carvalho de Melo
2015-05-27 15:39 ` Arnaldo Carvalho de Melo [this message]
2015-05-27 16:43 ` [GIT PULL 00/25] perf/core improvements and fixes Ingo Molnar

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=1432741150-28551-26-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=richard@nod.at \
    /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