* [PATCH] perf bpf-filter: Return -1 directly when pfi allocation fails
@ 2024-11-12 2:28 Hao Ge
2024-11-12 16:58 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Hao Ge @ 2024-11-12 2:28 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang
Cc: linux-perf-users, linux-kernel, bpf, hao.ge, Hao Ge
From: Hao Ge <gehao@kylinos.cn>
Directly return -1 when pfi allocation fails,
instead of performing other operations on pfi.
Fixes: 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
tools/perf/util/bpf-filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c
index e87b6789eb9e..34c8bf7e469e 100644
--- a/tools/perf/util/bpf-filter.c
+++ b/tools/perf/util/bpf-filter.c
@@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en
pfi = zalloc(sizeof(*pfi));
if (pfi == NULL) {
pr_err("Cannot save pinned filter index\n");
- goto err;
+ return -1;
}
pfi->evsel = evsel;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf bpf-filter: Return -1 directly when pfi allocation fails
2024-11-12 2:28 [PATCH] perf bpf-filter: Return -1 directly when pfi allocation fails Hao Ge
@ 2024-11-12 16:58 ` Arnaldo Carvalho de Melo
2024-11-13 3:05 ` [PATCH v2] perf bpf-filter: Return -ENOMEM " Hao Ge
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-11-12 16:58 UTC (permalink / raw)
To: Hao Ge
Cc: peterz, mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, kan.liang, linux-perf-users, linux-kernel,
bpf, Hao Ge
On Tue, Nov 12, 2024 at 10:28:15AM +0800, Hao Ge wrote:
> From: Hao Ge <gehao@kylinos.cn>
>
> Directly return -1 when pfi allocation fails,
The convention for this function is to return -errno, so please resubmit
returning -ENOMEM.
- Arnaldo
> instead of performing other operations on pfi.
>
> Fixes: 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
> tools/perf/util/bpf-filter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c
> index e87b6789eb9e..34c8bf7e469e 100644
> --- a/tools/perf/util/bpf-filter.c
> +++ b/tools/perf/util/bpf-filter.c
> @@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en
> pfi = zalloc(sizeof(*pfi));
> if (pfi == NULL) {
> pr_err("Cannot save pinned filter index\n");
> - goto err;
> + return -1;
> }
>
> pfi->evsel = evsel;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] perf bpf-filter: Return -ENOMEM directly when pfi allocation fails
2024-11-12 16:58 ` Arnaldo Carvalho de Melo
@ 2024-11-13 3:05 ` Hao Ge
2024-11-19 0:08 ` Namhyung Kim
2024-11-22 22:17 ` Namhyung Kim
0 siblings, 2 replies; 5+ messages in thread
From: Hao Ge @ 2024-11-13 3:05 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang
Cc: linux-perf-users, linux-kernel, bpf, hao.ge, Hao Ge
From: Hao Ge <gehao@kylinos.cn>
Directly return -ENOMEM when pfi allocation fails,
instead of performing other operations on pfi.
Fixes: 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
v2: Replace -1 with -ENOMEM as per Arnaldo's reminder.
Update title and commit message due to code change
---
tools/perf/util/bpf-filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c
index e87b6789eb9e..a4fdf6911ec1 100644
--- a/tools/perf/util/bpf-filter.c
+++ b/tools/perf/util/bpf-filter.c
@@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en
pfi = zalloc(sizeof(*pfi));
if (pfi == NULL) {
pr_err("Cannot save pinned filter index\n");
- goto err;
+ return -ENOMEM;
}
pfi->evsel = evsel;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] perf bpf-filter: Return -ENOMEM directly when pfi allocation fails
2024-11-13 3:05 ` [PATCH v2] perf bpf-filter: Return -ENOMEM " Hao Ge
@ 2024-11-19 0:08 ` Namhyung Kim
2024-11-22 22:17 ` Namhyung Kim
1 sibling, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2024-11-19 0:08 UTC (permalink / raw)
To: Hao Ge
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, kan.liang, linux-perf-users, linux-kernel,
bpf, Hao Ge
On Wed, Nov 13, 2024 at 11:05:37AM +0800, Hao Ge wrote:
> From: Hao Ge <gehao@kylinos.cn>
>
> Directly return -ENOMEM when pfi allocation fails,
> instead of performing other operations on pfi.
>
> Fixes: 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> v2: Replace -1 with -ENOMEM as per Arnaldo's reminder.
> Update title and commit message due to code change
> ---
> tools/perf/util/bpf-filter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c
> index e87b6789eb9e..a4fdf6911ec1 100644
> --- a/tools/perf/util/bpf-filter.c
> +++ b/tools/perf/util/bpf-filter.c
> @@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en
> pfi = zalloc(sizeof(*pfi));
> if (pfi == NULL) {
> pr_err("Cannot save pinned filter index\n");
> - goto err;
> + return -ENOMEM;
> }
>
> pfi->evsel = evsel;
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] perf bpf-filter: Return -ENOMEM directly when pfi allocation fails
2024-11-13 3:05 ` [PATCH v2] perf bpf-filter: Return -ENOMEM " Hao Ge
2024-11-19 0:08 ` Namhyung Kim
@ 2024-11-22 22:17 ` Namhyung Kim
1 sibling, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2024-11-22 22:17 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, kan.liang, Hao Ge
Cc: linux-perf-users, linux-kernel, bpf, Hao Ge
On Wed, 13 Nov 2024 11:05:37 +0800, Hao Ge wrote:
> Directly return -ENOMEM when pfi allocation fails,
> instead of performing other operations on pfi.
>
>
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-22 22:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 2:28 [PATCH] perf bpf-filter: Return -1 directly when pfi allocation fails Hao Ge
2024-11-12 16:58 ` Arnaldo Carvalho de Melo
2024-11-13 3:05 ` [PATCH v2] perf bpf-filter: Return -ENOMEM " Hao Ge
2024-11-19 0:08 ` Namhyung Kim
2024-11-22 22:17 ` Namhyung Kim
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).