netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Do not use deprecated bpf_program__title
@ 2020-09-07 11:02 Jiri Olsa
  2020-09-07 11:05 ` Jiri Olsa
  2020-09-08 20:11 ` Andrii Nakryiko
  0 siblings, 2 replies; 7+ messages in thread
From: Jiri Olsa @ 2020-09-07 11:02 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Arnaldo Carvalho de Melo
  Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	Andrii Nakryiko, John Fastabend, KP Singh,
	Jesper Dangaard Brouer

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"")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/bpf-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 2feb751516ab..73de3973c8ec 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf tools: Do not use deprecated bpf_program__title
  2020-09-07 11:02 [PATCH] perf tools: Do not use deprecated bpf_program__title Jiri Olsa
@ 2020-09-07 11:05 ` Jiri Olsa
  2020-09-07 15:59   ` Tobias Klauser
  2020-09-08 20:11 ` Andrii Nakryiko
  1 sibling, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2020-09-07 11:05 UTC (permalink / raw)
  To: Jiri Olsa, Arnaldo Carvalho de Melo
  Cc: Alexei Starovoitov, Daniel Borkmann, netdev, bpf,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
	John Fastabend, KP Singh, Jesper Dangaard Brouer

On Mon, Sep 07, 2020 at 01:02:37PM +0200, Jiri Olsa wrote:
> 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"")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

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

> ---
>  tools/perf/util/bpf-loader.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> index 2feb751516ab..73de3973c8ec 100644
> --- a/tools/perf/util/bpf-loader.c
> +++ b/tools/perf/util/bpf-loader.c
> @@ -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
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf tools: Do not use deprecated bpf_program__title
  2020-09-07 11:05 ` Jiri Olsa
@ 2020-09-07 15:59   ` Tobias Klauser
  2020-09-07 16:22     ` Jiri Olsa
  0 siblings, 1 reply; 7+ messages in thread
From: Tobias Klauser @ 2020-09-07 15:59 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Alexei Starovoitov,
	Daniel Borkmann, netdev, bpf, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
	Jesper Dangaard Brouer

On 2020-09-07 at 13:05:49 +0200, Jiri Olsa <jolsa@redhat.com> wrote:
> On Mon, Sep 07, 2020 at 01:02:37PM +0200, Jiri Olsa wrote:
> > 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"")
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> 
> 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
> 
> > ---
> >  tools/perf/util/bpf-loader.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> > index 2feb751516ab..73de3973c8ec 100644
> > --- a/tools/perf/util/bpf-loader.c
> > +++ b/tools/perf/util/bpf-loader.c
> > @@ -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]";

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);
      |             ^~~~~~~~~~~~~~~~~~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf tools: Do not use deprecated bpf_program__title
  2020-09-07 15:59   ` Tobias Klauser
@ 2020-09-07 16:22     ` Jiri Olsa
  2020-09-07 16:27       ` Tobias Klauser
  0 siblings, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2020-09-07 16:22 UTC (permalink / raw)
  To: Tobias Klauser
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Alexei Starovoitov,
	Daniel Borkmann, netdev, bpf, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
	Jesper Dangaard Brouer

On Mon, Sep 07, 2020 at 05:59:46PM +0200, Tobias Klauser wrote:
> On 2020-09-07 at 13:05:49 +0200, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Mon, Sep 07, 2020 at 01:02:37PM +0200, Jiri Olsa wrote:
> > > 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"")
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > 
> > 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
> > 
> > > ---
> > >  tools/perf/util/bpf-loader.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> > > index 2feb751516ab..73de3973c8ec 100644
> > > --- a/tools/perf/util/bpf-loader.c
> > > +++ b/tools/perf/util/bpf-loader.c
> > > @@ -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]";
> 
> 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

> 
> 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);
>       |             ^~~~~~~~~~~~~~~~~~
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf tools: Do not use deprecated bpf_program__title
  2020-09-07 16:22     ` Jiri Olsa
@ 2020-09-07 16:27       ` Tobias Klauser
  0 siblings, 0 replies; 7+ messages in thread
From: Tobias Klauser @ 2020-09-07 16:27 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Alexei Starovoitov,
	Daniel Borkmann, netdev, bpf, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
	Jesper Dangaard Brouer

On 2020-09-07 at 18:22:49 +0200, Jiri Olsa <jolsa@redhat.com> wrote:
> On Mon, Sep 07, 2020 at 05:59:46PM +0200, Tobias Klauser wrote:
> > On 2020-09-07 at 13:05:49 +0200, Jiri Olsa <jolsa@redhat.com> wrote:
> > > On Mon, Sep 07, 2020 at 01:02:37PM +0200, Jiri Olsa wrote:
> > > > 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"")
> > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > 
> > > 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
> > > 
> > > > ---
> > > >  tools/perf/util/bpf-loader.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> > > > index 2feb751516ab..73de3973c8ec 100644
> > > > --- a/tools/perf/util/bpf-loader.c
> > > > +++ b/tools/perf/util/bpf-loader.c
> > > > @@ -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]";
> > 
> > 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

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`.

Reviewed-by: Tobias Klauser <tklauser@distanz.ch>

Thanks
Tobias

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf tools: Do not use deprecated bpf_program__title
  2020-09-07 11:02 [PATCH] perf tools: Do not use deprecated bpf_program__title Jiri Olsa
  2020-09-07 11:05 ` Jiri Olsa
@ 2020-09-08 20:11 ` Andrii Nakryiko
  2020-09-09  7:19   ` Jiri Olsa
  1 sibling, 1 reply; 7+ messages in thread
From: Andrii Nakryiko @ 2020-09-08 20:11 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Alexei Starovoitov, Daniel Borkmann, Arnaldo Carvalho de Melo,
	Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	Andrii Nakryiko, John Fastabend, KP Singh,
	Jesper Dangaard Brouer

On Mon, Sep 7, 2020 at 10:57 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> 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"")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---

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/20200908180127.1249-1-andriin@fb.com/

>  tools/perf/util/bpf-loader.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> index 2feb751516ab..73de3973c8ec 100644
> --- a/tools/perf/util/bpf-loader.c
> +++ b/tools/perf/util/bpf-loader.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] perf tools: Do not use deprecated bpf_program__title
  2020-09-08 20:11 ` Andrii Nakryiko
@ 2020-09-09  7:19   ` Jiri Olsa
  0 siblings, 0 replies; 7+ messages in thread
From: Jiri Olsa @ 2020-09-09  7:19 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann,
	Arnaldo Carvalho de Melo, Networking, bpf, Martin KaFai Lau,
	Song Liu, Yonghong Song, Andrii Nakryiko, John Fastabend,
	KP Singh, Jesper Dangaard Brouer

On Tue, Sep 08, 2020 at 01:11:36PM -0700, Andrii Nakryiko wrote:
> On Mon, Sep 7, 2020 at 10:57 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > 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"")
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> 
> 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/20200908180127.1249-1-andriin@fb.com/

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

thanks,
jirka

> 
> >  tools/perf/util/bpf-loader.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
> > index 2feb751516ab..73de3973c8ec 100644
> > --- a/tools/perf/util/bpf-loader.c
> > +++ b/tools/perf/util/bpf-loader.c
> > @@ -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
> >
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-09  7:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 11:02 [PATCH] perf tools: Do not use deprecated bpf_program__title Jiri Olsa
2020-09-07 11:05 ` Jiri Olsa
2020-09-07 15:59   ` Tobias Klauser
2020-09-07 16:22     ` Jiri Olsa
2020-09-07 16:27       ` Tobias Klauser
2020-09-08 20:11 ` Andrii Nakryiko
2020-09-09  7:19   ` Jiri Olsa

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).