Skip to contentSkip to conversation

perf tools: Do not use deprecated bpf_program__title

PATCH In review Jiri Olsa 4 participants 7 messages Sep 7, 2020 – Sep 9, 2020

Subsystems (4)
lore
Share & tools
lore
#1 lore raw
In reply to Jiri Olsa
Quoted 5 lines · Jiri Olsa

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")

Arnaldo,
the commit in 'Fixes' is not yet in your tree yet and the patch below will make the perf compilation fail in your perf/core..

it fixes perf compilation on top of bpf-next tree.. so I think it should go in through bpf-next tree

thanks,
jirka

Quoted 29 lines
---
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +2 -2
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
 	probe_conf.no_inlines = false;
 	probe_conf.force_add = false;
 
-	config_str = bpf_program__title(prog, false);
+	config_str = bpf_program__section_name(prog);
 	if (IS_ERR(config_str)) {
 		pr_debug("bpf: unable to get title for program\n");
 		return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
 	if (err) {
 		const char *title;
 
-		title = bpf_program__title(prog, false);
+		title = bpf_program__section_name(prog);
 		if (!title)
 			title = "[unknown]";
 
Signature · 1 line
2.26.2
#2 lore raw
Quoted 38 lines · Jiri Olsa
Quoted 5 lines · Jiri Olsa

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")

Arnaldo,
the commit in 'Fixes' is not yet in your tree yet and the patch below will make the perf compilation fail in your perf/core..

it fixes perf compilation on top of bpf-next tree.. so I think it should go in through bpf-next tree

thanks,
jirka

Quoted 21 lines
---
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +1 -1
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
 	probe_conf.no_inlines = false;
 	probe_conf.force_add = false;
 
-	config_str = bpf_program__title(prog, false);
+	config_str = bpf_program__section_name(prog);
 	if (IS_ERR(config_str)) {
 		pr_debug("bpf: unable to get title for program\n");
 		return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
 	if (err) {
 		const char *title;
 
Quoted 4 lines

tools/perf/util/bpf-loader.c preproc_gen_prologue(struct bpf_program *prog, int n, · line 459

Quoted 4 lines
tools/perf/util/bpf-loader.c +1 -1
-		title = bpf_program__title(prog, false);
+		title = bpf_program__section_name(prog);
 		if (!title)
 			title = "[unknown]";

I think bpf_program__title at line 457 in preproc_gen_prologue also needs to be changed given the following build failure:

util/bpf-loader.c: In function 'preproc_gen_prologue':
util/bpf-loader.c:457:3: error: 'bpf_program__title' is deprecated: BPF program title is confusing term; please use bpf_program__section_name() instead [-Werror=deprecated-declarations]

  457 |   title = bpf_program__title(prog, false);
      |   ^~~~~
In file included from util/bpf-loader.c:10:
/home/tklauser/src/linux/tools/lib/bpf/libbpf.h:203:13: note: declared here
  203 | const char *bpf_program__title(const struct bpf_program *prog, bool needs_copy);
      |             ^~~~~~~~~~~~~~~~~~
#3 lore raw
Quoted 39 lines · Tobias Klauser
Quoted 38 lines · Jiri Olsa
Quoted 5 lines · Jiri Olsa

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")

Arnaldo,
the commit in 'Fixes' is not yet in your tree yet and the patch below will make the perf compilation fail in your perf/core..

it fixes perf compilation on top of bpf-next tree.. so I think it should go in through bpf-next tree

thanks,
jirka

Quoted 21 lines
---
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +1 -1
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
 	probe_conf.no_inlines = false;
 	probe_conf.force_add = false;
 
-	config_str = bpf_program__title(prog, false);
+	config_str = bpf_program__section_name(prog);
 	if (IS_ERR(config_str)) {
 		pr_debug("bpf: unable to get title for program\n");
 		return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
 	if (err) {
 		const char *title;
 
Quoted 7 lines
Quoted 4 lines

tools/perf/util/bpf-loader.c preproc_gen_prologue(struct bpf_program *prog, int n, · line 459

Quoted 4 lines
tools/perf/util/bpf-loader.c +1 -1
-		title = bpf_program__title(prog, false);
+		title = bpf_program__section_name(prog);
 		if (!title)
 			title = "[unknown]";

I think bpf_program__title at line 457 in preproc_gen_prologue also needs to be changed given the following build failure:

hum, that's where the 2nd hunk, right? I dont see any other instance of bpf_program__title after the patch is applied

thanks,
jirka

Quoted 10 lines

util/bpf-loader.c: In function 'preproc_gen_prologue':
util/bpf-loader.c:457:3: error: 'bpf_program__title' is deprecated: BPF program title is confusing term; please use bpf_program__section_name() instead [-Werror=deprecated-declarations]

  457 |   title = bpf_program__title(prog, false);
      |   ^~~~~
In file included from util/bpf-loader.c:10:
/home/tklauser/src/linux/tools/lib/bpf/libbpf.h:203:13: note: declared here
  203 | const char *bpf_program__title(const struct bpf_program *prog, bool needs_copy);
      |             ^~~~~~~~~~~~~~~~~~
Reviewed-by
#4 lore raw
Quoted 48 lines · Jiri Olsa
Quoted 39 lines · Tobias Klauser
Quoted 38 lines · Jiri Olsa
Quoted 5 lines · Jiri Olsa

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")

Arnaldo,
the commit in 'Fixes' is not yet in your tree yet and the patch below will make the perf compilation fail in your perf/core..

it fixes perf compilation on top of bpf-next tree.. so I think it should go in through bpf-next tree

thanks,
jirka

Quoted 21 lines
---
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +1 -1
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
 	probe_conf.no_inlines = false;
 	probe_conf.force_add = false;
 
-	config_str = bpf_program__title(prog, false);
+	config_str = bpf_program__section_name(prog);
 	if (IS_ERR(config_str)) {
 		pr_debug("bpf: unable to get title for program\n");
 		return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
 	if (err) {
 		const char *title;
 
Quoted 7 lines
Quoted 4 lines

tools/perf/util/bpf-loader.c preproc_gen_prologue(struct bpf_program *prog, int n, · line 459

Quoted 4 lines
tools/perf/util/bpf-loader.c +1 -1
-		title = bpf_program__title(prog, false);
+		title = bpf_program__section_name(prog);
 		if (!title)
 			title = "[unknown]";

I think bpf_program__title at line 457 in preproc_gen_prologue also needs to be changed given the following build failure:

Quoted 2 lines

hum, that's where the 2nd hunk, right? I dont see any other instance of bpf_program__title after the patch is applied

Sorry for the noise, I didn't read the patch correctly. You're of course correct. I was confused because it is still assigned to variable title.

Thanks
Tobias

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf tools: Do not use deprecated bpf_program__title

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")
---
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +2 -2
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
 	probe_conf.no_inlines = false;
 	probe_conf.force_add = false;
 
-	config_str = bpf_program__title(prog, false);
+	config_str = bpf_program__section_name(prog);
 	if (IS_ERR(config_str)) {
 		pr_debug("bpf: unable to get title for program\n");
 		return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
 	if (err) {
 		const char *title;
 
-		title = bpf_program__title(prog, false);
+		title = bpf_program__section_name(prog);
 		if (!title)
 			title = "[unknown]";
 
Signature · 1 line
2.26.2
#5 lore raw
Quoted 7 lines · Jiri Olsa

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")

---

Hey Jiri,

Didn't see your patch before I sent mine against bpf-next. I also removed some unnecessary checks there. Please see [0]. I don't care which one gets applied, btw.

[0] https://patchwork.ozlabs.org/project/netdev/patch/[email protected]/

Quoted 28 lines
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +2 -3
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
        probe_conf.no_inlines = false;
        probe_conf.force_add = false;
 
-       config_str = bpf_program__title(prog, false);
+       config_str = bpf_program__section_name(prog);
        if (IS_ERR(config_str)) {
                pr_debug("bpf: unable to get title for program\n");
                return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
        if (err) {
                const char *title;
 
-               title = bpf_program__title(prog, false);
+               title = bpf_program__section_name(prog);
                if (!title)
                        title = "[unknown]";
 
--

2.26.2

#6 lore raw
Quoted 9 lines · Andrii Nakryiko
Quoted 7 lines · Jiri Olsa

The bpf_program__title function got deprecated in libbpf, use the suggested alternative.

Fixes 521095842027 ("libbpf: Deprecate notion of BPF program "title" in favor of "section name"")

---

Quoted 7 lines

Hey Jiri,

Didn't see your patch before I sent mine against bpf-next. I also removed some unnecessary checks there. Please see [0]. I don't care which one gets applied, btw.

[0] https://patchwork.ozlabs.org/project/netdev/patch/[email protected]/

perfect, let's take yours with that extra check removed

thanks,
jirka

Quoted 30 lines
Quoted 29 lines
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-loader.c +2 -3
index 2feb751516ab..73de3973c8ec 100644
@@ -328,7 +328,7 @@ config_bpf_program(struct bpf_program *prog)
        probe_conf.no_inlines = false;
        probe_conf.force_add = false;
 
-       config_str = bpf_program__title(prog, false);
+       config_str = bpf_program__section_name(prog);
        if (IS_ERR(config_str)) {
                pr_debug("bpf: unable to get title for program\n");
                return PTR_ERR(config_str);
@@ -454,7 +454,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
        if (err) {
                const char *title;
 
-               title = bpf_program__title(prog, false);
+               title = bpf_program__section_name(prog);
                if (!title)
                        title = "[unknown]";
 
--

2.26.2