From patchwork Fri Mar 17 08:16:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 95413 Delivered-To: patch@linaro.org Received: by 10.140.89.134 with SMTP id v6csp197905qgd; Fri, 17 Mar 2017 01:24:50 -0700 (PDT) X-Received: by 10.98.18.216 with SMTP id 85mr15574579pfs.131.1489739090212; Fri, 17 Mar 2017 01:24:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n67si5632122pfk.77.2017.03.17.01.24.49; Fri, 17 Mar 2017 01:24:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751122AbdCQIYk (ORCPT + 12 others); Fri, 17 Mar 2017 04:24:40 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3902 "EHLO dggrg02-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750926AbdCQIYa (ORCPT ); Fri, 17 Mar 2017 04:24:30 -0400 Received: from 172.30.72.57 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.57]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AKB80956; Fri, 17 Mar 2017 16:20:53 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Fri, 17 Mar 2017 16:20:46 +0800 From: Kefeng Wang To: Arnaldo Carvalho de Melo , Masami Hiramatsu , CC: , Kefeng Wang , "Jiri Olsa" , Peter Zijlstra , Wang Nan Subject: [PATCH v2] perf probe: Return errno when does not hit any event Date: Fri, 17 Mar 2017 16:16:32 +0800 Message-ID: <1489738592-61011-1-git-send-email-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <20170317105713.a4b1564a1fa2df5c9e340d5a@kernel.org> References: <20170317105713.a4b1564a1fa2df5c9e340d5a@kernel.org> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.58CB9C67.0305, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d94d7197b50e7d89b7a5ddfce98fe9de Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On old perf, when using perf probe -d to delete an inexistent event, it return 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 return 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. Cc: Arnaldo Carvalho de Melo Cc: Masami Hiramatsu Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Wang Nan Fixes: dddc7ee32fa1 ("perf probe: Fix an error when deleting probes successfully") Signed-off-by: Kefeng Wang --- v1->v2: - Using pr_wanring to show warning infos and drop inappropriate comment suggested by Masami Hiramatsu. tools/perf/builtin-probe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.7.12.4 Acked-by: Masami Hiramatsu 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)