* [PATCH] perf probe: Return errno when does not hit any event
@ 2017-03-06 9:34 Kefeng Wang
2017-03-07 7:33 ` Kefeng Wang
0 siblings, 1 reply; 11+ messages in thread
From: Kefeng Wang @ 2017-03-06 9:34 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan, guohanjun,
Kefeng Wang
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 $?
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>
---
tools/perf/builtin-probe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 1fcebc3..c46b41c 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -444,7 +444,8 @@ 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;
+ else
+ ret = 0;
error:
if (kfd >= 0)
--
1.7.12.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] perf probe: Return errno when does not hit any event
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
0 siblings, 1 reply; 11+ messages in thread
From: Kefeng Wang @ 2017-03-07 7:33 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan, guohanjun,
Arnaldo Carvalho de Melo
+ Arnaldo Carvalho de Melo <acme@kernel.org>
On 2017/3/6 17:34, Kefeng Wang wrote:
> 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 $?
> 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>
> ---
> tools/perf/builtin-probe.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 1fcebc3..c46b41c 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -444,7 +444,8 @@ 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;
> + else
> + ret = 0;
>
> error:
> if (kfd >= 0)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] perf probe: Return errno when does not hit any event
2017-03-07 7:33 ` Kefeng Wang
@ 2017-03-14 13:19 ` Kefeng Wang
2017-03-14 13:30 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 11+ messages in thread
From: Kefeng Wang @ 2017-03-14 13:19 UTC (permalink / raw)
To: linux-kernel, Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan, guohanjun
Hi all, any comments, thanks.
On 2017/3/7 15:33, Kefeng Wang wrote:
> + Arnaldo Carvalho de Melo <acme@kernel.org>
>
> On 2017/3/6 17:34, Kefeng Wang wrote:
>> 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 $?
>> 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>
>> ---
>> tools/perf/builtin-probe.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
>> index 1fcebc3..c46b41c 100644
>> --- a/tools/perf/builtin-probe.c
>> +++ b/tools/perf/builtin-probe.c
>> @@ -444,7 +444,8 @@ 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;
>> + else
>> + ret = 0;
>>
>> error:
>> if (kfd >= 0)
>>
>
>
> .
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] perf probe: Return errno when does not hit any event
2017-03-14 13:19 ` Kefeng Wang
@ 2017-03-14 13:30 ` Arnaldo Carvalho de Melo
2017-03-16 9:39 ` Masami Hiramatsu
0 siblings, 1 reply; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-03-14 13:30 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Kefeng Wang, linux-kernel, Peter Zijlstra, Jiri Olsa,
Namhyung Kim, Wang Nan, guohanjun
Em Tue, Mar 14, 2017 at 09:19:47PM +0800, Kefeng Wang escreveu:
> Hi all, any comments, thanks.
For 'perf probe' make sure Masami is in the CC list, adding him, Masami?
- Arnaldo
> On 2017/3/7 15:33, Kefeng Wang wrote:
> > + Arnaldo Carvalho de Melo <acme@kernel.org>
> >
> > On 2017/3/6 17:34, Kefeng Wang wrote:
> >> 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 $?
> >> 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>
> >> ---
> >> tools/perf/builtin-probe.c | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> >> index 1fcebc3..c46b41c 100644
> >> --- a/tools/perf/builtin-probe.c
> >> +++ b/tools/perf/builtin-probe.c
> >> @@ -444,7 +444,8 @@ 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;
> >> + else
> >> + ret = 0;
> >>
> >> error:
> >> if (kfd >= 0)
> >>
> >
> >
> > .
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] perf probe: Return errno when does not hit any event
2017-03-14 13:30 ` Arnaldo Carvalho de Melo
@ 2017-03-16 9:39 ` Masami Hiramatsu
2017-03-16 12:07 ` Kefeng Wang
0 siblings, 1 reply; 11+ messages in thread
From: Masami Hiramatsu @ 2017-03-16 9:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Kefeng Wang, linux-kernel, Peter Zijlstra, Jiri Olsa,
Namhyung Kim, Wang Nan, guohanjun
On Tue, 14 Mar 2017 10:30:56 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Em Tue, Mar 14, 2017 at 09:19:47PM +0800, Kefeng Wang escreveu:
> > Hi all, any comments, thanks.
>
> For 'perf probe' make sure Masami is in the CC list, adding him, Masami?
Thanks Arnaldo,
Hi Kefeng, I've made the error ignored by design, since user might pass
the wildcard pattern to perf probe -d just for making sure.
You can check the pattern hits any event by using perf-probe --list PATTERN.
Would you have any use case to check the result?
Thank you,
>
> - Arnaldo
>
> > On 2017/3/7 15:33, Kefeng Wang wrote:
> > > + Arnaldo Carvalho de Melo <acme@kernel.org>
> > >
> > > On 2017/3/6 17:34, Kefeng Wang wrote:
> > >> 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 $?
> > >> 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>
> > >> ---
> > >> tools/perf/builtin-probe.c | 3 ++-
> > >> 1 file changed, 2 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> > >> index 1fcebc3..c46b41c 100644
> > >> --- a/tools/perf/builtin-probe.c
> > >> +++ b/tools/perf/builtin-probe.c
> > >> @@ -444,7 +444,8 @@ 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;
> > >> + else
> > >> + ret = 0;
> > >>
> > >> error:
> > >> if (kfd >= 0)
> > >>
> > >
> > >
> > > .
> > >
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] perf probe: Return errno when does not hit any event
2017-03-16 9:39 ` Masami Hiramatsu
@ 2017-03-16 12:07 ` Kefeng Wang
2017-03-17 1:57 ` Masami Hiramatsu
0 siblings, 1 reply; 11+ messages in thread
From: Kefeng Wang @ 2017-03-16 12:07 UTC (permalink / raw)
To: Masami Hiramatsu, Arnaldo Carvalho de Melo
Cc: linux-kernel, Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan,
guohanjun
On 2017/3/16 17:39, Masami Hiramatsu wrote:
> On Tue, 14 Mar 2017 10:30:56 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
>> Em Tue, Mar 14, 2017 at 09:19:47PM +0800, Kefeng Wang escreveu:
>>> Hi all, any comments, thanks.
>>
>> For 'perf probe' make sure Masami is in the CC list, adding him, Masami?
>
> Thanks Arnaldo,
>
> Hi Kefeng, I've made the error ignored by design, since user might pass
> the wildcard pattern to perf probe -d just for making sure.
>
> You can check the pattern hits any event by using perf-probe --list PATTERN.
> Would you have any use case to check the result?
There are some perf test cases from our inner tester, they will check
the returned value for each execution, and they think return errno is
better to cater for users when delete inexistent events, as it was before.
And the patch only returns error when does not hit any event.
If such behavior, error ignored is more reasonableo<\f I will push them to
modify the test cases.
Thanks,
Kefeng
>
> Thank you,
>
>>
>> - Arnaldo
>>
>>> On 2017/3/7 15:33, Kefeng Wang wrote:
>>>> + Arnaldo Carvalho de Melo <acme@kernel.org>
>>>>
>>>> On 2017/3/6 17:34, Kefeng Wang wrote:
>>>>> 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 $?
>>>>> 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>
>>>>> ---
>>>>> tools/perf/builtin-probe.c | 3 ++-
>>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
>>>>> index 1fcebc3..c46b41c 100644
>>>>> --- a/tools/perf/builtin-probe.c
>>>>> +++ b/tools/perf/builtin-probe.c
>>>>> @@ -444,7 +444,8 @@ 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;
>>>>> + else
>>>>> + ret = 0;
>>>>>
>>>>> error:
>>>>> if (kfd >= 0)
>>>>>
>>>>
>>>>
>>>> .
>>>>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] perf probe: Return errno when does not hit any event
2017-03-16 12:07 ` Kefeng Wang
@ 2017-03-17 1:57 ` Masami Hiramatsu
2017-03-17 8:16 ` [PATCH v2] " Kefeng Wang
0 siblings, 1 reply; 11+ messages in thread
From: Masami Hiramatsu @ 2017-03-17 1:57 UTC (permalink / raw)
To: Kefeng Wang
Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra,
Jiri Olsa, Namhyung Kim, Wang Nan, guohanjun
On Thu, 16 Mar 2017 20:07:08 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
>
> On 2017/3/16 17:39, Masami Hiramatsu wrote:
> > On Tue, 14 Mar 2017 10:30:56 -0300
> > Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >
> >> Em Tue, Mar 14, 2017 at 09:19:47PM +0800, Kefeng Wang escreveu:
> >>> Hi all, any comments, thanks.
> >>
> >> For 'perf probe' make sure Masami is in the CC list, adding him, Masami?
> >
> > Thanks Arnaldo,
> >
> > Hi Kefeng, I've made the error ignored by design, since user might pass
> > the wildcard pattern to perf probe -d just for making sure.
> >
> > You can check the pattern hits any event by using perf-probe --list PATTERN.
> > Would you have any use case to check the result?
>
> There are some perf test cases from our inner tester, they will check
> the returned value for each execution, and they think return errno is
> better to cater for users when delete inexistent events, as it was before.
> And the patch only returns error when does not hit any event.
>
> If such behavior, error ignored is more reasonableo<\f I will push them to
> modify the test cases.
Hmm, the commit dddc7ee32fa1 ("perf probe: Fix an error when deleting probes successfully") introduced this behavior. But I think this fix will not be
the best solution.
OK, so could you update your patch according my comment and resend it?
> >>>>> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> >>>>> index 1fcebc3..c46b41c 100644
> >>>>> --- a/tools/perf/builtin-probe.c
> >>>>> +++ b/tools/perf/builtin-probe.c
> >>>>> @@ -444,7 +444,8 @@ static int perf_del_probe_events(struct strfilter *filter)
> >>>>> if (ret == -ENOENT && ret2 == -ENOENT)
> >>>>> pr_debug("\"%s\" does not hit any event.\n", str);
This should be pr_warning if this case has an error.
> >>>>> /* Note that this is silently ignored */
This comment should be removed too, since this error is not ignored anymore.
> >>>>> - ret = 0;
> >>>>> + else
> >>>>> + ret = 0;
> >>>>>
With these patches, perf probe shows an error if there is no event hit
for --delete.
$ sudo ./perf probe -d hoge
"hoge" does not hit any event.
Error: Failed to delete events.
Thanks,
> >>>>> error:
> >>>>> if (kfd >= 0)
> >>>>>
> >>>>
> >>>>
> >>>> .
> >>>>
> >
> >
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] perf probe: Return errno when does not hit any event
2017-03-17 1:57 ` Masami Hiramatsu
@ 2017-03-17 8:16 ` Kefeng Wang
2017-03-17 23:23 ` Masami Hiramatsu
2017-03-24 18:43 ` [tip:perf/core] perf probe: Return errno when not hitting " tip-bot for Kefeng Wang
0 siblings, 2 replies; 11+ messages in thread
From: Kefeng Wang @ 2017-03-17 8:16 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Masami Hiramatsu, linux-kernel
Cc: guohanjun, Kefeng Wang, Jiri Olsa, Peter Zijlstra, Wang Nan
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 <acme@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
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")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
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(-)
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)
--
1.7.12.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] perf probe: Return errno when does not hit any event
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:perf/core] perf probe: Return errno when not hitting " tip-bot for Kefeng Wang
1 sibling, 1 reply; 11+ messages in thread
From: Masami Hiramatsu @ 2017-03-17 23:23 UTC (permalink / raw)
To: Kefeng Wang
Cc: Arnaldo Carvalho de Melo, linux-kernel, guohanjun, Jiri Olsa,
Peter Zijlstra, Wang Nan
On Fri, 17 Mar 2017 16:16:32 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> 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.
Looks good to me.
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks!
>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> 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")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>
> 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(-)
>
> 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)
> --
> 1.7.12.4
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] perf probe: Return errno when does not hit any event
2017-03-17 23:23 ` Masami Hiramatsu
@ 2017-03-21 13:46 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-03-21 13:46 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Kefeng Wang, linux-kernel, guohanjun, Jiri Olsa, Peter Zijlstra,
Wang Nan
Em Sat, Mar 18, 2017 at 08:23:02AM +0900, Masami Hiramatsu escreveu:
> On Fri, 17 Mar 2017 16:16:32 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> > And it is more appropriate to return -ENOENT instead of -EPERM.
> Looks good to me.
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tip:perf/core] perf probe: Return errno when not hitting any event
2017-03-17 8:16 ` [PATCH v2] " Kefeng Wang
2017-03-17 23:23 ` Masami Hiramatsu
@ 2017-03-24 18:43 ` tip-bot for Kefeng Wang
1 sibling, 0 replies; 11+ messages in thread
From: tip-bot for Kefeng Wang @ 2017-03-24 18:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, acme, wangnan0, jolsa, peterz, guohanjun, wangkefeng.wang,
linux-kernel, tglx, hpa, mhiramat
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)
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-03-24 18:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:perf/core] perf probe: Return errno when not hitting " tip-bot for Kefeng Wang
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).