* [PATCH] perf stat: Fix error return code in bperf__load()
@ 2021-05-17 8:12 Yu Kuai
2021-05-29 9:10 ` yukuai (C)
2021-06-01 13:52 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 5+ messages in thread
From: Yu Kuai @ 2021-05-17 8:12 UTC (permalink / raw)
To: peterz, mingo, acme, ast, daniel, andrii
Cc: linux-perf-users, linux-kernel, netdev, bpf, yukuai3, yi.zhang
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
tools/perf/util/bpf_counter.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
index ddb52f748c8e..843b20aa6688 100644
--- a/tools/perf/util/bpf_counter.c
+++ b/tools/perf/util/bpf_counter.c
@@ -522,6 +522,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
if (evsel->bperf_leader_link_fd < 0 &&
bperf_reload_leader_program(evsel, attr_map_fd, &entry))
+ err = -1;
goto out;
/*
@@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
/* Step 2: load the follower skeleton */
evsel->follower_skel = bperf_follower_bpf__open();
if (!evsel->follower_skel) {
+ err = -1;
pr_err("Failed to open follower skeleton\n");
goto out;
}
--
2.25.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf stat: Fix error return code in bperf__load()
2021-05-17 8:12 [PATCH] perf stat: Fix error return code in bperf__load() Yu Kuai
@ 2021-05-29 9:10 ` yukuai (C)
2021-06-01 13:52 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 5+ messages in thread
From: yukuai (C) @ 2021-05-29 9:10 UTC (permalink / raw)
To: peterz, mingo, acme, ast, daniel, andrii
Cc: linux-perf-users, linux-kernel, netdev, bpf, yi.zhang
ping ...
On 2021/05/17 16:12, Yu Kuai wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> tools/perf/util/bpf_counter.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
> index ddb52f748c8e..843b20aa6688 100644
> --- a/tools/perf/util/bpf_counter.c
> +++ b/tools/perf/util/bpf_counter.c
> @@ -522,6 +522,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
> evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
> if (evsel->bperf_leader_link_fd < 0 &&
> bperf_reload_leader_program(evsel, attr_map_fd, &entry))
> + err = -1;
> goto out;
>
> /*
> @@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
> /* Step 2: load the follower skeleton */
> evsel->follower_skel = bperf_follower_bpf__open();
> if (!evsel->follower_skel) {
> + err = -1;
> pr_err("Failed to open follower skeleton\n");
> goto out;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf stat: Fix error return code in bperf__load()
2021-05-17 8:12 [PATCH] perf stat: Fix error return code in bperf__load() Yu Kuai
2021-05-29 9:10 ` yukuai (C)
@ 2021-06-01 13:52 ` Arnaldo Carvalho de Melo
2021-06-01 13:55 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-06-01 13:52 UTC (permalink / raw)
To: Yu Kuai, Song Liu
Cc: peterz, mingo, ast, daniel, andrii, linux-perf-users,
linux-kernel, netdev, bpf, yi.zhang
Em Mon, May 17, 2021 at 04:12:54PM +0800, Yu Kuai escreveu:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Applied, but I had to add Song to the CC list and also add this line:
Fixes: 7fac83aaf2eecc9e ("perf stat: Introduce 'bperf' to share hardware PMCs with BPF")
So that the stable@kernel.org folks can get this auto-collected.
Perhaps you guys can make Hulk do that as well? :-)
Thanks,
- Arnaldo
> ---
> tools/perf/util/bpf_counter.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
> index ddb52f748c8e..843b20aa6688 100644
> --- a/tools/perf/util/bpf_counter.c
> +++ b/tools/perf/util/bpf_counter.c
> @@ -522,6 +522,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
> evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
> if (evsel->bperf_leader_link_fd < 0 &&
> bperf_reload_leader_program(evsel, attr_map_fd, &entry))
> + err = -1;
> goto out;
>
> /*
> @@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
> /* Step 2: load the follower skeleton */
> evsel->follower_skel = bperf_follower_bpf__open();
> if (!evsel->follower_skel) {
> + err = -1;
> pr_err("Failed to open follower skeleton\n");
> goto out;
> }
> --
> 2.25.4
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf stat: Fix error return code in bperf__load()
2021-06-01 13:52 ` Arnaldo Carvalho de Melo
@ 2021-06-01 13:55 ` Arnaldo Carvalho de Melo
2021-06-02 1:05 ` yukuai (C)
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-06-01 13:55 UTC (permalink / raw)
To: Yu Kuai, Song Liu
Cc: peterz, mingo, ast, daniel, andrii, linux-perf-users,
linux-kernel, netdev, bpf, yi.zhang
Em Tue, Jun 01, 2021 at 10:52:42AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, May 17, 2021 at 04:12:54PM +0800, Yu Kuai escreveu:
> > Fix to return a negative error code from the error handling
> > case instead of 0, as done elsewhere in this function.
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>
> Applied, but I had to add Song to the CC list and also add this line:
>
> Fixes: 7fac83aaf2eecc9e ("perf stat: Introduce 'bperf' to share hardware PMCs with BPF")
>
> So that the stable@kernel.org folks can get this auto-collected.
>
> Perhaps you guys can make Hulk do that as well? :-)
>
> Thanks,
Something else to teach Hulk:
util/bpf_counter.c: In function ‘bperf__load’:
util/bpf_counter.c:523:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
523 | if (evsel->bperf_leader_link_fd < 0 &&
| ^~
util/bpf_counter.c:526:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
526 | goto out;
| ^~~~
cc1: all warnings being treated as errors
I'm adding the missing {} for the now multiline if block.
- Arnaldo
>
> > ---
> > tools/perf/util/bpf_counter.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
> > index ddb52f748c8e..843b20aa6688 100644
> > --- a/tools/perf/util/bpf_counter.c
> > +++ b/tools/perf/util/bpf_counter.c
> > @@ -522,6 +522,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
> > evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
> > if (evsel->bperf_leader_link_fd < 0 &&
> > bperf_reload_leader_program(evsel, attr_map_fd, &entry))
> > + err = -1;
> > goto out;
> >
> > /*
> > @@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
> > /* Step 2: load the follower skeleton */
> > evsel->follower_skel = bperf_follower_bpf__open();
> > if (!evsel->follower_skel) {
> > + err = -1;
> > pr_err("Failed to open follower skeleton\n");
> > goto out;
> > }
> > --
> > 2.25.4
> >
>
> --
>
> - Arnaldo
--
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf stat: Fix error return code in bperf__load()
2021-06-01 13:55 ` Arnaldo Carvalho de Melo
@ 2021-06-02 1:05 ` yukuai (C)
0 siblings, 0 replies; 5+ messages in thread
From: yukuai (C) @ 2021-06-02 1:05 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Song Liu
Cc: peterz, mingo, ast, daniel, andrii, linux-perf-users,
linux-kernel, netdev, bpf, yi.zhang
On 2021/06/01 21:55, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jun 01, 2021 at 10:52:42AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Mon, May 17, 2021 at 04:12:54PM +0800, Yu Kuai escreveu:
>>> Fix to return a negative error code from the error handling
>>> case instead of 0, as done elsewhere in this function.
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>>
>> Applied, but I had to add Song to the CC list and also add this line:
>>
>> Fixes: 7fac83aaf2eecc9e ("perf stat: Introduce 'bperf' to share hardware PMCs with BPF")
>>
>> So that the stable@kernel.org folks can get this auto-collected.
>>
>> Perhaps you guys can make Hulk do that as well? :-)
>>
>> Thanks,
>
> Something else to teach Hulk:
>
> util/bpf_counter.c: In function ‘bperf__load’:
> util/bpf_counter.c:523:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
> 523 | if (evsel->bperf_leader_link_fd < 0 &&
> | ^~
> util/bpf_counter.c:526:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
> 526 | goto out;
> | ^~~~
> cc1: all warnings being treated as errors
>
> I'm adding the missing {} for the now multiline if block.
Sorry for the mistake, and similar errors will be checked in the future.
Thanks
Yu Kuai
>
> - Arnaldo
>>
>>> ---
>>> tools/perf/util/bpf_counter.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
>>> index ddb52f748c8e..843b20aa6688 100644
>>> --- a/tools/perf/util/bpf_counter.c
>>> +++ b/tools/perf/util/bpf_counter.c
>>> @@ -522,6 +522,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
>>> evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
>>> if (evsel->bperf_leader_link_fd < 0 &&
>>> bperf_reload_leader_program(evsel, attr_map_fd, &entry))
>>> + err = -1;
>>> goto out;
>>>
>>> /*
>>> @@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target)
>>> /* Step 2: load the follower skeleton */
>>> evsel->follower_skel = bperf_follower_bpf__open();
>>> if (!evsel->follower_skel) {
>>> + err = -1;
>>> pr_err("Failed to open follower skeleton\n");
>>> goto out;
>>> }
>>> --
>>> 2.25.4
>>>
>>
>> --
>>
>> - Arnaldo
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-02 1:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 8:12 [PATCH] perf stat: Fix error return code in bperf__load() Yu Kuai
2021-05-29 9:10 ` yukuai (C)
2021-06-01 13:52 ` Arnaldo Carvalho de Melo
2021-06-01 13:55 ` Arnaldo Carvalho de Melo
2021-06-02 1:05 ` yukuai (C)
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).