* [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs
@ 2022-02-12 7:30 Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 1/2] perf: Stop using deprecated bpf_load_program() API Andrii Nakryiko
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-02-12 7:30 UTC (permalink / raw)
To: bpf, ast, daniel; +Cc: andrii, kernel-team
libbpf's bpf_prog_load() and bpf__object_next() APIs are deprecated.
remove perf's usage of these deprecated functions. After this patch
set, the only remaining libbpf deprecated APIs in perf would be
bpf_program__set_prep() and bpf_program__nth_fd().
v4 -> v5:
- add bpf_perf_object__add() and use it where appropriate (Jiri);
- use __maybe_unused in first patch;
v3 -> v4:
- Fixed commit title
- Added weak definition for deprecated function
v2 -> v3:
- Fixed commit message to use upstream perf
v1 -> v2:
- Added missing commit message
- Added more details to commit message and added steps to reproduce
original test case.
Christy Lee (2):
perf: Stop using deprecated bpf_load_program() API
perf: Stop using deprecated bpf_object__next() API
tools/perf/tests/bpf.c | 14 ++----
tools/perf/util/bpf-event.c | 13 +++++
tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
3 files changed, 96 insertions(+), 29 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v5 bpf-next 1/2] perf: Stop using deprecated bpf_load_program() API
2022-02-12 7:30 [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Andrii Nakryiko
@ 2022-02-12 7:30 ` Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 2/2] perf: Stop using deprecated bpf_object__next() API Andrii Nakryiko
2022-02-12 15:34 ` [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Arnaldo Carvalho de Melo
2 siblings, 0 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-02-12 7:30 UTC (permalink / raw)
To: bpf, ast, daniel; +Cc: andrii, kernel-team, Christy Lee
From: Christy Lee <christylee@fb.com>
bpf_load_program() API is deprecated, remove perf's usage of the
deprecated function. Add a __weak function declaration for libbpf
version compatibility.
Signed-off-by: Christy Lee <christylee@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/perf/tests/bpf.c | 14 ++++----------
tools/perf/util/bpf-event.c | 13 +++++++++++++
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 573490530194..57b9591f7cbb 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -281,8 +281,8 @@ static int __test__bpf(int idx)
static int check_env(void)
{
+ LIBBPF_OPTS(bpf_prog_load_opts, opts);
int err;
- unsigned int kver_int;
char license[] = "GPL";
struct bpf_insn insns[] = {
@@ -290,19 +290,13 @@ static int check_env(void)
BPF_EXIT_INSN(),
};
- err = fetch_kernel_version(&kver_int, NULL, 0);
+ err = fetch_kernel_version(&opts.kern_version, NULL, 0);
if (err) {
pr_debug("Unable to get kernel version\n");
return err;
}
-
-/* temporarily disable libbpf deprecation warnings */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- err = bpf_load_program(BPF_PROG_TYPE_KPROBE, insns,
- ARRAY_SIZE(insns),
- license, kver_int, NULL, 0);
-#pragma GCC diagnostic pop
+ err = bpf_prog_load(BPF_PROG_TYPE_KPROBE, NULL, license, insns,
+ ARRAY_SIZE(insns), &opts);
if (err < 0) {
pr_err("Missing basic BPF support, skip this test: %s\n",
strerror(errno));
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index a517eaa51eb3..bd1bc3c86cac 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -33,6 +33,19 @@ struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
return err ? ERR_PTR(err) : btf;
}
+int __weak bpf_prog_load(enum bpf_prog_type prog_type,
+ const char *prog_name __maybe_unused,
+ const char *license,
+ const struct bpf_insn *insns, size_t insn_cnt,
+ const struct bpf_prog_load_opts *opts)
+{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ return bpf_load_program(prog_type, insns, insn_cnt, license,
+ opts->kern_version, opts->log_buf, opts->log_size);
+#pragma GCC diagnostic pop
+}
+
struct bpf_program * __weak
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
{
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v5 bpf-next 2/2] perf: Stop using deprecated bpf_object__next() API
2022-02-12 7:30 [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 1/2] perf: Stop using deprecated bpf_load_program() API Andrii Nakryiko
@ 2022-02-12 7:30 ` Andrii Nakryiko
2022-02-12 15:34 ` [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Arnaldo Carvalho de Melo
2 siblings, 0 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-02-12 7:30 UTC (permalink / raw)
To: bpf, ast, daniel; +Cc: andrii, kernel-team, Christy Lee, Song Liu, Jiri Olsa
From: Christy Lee <christylee@fb.com>
Libbpf has deprecated the ability to keep track of object list inside
libbpf, it now requires applications to track usage multiple bpf
objects directly. Remove usage of bpf_object__next() API and hoist the
tracking logic to perf.
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Christy Lee <christylee@fb.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
1 file changed, 79 insertions(+), 19 deletions(-)
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 3cd5ae200f2c..7ff556ef1137 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -49,8 +49,52 @@ struct bpf_prog_priv {
int *type_mapping;
};
+struct bpf_perf_object {
+ struct list_head list;
+ struct bpf_object *obj;
+};
+
+static LIST_HEAD(bpf_objects_list);
+
+static struct bpf_perf_object *
+bpf_perf_object__next(struct bpf_perf_object *prev)
+{
+ struct bpf_perf_object *next;
+
+ if (!prev)
+ next = list_first_entry(&bpf_objects_list,
+ struct bpf_perf_object,
+ list);
+ else
+ next = list_next_entry(prev, list);
+
+ /* Empty list is noticed here so don't need checking on entry. */
+ if (&next->list == &bpf_objects_list)
+ return NULL;
+
+ return next;
+}
+
+#define bpf_perf_object__for_each(perf_obj, tmp) \
+ for ((perf_obj) = bpf_perf_object__next(NULL), \
+ (tmp) = bpf_perf_object__next(perf_obj); \
+ (perf_obj) != NULL; \
+ (perf_obj) = (tmp), (tmp) = bpf_perf_object__next(tmp))
+
static bool libbpf_initialized;
+static int bpf_perf_object__add(struct bpf_object *obj)
+{
+ struct bpf_perf_object *perf_obj = zalloc(sizeof(*perf_obj));
+
+ if (perf_obj) {
+ INIT_LIST_HEAD(&perf_obj->list);
+ perf_obj->obj = obj;
+ list_add_tail(&perf_obj->list, &bpf_objects_list);
+ }
+ return perf_obj ? 0 : -ENOMEM;
+}
+
struct bpf_object *
bpf__prepare_load_buffer(void *obj_buf, size_t obj_buf_sz, const char *name)
{
@@ -68,9 +112,21 @@ bpf__prepare_load_buffer(void *obj_buf, size_t obj_buf_sz, const char *name)
return ERR_PTR(-EINVAL);
}
+ if (bpf_perf_object__add(obj)) {
+ bpf_object__close(obj);
+ return ERR_PTR(-ENOMEM);
+ }
+
return obj;
}
+static void bpf_perf_object__close(struct bpf_perf_object *perf_obj)
+{
+ list_del(&perf_obj->list);
+ bpf_object__close(perf_obj->obj);
+ free(perf_obj);
+}
+
struct bpf_object *bpf__prepare_load(const char *filename, bool source)
{
LIBBPF_OPTS(bpf_object_open_opts, opts, .object_name = filename);
@@ -102,24 +158,30 @@ struct bpf_object *bpf__prepare_load(const char *filename, bool source)
llvm__dump_obj(filename, obj_buf, obj_buf_sz);
free(obj_buf);
- } else
+ } else {
obj = bpf_object__open(filename);
+ }
if (IS_ERR_OR_NULL(obj)) {
pr_debug("bpf: failed to load %s\n", filename);
return obj;
}
+ if (bpf_perf_object__add(obj)) {
+ bpf_object__close(obj);
+ return ERR_PTR(-BPF_LOADER_ERRNO__COMPILE);
+ }
+
return obj;
}
void bpf__clear(void)
{
- struct bpf_object *obj, *tmp;
+ struct bpf_perf_object *perf_obj, *tmp;
- bpf_object__for_each_safe(obj, tmp) {
- bpf__unprobe(obj);
- bpf_object__close(obj);
+ bpf_perf_object__for_each(perf_obj, tmp) {
+ bpf__unprobe(perf_obj->obj);
+ bpf_perf_object__close(perf_obj);
}
}
@@ -1493,11 +1555,11 @@ apply_obj_config_object(struct bpf_object *obj)
int bpf__apply_obj_config(void)
{
- struct bpf_object *obj, *tmp;
+ struct bpf_perf_object *perf_obj, *tmp;
int err;
- bpf_object__for_each_safe(obj, tmp) {
- err = apply_obj_config_object(obj);
+ bpf_perf_object__for_each(perf_obj, tmp) {
+ err = apply_obj_config_object(perf_obj->obj);
if (err)
return err;
}
@@ -1505,26 +1567,24 @@ int bpf__apply_obj_config(void)
return 0;
}
-#define bpf__for_each_map(pos, obj, objtmp) \
- bpf_object__for_each_safe(obj, objtmp) \
- bpf_object__for_each_map(pos, obj)
+#define bpf__perf_for_each_map(map, pobj, tmp) \
+ bpf_perf_object__for_each(pobj, tmp) \
+ bpf_object__for_each_map(map, pobj->obj)
-#define bpf__for_each_map_named(pos, obj, objtmp, name) \
- bpf__for_each_map(pos, obj, objtmp) \
- if (bpf_map__name(pos) && \
- (strcmp(name, \
- bpf_map__name(pos)) == 0))
+#define bpf__perf_for_each_map_named(map, pobj, pobjtmp, name) \
+ bpf__perf_for_each_map(map, pobj, pobjtmp) \
+ if (bpf_map__name(map) && (strcmp(name, bpf_map__name(map)) == 0))
struct evsel *bpf__setup_output_event(struct evlist *evlist, const char *name)
{
struct bpf_map_priv *tmpl_priv = NULL;
- struct bpf_object *obj, *tmp;
+ struct bpf_perf_object *perf_obj, *tmp;
struct evsel *evsel = NULL;
struct bpf_map *map;
int err;
bool need_init = false;
- bpf__for_each_map_named(map, obj, tmp, name) {
+ bpf__perf_for_each_map_named(map, perf_obj, tmp, name) {
struct bpf_map_priv *priv = bpf_map__priv(map);
if (IS_ERR(priv))
@@ -1560,7 +1620,7 @@ struct evsel *bpf__setup_output_event(struct evlist *evlist, const char *name)
evsel = evlist__last(evlist);
}
- bpf__for_each_map_named(map, obj, tmp, name) {
+ bpf__perf_for_each_map_named(map, perf_obj, tmp, name) {
struct bpf_map_priv *priv = bpf_map__priv(map);
if (IS_ERR(priv))
--
2.30.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs
2022-02-12 7:30 [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 1/2] perf: Stop using deprecated bpf_load_program() API Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 2/2] perf: Stop using deprecated bpf_object__next() API Andrii Nakryiko
@ 2022-02-12 15:34 ` Arnaldo Carvalho de Melo
2022-02-12 15:36 ` Arnaldo Carvalho de Melo
2 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-02-12 15:34 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, ast, daniel, kernel-team
Em Fri, Feb 11, 2022 at 11:30:52PM -0800, Andrii Nakryiko escreveu:
> libbpf's bpf_prog_load() and bpf__object_next() APIs are deprecated.
> remove perf's usage of these deprecated functions. After this patch
> set, the only remaining libbpf deprecated APIs in perf would be
> bpf_program__set_prep() and bpf_program__nth_fd().
Not applying to perf/core, I'm checking...
⬢[acme@toolbox perf]$ b4 am -ctsl --cc-trailers 20220212073054.1052880-1-andrii@kernel.org
Looking up https://lore.kernel.org/r/20220212073054.1052880-1-andrii%40kernel.org
Grabbing thread from lore.kernel.org/all/20220212073054.1052880-1-andrii%40kernel.org/t.mbox.gz
Checking for newer revisions on https://lore.kernel.org/all/
Analyzing 3 messages in the thread
Checking attestation on all messages, may take a moment...
---
[PATCH v5 1/2] perf: Stop using deprecated bpf_load_program() API
+ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+ Link: https://lore.kernel.org/r/20220212073054.1052880-2-andrii@kernel.org
+ Cc: kernel-team@fb.com
+ Cc: daniel@iogearbox.net
+ Cc: ast@kernel.org
+ Cc: bpf@vger.kernel.org
[PATCH v5 2/2] perf: Stop using deprecated bpf_object__next() API
+ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+ Link: https://lore.kernel.org/r/20220212073054.1052880-3-andrii@kernel.org
+ Cc: kernel-team@fb.com
+ Cc: daniel@iogearbox.net
+ Cc: ast@kernel.org
+ Cc: bpf@vger.kernel.org
---
Total patches: 2
---
Cover: ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.cover
Link: https://lore.kernel.org/r/20220212073054.1052880-1-andrii@kernel.org
Base: not specified
git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
⬢[acme@toolbox perf]$ git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
Applying: perf: Stop using deprecated bpf_load_program() API
Applying: perf: Stop using deprecated bpf_object__next() API
error: patch failed: tools/perf/util/bpf-loader.c:68
error: tools/perf/util/bpf-loader.c: patch does not apply
Patch failed at 0002 perf: Stop using deprecated bpf_object__next() API
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
- Arnaldo
> v4 -> v5:
> - add bpf_perf_object__add() and use it where appropriate (Jiri);
> - use __maybe_unused in first patch;
> v3 -> v4:
> - Fixed commit title
> - Added weak definition for deprecated function
> v2 -> v3:
> - Fixed commit message to use upstream perf
> v1 -> v2:
> - Added missing commit message
> - Added more details to commit message and added steps to reproduce
> original test case.
>
> Christy Lee (2):
> perf: Stop using deprecated bpf_load_program() API
> perf: Stop using deprecated bpf_object__next() API
>
> tools/perf/tests/bpf.c | 14 ++----
> tools/perf/util/bpf-event.c | 13 +++++
> tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
> 3 files changed, 96 insertions(+), 29 deletions(-)
>
> --
> 2.30.2
--
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs
2022-02-12 15:34 ` [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Arnaldo Carvalho de Melo
@ 2022-02-12 15:36 ` Arnaldo Carvalho de Melo
2022-02-12 15:47 ` Andrii Nakryiko
2022-02-12 15:53 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-02-12 15:36 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, ast, daniel, kernel-team
Em Sat, Feb 12, 2022 at 12:34:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Feb 11, 2022 at 11:30:52PM -0800, Andrii Nakryiko escreveu:
> > libbpf's bpf_prog_load() and bpf__object_next() APIs are deprecated.
> > remove perf's usage of these deprecated functions. After this patch
> > set, the only remaining libbpf deprecated APIs in perf would be
> > bpf_program__set_prep() and bpf_program__nth_fd().
>
> Not applying to perf/core, I'm checking...
Just some fuzz on the second patch:
⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
patching file tools/perf/util/bpf-loader.c
Hunk #2 succeeded at 111 with fuzz 1 (offset -1 lines).
Hunk #3 succeeded at 156 (offset -2 lines).
Hunk #4 succeeded at 1563 (offset 8 lines).
Hunk #5 succeeded at 1575 (offset 8 lines).
Hunk #6 succeeded at 1628 (offset 8 lines).
⬢[acme@toolbox perf]$
Applying manually to test on the set of test build containers.
- Arnaldo
> ⬢[acme@toolbox perf]$ b4 am -ctsl --cc-trailers 20220212073054.1052880-1-andrii@kernel.org
> Looking up https://lore.kernel.org/r/20220212073054.1052880-1-andrii%40kernel.org
> Grabbing thread from lore.kernel.org/all/20220212073054.1052880-1-andrii%40kernel.org/t.mbox.gz
> Checking for newer revisions on https://lore.kernel.org/all/
> Analyzing 3 messages in the thread
> Checking attestation on all messages, may take a moment...
> ---
> [PATCH v5 1/2] perf: Stop using deprecated bpf_load_program() API
> + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> + Link: https://lore.kernel.org/r/20220212073054.1052880-2-andrii@kernel.org
> + Cc: kernel-team@fb.com
> + Cc: daniel@iogearbox.net
> + Cc: ast@kernel.org
> + Cc: bpf@vger.kernel.org
> [PATCH v5 2/2] perf: Stop using deprecated bpf_object__next() API
> + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> + Link: https://lore.kernel.org/r/20220212073054.1052880-3-andrii@kernel.org
> + Cc: kernel-team@fb.com
> + Cc: daniel@iogearbox.net
> + Cc: ast@kernel.org
> + Cc: bpf@vger.kernel.org
> ---
> Total patches: 2
> ---
> Cover: ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.cover
> Link: https://lore.kernel.org/r/20220212073054.1052880-1-andrii@kernel.org
> Base: not specified
> git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> ⬢[acme@toolbox perf]$ git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> Applying: perf: Stop using deprecated bpf_load_program() API
> Applying: perf: Stop using deprecated bpf_object__next() API
> error: patch failed: tools/perf/util/bpf-loader.c:68
> error: tools/perf/util/bpf-loader.c: patch does not apply
> Patch failed at 0002 perf: Stop using deprecated bpf_object__next() API
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>
>
> - Arnaldo
>
> > v4 -> v5:
> > - add bpf_perf_object__add() and use it where appropriate (Jiri);
> > - use __maybe_unused in first patch;
> > v3 -> v4:
> > - Fixed commit title
> > - Added weak definition for deprecated function
> > v2 -> v3:
> > - Fixed commit message to use upstream perf
> > v1 -> v2:
> > - Added missing commit message
> > - Added more details to commit message and added steps to reproduce
> > original test case.
> >
> > Christy Lee (2):
> > perf: Stop using deprecated bpf_load_program() API
> > perf: Stop using deprecated bpf_object__next() API
> >
> > tools/perf/tests/bpf.c | 14 ++----
> > tools/perf/util/bpf-event.c | 13 +++++
> > tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
> > 3 files changed, 96 insertions(+), 29 deletions(-)
> >
> > --
> > 2.30.2
>
> --
>
> - Arnaldo
--
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs
2022-02-12 15:36 ` Arnaldo Carvalho de Melo
@ 2022-02-12 15:47 ` Andrii Nakryiko
2022-02-12 15:53 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-02-12 15:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Andrii Nakryiko, bpf, Alexei Starovoitov, Daniel Borkmann, Kernel Team
On Sat, Feb 12, 2022 at 7:36 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Sat, Feb 12, 2022 at 12:34:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Feb 11, 2022 at 11:30:52PM -0800, Andrii Nakryiko escreveu:
> > > libbpf's bpf_prog_load() and bpf__object_next() APIs are deprecated.
> > > remove perf's usage of these deprecated functions. After this patch
> > > set, the only remaining libbpf deprecated APIs in perf would be
> > > bpf_program__set_prep() and bpf_program__nth_fd().
> >
> > Not applying to perf/core, I'm checking...
>
> Just some fuzz on the second patch:
>
> ⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
> patching file tools/perf/util/bpf-loader.c
> Hunk #2 succeeded at 111 with fuzz 1 (offset -1 lines).
> Hunk #3 succeeded at 156 (offset -2 lines).
> Hunk #4 succeeded at 1563 (offset 8 lines).
> Hunk #5 succeeded at 1575 (offset 8 lines).
> Hunk #6 succeeded at 1628 (offset 8 lines).
> ⬢[acme@toolbox perf]$
>
> Applying manually to test on the set of test build containers.
Sorry, my bad. I just followed my typical bpf-next routine and didn't
even think twice before basing everything off bpf-next. You can see I
didn't even CC you or linux-perf-users@vger.kernel.org. :(
I'll resend v6 against perf/core.
>
> - Arnaldo
>
> > ⬢[acme@toolbox perf]$ b4 am -ctsl --cc-trailers 20220212073054.1052880-1-andrii@kernel.org
> > Looking up https://lore.kernel.org/r/20220212073054.1052880-1-andrii%40kernel.org
> > Grabbing thread from lore.kernel.org/all/20220212073054.1052880-1-andrii%40kernel.org/t.mbox.gz
> > Checking for newer revisions on https://lore.kernel.org/all/
> > Analyzing 3 messages in the thread
> > Checking attestation on all messages, may take a moment...
> > ---
> > [PATCH v5 1/2] perf: Stop using deprecated bpf_load_program() API
> > + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > + Link: https://lore.kernel.org/r/20220212073054.1052880-2-andrii@kernel.org
> > + Cc: kernel-team@fb.com
> > + Cc: daniel@iogearbox.net
> > + Cc: ast@kernel.org
> > + Cc: bpf@vger.kernel.org
> > [PATCH v5 2/2] perf: Stop using deprecated bpf_object__next() API
> > + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > + Link: https://lore.kernel.org/r/20220212073054.1052880-3-andrii@kernel.org
> > + Cc: kernel-team@fb.com
> > + Cc: daniel@iogearbox.net
> > + Cc: ast@kernel.org
> > + Cc: bpf@vger.kernel.org
> > ---
> > Total patches: 2
> > ---
> > Cover: ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.cover
> > Link: https://lore.kernel.org/r/20220212073054.1052880-1-andrii@kernel.org
> > Base: not specified
> > git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> > ⬢[acme@toolbox perf]$ git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> > Applying: perf: Stop using deprecated bpf_load_program() API
> > Applying: perf: Stop using deprecated bpf_object__next() API
> > error: patch failed: tools/perf/util/bpf-loader.c:68
> > error: tools/perf/util/bpf-loader.c: patch does not apply
> > Patch failed at 0002 perf: Stop using deprecated bpf_object__next() API
> > hint: Use 'git am --show-current-patch=diff' to see the failed patch
> > When you have resolved this problem, run "git am --continue".
> > If you prefer to skip this patch, run "git am --skip" instead.
> > To restore the original branch and stop patching, run "git am --abort".
> >
> >
> > - Arnaldo
> >
> > > v4 -> v5:
> > > - add bpf_perf_object__add() and use it where appropriate (Jiri);
> > > - use __maybe_unused in first patch;
> > > v3 -> v4:
> > > - Fixed commit title
> > > - Added weak definition for deprecated function
> > > v2 -> v3:
> > > - Fixed commit message to use upstream perf
> > > v1 -> v2:
> > > - Added missing commit message
> > > - Added more details to commit message and added steps to reproduce
> > > original test case.
> > >
> > > Christy Lee (2):
> > > perf: Stop using deprecated bpf_load_program() API
> > > perf: Stop using deprecated bpf_object__next() API
> > >
> > > tools/perf/tests/bpf.c | 14 ++----
> > > tools/perf/util/bpf-event.c | 13 +++++
> > > tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
> > > 3 files changed, 96 insertions(+), 29 deletions(-)
> > >
> > > --
> > > 2.30.2
> >
> > --
> >
> > - Arnaldo
>
> --
>
> - Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs
2022-02-12 15:36 ` Arnaldo Carvalho de Melo
2022-02-12 15:47 ` Andrii Nakryiko
@ 2022-02-12 15:53 ` Arnaldo Carvalho de Melo
2022-02-12 15:54 ` Andrii Nakryiko
1 sibling, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-02-12 15:53 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: Jiri Olsa, Christy Lee, bpf, ast, daniel, kernel-team
Em Sat, Feb 12, 2022 at 12:36:49PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Feb 12, 2022 at 12:34:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Feb 11, 2022 at 11:30:52PM -0800, Andrii Nakryiko escreveu:
> > > libbpf's bpf_prog_load() and bpf__object_next() APIs are deprecated.
> > > remove perf's usage of these deprecated functions. After this patch
> > > set, the only remaining libbpf deprecated APIs in perf would be
> > > bpf_program__set_prep() and bpf_program__nth_fd().
> >
> > Not applying to perf/core, I'm checking...
>
> Just some fuzz on the second patch:
>
> ⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
> patching file tools/perf/util/bpf-loader.c
> Hunk #2 succeeded at 111 with fuzz 1 (offset -1 lines).
> Hunk #3 succeeded at 156 (offset -2 lines).
> Hunk #4 succeeded at 1563 (offset 8 lines).
> Hunk #5 succeeded at 1575 (offset 8 lines).
> Hunk #6 succeeded at 1628 (offset 8 lines).
> ⬢[acme@toolbox perf]$
>
> Applying manually to test on the set of test build containers.
perf test clean, these also work:
# perf trace -e tools/perf/examples/bpf/augmented_raw_syscalls.c sleep 1
[root@quaco perf]# perf trace -e tools/perf/examples/bpf/5sec.c sleep 5s
0.000 perf_bpf_probe:hrtimer_nanosleep(__probe_ip: -1994947936, rqtp: 5000000000)
[root@quaco perf]#
containers building:
[perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.17.0-rc3.tar.xz
[perfbuilder@five ~]$ time dm
1 164.81 almalinux:8 : Ok gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
2 90.60 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
3 55.88 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
4 58.69 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
5 65.65 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
6 69.85 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
7 66.83 alpine:3.9 : Ok gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
8: alpine:3.10
I don't expect problems with those, so probably later today I'll push it
to perf/core so that it will be on its way t 5.18.
- Arnaldo
>
> > ⬢[acme@toolbox perf]$ b4 am -ctsl --cc-trailers 20220212073054.1052880-1-andrii@kernel.org
> > Looking up https://lore.kernel.org/r/20220212073054.1052880-1-andrii%40kernel.org
> > Grabbing thread from lore.kernel.org/all/20220212073054.1052880-1-andrii%40kernel.org/t.mbox.gz
> > Checking for newer revisions on https://lore.kernel.org/all/
> > Analyzing 3 messages in the thread
> > Checking attestation on all messages, may take a moment...
> > ---
> > [PATCH v5 1/2] perf: Stop using deprecated bpf_load_program() API
> > + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > + Link: https://lore.kernel.org/r/20220212073054.1052880-2-andrii@kernel.org
> > + Cc: kernel-team@fb.com
> > + Cc: daniel@iogearbox.net
> > + Cc: ast@kernel.org
> > + Cc: bpf@vger.kernel.org
> > [PATCH v5 2/2] perf: Stop using deprecated bpf_object__next() API
> > + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > + Link: https://lore.kernel.org/r/20220212073054.1052880-3-andrii@kernel.org
> > + Cc: kernel-team@fb.com
> > + Cc: daniel@iogearbox.net
> > + Cc: ast@kernel.org
> > + Cc: bpf@vger.kernel.org
> > ---
> > Total patches: 2
> > ---
> > Cover: ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.cover
> > Link: https://lore.kernel.org/r/20220212073054.1052880-1-andrii@kernel.org
> > Base: not specified
> > git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> > ⬢[acme@toolbox perf]$ git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> > Applying: perf: Stop using deprecated bpf_load_program() API
> > Applying: perf: Stop using deprecated bpf_object__next() API
> > error: patch failed: tools/perf/util/bpf-loader.c:68
> > error: tools/perf/util/bpf-loader.c: patch does not apply
> > Patch failed at 0002 perf: Stop using deprecated bpf_object__next() API
> > hint: Use 'git am --show-current-patch=diff' to see the failed patch
> > When you have resolved this problem, run "git am --continue".
> > If you prefer to skip this patch, run "git am --skip" instead.
> > To restore the original branch and stop patching, run "git am --abort".
> >
> >
> > - Arnaldo
> >
> > > v4 -> v5:
> > > - add bpf_perf_object__add() and use it where appropriate (Jiri);
> > > - use __maybe_unused in first patch;
> > > v3 -> v4:
> > > - Fixed commit title
> > > - Added weak definition for deprecated function
> > > v2 -> v3:
> > > - Fixed commit message to use upstream perf
> > > v1 -> v2:
> > > - Added missing commit message
> > > - Added more details to commit message and added steps to reproduce
> > > original test case.
> > >
> > > Christy Lee (2):
> > > perf: Stop using deprecated bpf_load_program() API
> > > perf: Stop using deprecated bpf_object__next() API
> > >
> > > tools/perf/tests/bpf.c | 14 ++----
> > > tools/perf/util/bpf-event.c | 13 +++++
> > > tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
> > > 3 files changed, 96 insertions(+), 29 deletions(-)
> > >
> > > --
> > > 2.30.2
> >
> > --
> >
> > - Arnaldo
>
> --
>
> - Arnaldo
--
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs
2022-02-12 15:53 ` Arnaldo Carvalho de Melo
@ 2022-02-12 15:54 ` Andrii Nakryiko
0 siblings, 0 replies; 8+ messages in thread
From: Andrii Nakryiko @ 2022-02-12 15:54 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Andrii Nakryiko, Jiri Olsa, Christy Lee, bpf, Alexei Starovoitov,
Daniel Borkmann, Kernel Team
On Sat, Feb 12, 2022 at 7:53 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Sat, Feb 12, 2022 at 12:36:49PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Sat, Feb 12, 2022 at 12:34:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Fri, Feb 11, 2022 at 11:30:52PM -0800, Andrii Nakryiko escreveu:
> > > > libbpf's bpf_prog_load() and bpf__object_next() APIs are deprecated.
> > > > remove perf's usage of these deprecated functions. After this patch
> > > > set, the only remaining libbpf deprecated APIs in perf would be
> > > > bpf_program__set_prep() and bpf_program__nth_fd().
> > >
> > > Not applying to perf/core, I'm checking...
> >
> > Just some fuzz on the second patch:
> >
> > ⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
> > patching file tools/perf/util/bpf-loader.c
> > Hunk #2 succeeded at 111 with fuzz 1 (offset -1 lines).
> > Hunk #3 succeeded at 156 (offset -2 lines).
> > Hunk #4 succeeded at 1563 (offset 8 lines).
> > Hunk #5 succeeded at 1575 (offset 8 lines).
> > Hunk #6 succeeded at 1628 (offset 8 lines).
> > ⬢[acme@toolbox perf]$
> >
> > Applying manually to test on the set of test build containers.
>
> perf test clean, these also work:
>
> # perf trace -e tools/perf/examples/bpf/augmented_raw_syscalls.c sleep 1
> [root@quaco perf]# perf trace -e tools/perf/examples/bpf/5sec.c sleep 5s
> 0.000 perf_bpf_probe:hrtimer_nanosleep(__probe_ip: -1994947936, rqtp: 5000000000)
> [root@quaco perf]#
>
> containers building:
>
> [perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.17.0-rc3.tar.xz
> [perfbuilder@five ~]$ time dm
> 1 164.81 almalinux:8 : Ok gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4) , clang version 12.0.1 (Red Hat 12.0.1-4.module_el8.5.0+1025+93159d6c)
> 2 90.60 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0 , clang version 3.8.0 (tags/RELEASE_380/final)
> 3 55.88 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822 , clang version 3.8.1 (tags/RELEASE_381/final)
> 4 58.69 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0 , clang version 4.0.0 (tags/RELEASE_400/final)
> 5 65.65 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
> 6 69.85 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0 , Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
> 7 66.83 alpine:3.9 : Ok gcc (Alpine 8.3.0) 8.3.0 , Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
> 8: alpine:3.10
>
> I don't expect problems with those, so probably later today I'll push it
> to perf/core so that it will be on its way t 5.18.
Great, thank you!
>
> - Arnaldo
> >
> > > ⬢[acme@toolbox perf]$ b4 am -ctsl --cc-trailers 20220212073054.1052880-1-andrii@kernel.org
> > > Looking up https://lore.kernel.org/r/20220212073054.1052880-1-andrii%40kernel.org
> > > Grabbing thread from lore.kernel.org/all/20220212073054.1052880-1-andrii%40kernel.org/t.mbox.gz
> > > Checking for newer revisions on https://lore.kernel.org/all/
> > > Analyzing 3 messages in the thread
> > > Checking attestation on all messages, may take a moment...
> > > ---
> > > [PATCH v5 1/2] perf: Stop using deprecated bpf_load_program() API
> > > + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > + Link: https://lore.kernel.org/r/20220212073054.1052880-2-andrii@kernel.org
> > > + Cc: kernel-team@fb.com
> > > + Cc: daniel@iogearbox.net
> > > + Cc: ast@kernel.org
> > > + Cc: bpf@vger.kernel.org
> > > [PATCH v5 2/2] perf: Stop using deprecated bpf_object__next() API
> > > + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > + Link: https://lore.kernel.org/r/20220212073054.1052880-3-andrii@kernel.org
> > > + Cc: kernel-team@fb.com
> > > + Cc: daniel@iogearbox.net
> > > + Cc: ast@kernel.org
> > > + Cc: bpf@vger.kernel.org
> > > ---
> > > Total patches: 2
> > > ---
> > > Cover: ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.cover
> > > Link: https://lore.kernel.org/r/20220212073054.1052880-1-andrii@kernel.org
> > > Base: not specified
> > > git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> > > ⬢[acme@toolbox perf]$ git am ./v5_20220211_andrii_perf_stop_using_deprecated_bpf_apis.mbx
> > > Applying: perf: Stop using deprecated bpf_load_program() API
> > > Applying: perf: Stop using deprecated bpf_object__next() API
> > > error: patch failed: tools/perf/util/bpf-loader.c:68
> > > error: tools/perf/util/bpf-loader.c: patch does not apply
> > > Patch failed at 0002 perf: Stop using deprecated bpf_object__next() API
> > > hint: Use 'git am --show-current-patch=diff' to see the failed patch
> > > When you have resolved this problem, run "git am --continue".
> > > If you prefer to skip this patch, run "git am --skip" instead.
> > > To restore the original branch and stop patching, run "git am --abort".
> > >
> > >
> > > - Arnaldo
> > >
> > > > v4 -> v5:
> > > > - add bpf_perf_object__add() and use it where appropriate (Jiri);
> > > > - use __maybe_unused in first patch;
> > > > v3 -> v4:
> > > > - Fixed commit title
> > > > - Added weak definition for deprecated function
> > > > v2 -> v3:
> > > > - Fixed commit message to use upstream perf
> > > > v1 -> v2:
> > > > - Added missing commit message
> > > > - Added more details to commit message and added steps to reproduce
> > > > original test case.
> > > >
> > > > Christy Lee (2):
> > > > perf: Stop using deprecated bpf_load_program() API
> > > > perf: Stop using deprecated bpf_object__next() API
> > > >
> > > > tools/perf/tests/bpf.c | 14 ++----
> > > > tools/perf/util/bpf-event.c | 13 +++++
> > > > tools/perf/util/bpf-loader.c | 98 +++++++++++++++++++++++++++++-------
> > > > 3 files changed, 96 insertions(+), 29 deletions(-)
> > > >
> > > > --
> > > > 2.30.2
> > >
> > > --
> > >
> > > - Arnaldo
> >
> > --
> >
> > - Arnaldo
>
> --
>
> - Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-02-12 15:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-12 7:30 [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 1/2] perf: Stop using deprecated bpf_load_program() API Andrii Nakryiko
2022-02-12 7:30 ` [PATCH v5 bpf-next 2/2] perf: Stop using deprecated bpf_object__next() API Andrii Nakryiko
2022-02-12 15:34 ` [PATCH v5 bpf-next 0/2] perf: stop using deprecated bpf APIs Arnaldo Carvalho de Melo
2022-02-12 15:36 ` Arnaldo Carvalho de Melo
2022-02-12 15:47 ` Andrii Nakryiko
2022-02-12 15:53 ` Arnaldo Carvalho de Melo
2022-02-12 15:54 ` Andrii Nakryiko
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).