linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Kefeng Wang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, acme@redhat.com, wangnan0@huawei.com,
	jolsa@kernel.org, peterz@infradead.org, guohanjun@huawei.com,
	wangkefeng.wang@huawei.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, hpa@zytor.com, mhiramat@kernel.org
Subject: [tip:perf/core] perf probe: Return errno when not hitting any event
Date: Fri, 24 Mar 2017 11:43:42 -0700	[thread overview]
Message-ID: <tip-70946723eeb859466f026274b29c6196e39149c4@git.kernel.org> (raw)
In-Reply-To: <1489738592-61011-1-git-send-email-wangkefeng.wang@huawei.com>

Commit-ID:  70946723eeb859466f026274b29c6196e39149c4
Gitweb:     http://git.kernel.org/tip/70946723eeb859466f026274b29c6196e39149c4
Author:     Kefeng Wang <wangkefeng.wang@huawei.com>
AuthorDate: Fri, 17 Mar 2017 16:16:32 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 21 Mar 2017 10:45:02 -0300

perf probe: Return errno when not hitting any event

On old perf, when using 'perf probe -d' to delete an inexistent event,
it returns errno, eg,

  -bash-4.3# perf probe -d xxx  || echo $?
  Info: Event "*:xxx" does not exist.
    Error: Failed to delete events.
  255

But now perf_del_probe_events() will always set ret = 0, different from
previous del_perf_probe_events(). After this, it returns errno again,
eg,

  -bash-4.3# ./perf probe -d xxx  || echo $?
  "xxx" does not hit any event.
    Error: Failed to delete events.
  254

And it is more appropriate to return -ENOENT instead of -EPERM.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: dddc7ee32fa1 ("perf probe: Fix an error when deleting probes successfully")
Link: http://lkml.kernel.org/r/1489738592-61011-1-git-send-email-wangkefeng.wang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 1fcebc3..51cdc23 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -442,9 +442,9 @@ static int perf_del_probe_events(struct strfilter *filter)
 	}
 
 	if (ret == -ENOENT && ret2 == -ENOENT)
-		pr_debug("\"%s\" does not hit any event.\n", str);
-		/* Note that this is silently ignored */
-	ret = 0;
+		pr_warning("\"%s\" does not hit any event.\n", str);
+	else
+		ret = 0;
 
 error:
 	if (kfd >= 0)

      parent reply	other threads:[~2017-03-24 18:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06  9:34 [PATCH] perf probe: Return errno when does not hit any event Kefeng Wang
2017-03-07  7:33 ` Kefeng Wang
2017-03-14 13:19   ` Kefeng Wang
2017-03-14 13:30     ` Arnaldo Carvalho de Melo
2017-03-16  9:39       ` Masami Hiramatsu
2017-03-16 12:07         ` Kefeng Wang
2017-03-17  1:57           ` Masami Hiramatsu
2017-03-17  8:16             ` [PATCH v2] " Kefeng Wang
2017-03-17 23:23               ` Masami Hiramatsu
2017-03-21 13:46                 ` Arnaldo Carvalho de Melo
2017-03-24 18:43               ` tip-bot for Kefeng Wang [this message]

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-70946723eeb859466f026274b29c6196e39149c4@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=guohanjun@huawei.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wangkefeng.wang@huawei.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;
as well as URLs for NNTP newsgroup(s).