linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
@ 2019-04-16 13:41 Jiri Olsa
  2019-04-16 14:20 ` Arnaldo Carvalho de Melo
  2019-04-19 17:17 ` [tip:perf/urgent] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info() tip-bot for Jiri Olsa
  0 siblings, 2 replies; 8+ messages in thread
From: Jiri Olsa @ 2019-04-16 13:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Song Liu, lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin,
	Peter Zijlstra

We currently don't return NULL in case we don't find
the bpf_prog_info_node, fixing that.

Cc: Song Liu <songliubraving@fb.com>
Link: http://lkml.kernel.org/n/tip-bp07cla6dy6ifydl1sfoiorw@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/env.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index c6351b557bb0..34a363f2e71b 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
 		else if (prog_id > node->info_linear->info.id)
 			n = n->rb_right;
 		else
-			break;
+			goto out;
 	}
+	node = NULL;
 
+out:
 	up_read(&env->bpf_progs.lock);
 	return node;
 }
-- 
2.17.2


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

* Re: [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
  2019-04-16 13:41 [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup Jiri Olsa
@ 2019-04-16 14:20 ` Arnaldo Carvalho de Melo
  2019-04-16 14:34   ` Jiri Olsa
  2019-04-19 17:17 ` [tip:perf/urgent] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info() tip-bot for Jiri Olsa
  1 sibling, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-04-16 14:20 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Song Liu, lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin,
	Peter Zijlstra

Em Tue, Apr 16, 2019 at 03:41:51PM +0200, Jiri Olsa escreveu:
> We currently don't return NULL in case we don't find
> the bpf_prog_info_node, fixing that.

Can you please try to figure out what was the changeset that introduced
this problem so that we can have a Fixes: tag that helps me determine if
this should go to perf/urgent (likely) or (perf/core) and to help the
stable guys as well?

Thanks,

- Arnaldo
 
> Cc: Song Liu <songliubraving@fb.com>
> Link: http://lkml.kernel.org/n/tip-bp07cla6dy6ifydl1sfoiorw@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/env.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> index c6351b557bb0..34a363f2e71b 100644
> --- a/tools/perf/util/env.c
> +++ b/tools/perf/util/env.c
> @@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
>  		else if (prog_id > node->info_linear->info.id)
>  			n = n->rb_right;
>  		else
> -			break;
> +			goto out;
>  	}
> +	node = NULL;
>  
> +out:
>  	up_read(&env->bpf_progs.lock);
>  	return node;
>  }
> -- 
> 2.17.2

-- 

- Arnaldo

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

* Re: [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
  2019-04-16 14:20 ` Arnaldo Carvalho de Melo
@ 2019-04-16 14:34   ` Jiri Olsa
  2019-04-16 14:35     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2019-04-16 14:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Song Liu, lkml, Ingo Molnar, Namhyung Kim,
	Alexander Shishkin, Peter Zijlstra

On Tue, Apr 16, 2019 at 11:20:28AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Apr 16, 2019 at 03:41:51PM +0200, Jiri Olsa escreveu:
> > We currently don't return NULL in case we don't find
> > the bpf_prog_info_node, fixing that.
> 
> Can you please try to figure out what was the changeset that introduced
> this problem so that we can have a Fixes: tag that helps me determine if
> this should go to perf/urgent (likely) or (perf/core) and to help the
> stable guys as well?

sry, I keep forgetting this..

Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")

thanks,
jirka

> 
> Thanks,
> 
> - Arnaldo
>  
> > Cc: Song Liu <songliubraving@fb.com>
> > Link: http://lkml.kernel.org/n/tip-bp07cla6dy6ifydl1sfoiorw@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/perf/util/env.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> > index c6351b557bb0..34a363f2e71b 100644
> > --- a/tools/perf/util/env.c
> > +++ b/tools/perf/util/env.c
> > @@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
> >  		else if (prog_id > node->info_linear->info.id)
> >  			n = n->rb_right;
> >  		else
> > -			break;
> > +			goto out;
> >  	}
> > +	node = NULL;
> >  
> > +out:
> >  	up_read(&env->bpf_progs.lock);
> >  	return node;
> >  }
> > -- 
> > 2.17.2
> 
> -- 
> 
> - Arnaldo

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

* Re: [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
  2019-04-16 14:34   ` Jiri Olsa
@ 2019-04-16 14:35     ` Arnaldo Carvalho de Melo
  2019-04-16 14:37       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-04-16 14:35 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Song Liu, lkml, Ingo Molnar, Namhyung Kim,
	Alexander Shishkin, Peter Zijlstra

Em Tue, Apr 16, 2019 at 04:34:52PM +0200, Jiri Olsa escreveu:
> On Tue, Apr 16, 2019 at 11:20:28AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Apr 16, 2019 at 03:41:51PM +0200, Jiri Olsa escreveu:
> > > We currently don't return NULL in case we don't find
> > > the bpf_prog_info_node, fixing that.
> > 
> > Can you please try to figure out what was the changeset that introduced
> > this problem so that we can have a Fixes: tag that helps me determine if
> > this should go to perf/urgent (likely) or (perf/core) and to help the
> > stable guys as well?
> 
> sry, I keep forgetting this..
> 
> Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")

I had just added:

Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")

matches, good :-)

At firts I thought hey the look checks for NULL, then, hey, different
variable... good catch!

Thanks,
 
> thanks,
> jirka
> 
> > 
> > Thanks,
> > 
> > - Arnaldo
> >  
> > > Cc: Song Liu <songliubraving@fb.com>
> > > Link: http://lkml.kernel.org/n/tip-bp07cla6dy6ifydl1sfoiorw@git.kernel.org
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > ---
> > >  tools/perf/util/env.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> > > index c6351b557bb0..34a363f2e71b 100644
> > > --- a/tools/perf/util/env.c
> > > +++ b/tools/perf/util/env.c
> > > @@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
> > >  		else if (prog_id > node->info_linear->info.id)
> > >  			n = n->rb_right;
> > >  		else
> > > -			break;
> > > +			goto out;
> > >  	}
> > > +	node = NULL;
> > >  
> > > +out:
> > >  	up_read(&env->bpf_progs.lock);
> > >  	return node;
> > >  }
> > > -- 
> > > 2.17.2
> > 
> > -- 
> > 
> > - Arnaldo

-- 

- Arnaldo

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

* Re: [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
  2019-04-16 14:35     ` Arnaldo Carvalho de Melo
@ 2019-04-16 14:37       ` Arnaldo Carvalho de Melo
  2019-04-16 20:25         ` Song Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-04-16 14:37 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Song Liu, lkml, Ingo Molnar, Namhyung Kim,
	Alexander Shishkin, Peter Zijlstra

Em Tue, Apr 16, 2019 at 11:35:54AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Apr 16, 2019 at 04:34:52PM +0200, Jiri Olsa escreveu:
> > On Tue, Apr 16, 2019 at 11:20:28AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Apr 16, 2019 at 03:41:51PM +0200, Jiri Olsa escreveu:
> > > > We currently don't return NULL in case we don't find
> > > > the bpf_prog_info_node, fixing that.
> > > 
> > > Can you please try to figure out what was the changeset that introduced
> > > this problem so that we can have a Fixes: tag that helps me determine if
> > > this should go to perf/urgent (likely) or (perf/core) and to help the
> > > stable guys as well?
> > 
> > sry, I keep forgetting this..
> > 
> > Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
> 
> I had just added:
> 
> Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
> 
> matches, good :-)
> 
> At firts I thought hey the look checks for NULL, then, hey, different
> variable... good catch!

Ah, I also changed the summary from:

   "perf tools: Fix perf_env__find_bpf_prog_info rb tree"

to:

  perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info()

Thanks,

- Arnaldo

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

* Re: [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
  2019-04-16 14:37       ` Arnaldo Carvalho de Melo
@ 2019-04-16 20:25         ` Song Liu
  2019-04-17  7:38           ` Jiri Olsa
  0 siblings, 1 reply; 8+ messages in thread
From: Song Liu @ 2019-04-16 20:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Jiri Olsa, lkml, Ingo Molnar, Namhyung Kim,
	Alexander Shishkin, Peter Zijlstra



> On Apr 16, 2019, at 7:37 AM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> 
> Em Tue, Apr 16, 2019 at 11:35:54AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Tue, Apr 16, 2019 at 04:34:52PM +0200, Jiri Olsa escreveu:
>>> On Tue, Apr 16, 2019 at 11:20:28AM -0300, Arnaldo Carvalho de Melo wrote:
>>>> Em Tue, Apr 16, 2019 at 03:41:51PM +0200, Jiri Olsa escreveu:
>>>>> We currently don't return NULL in case we don't find
>>>>> the bpf_prog_info_node, fixing that.
>>>> 
>>>> Can you please try to figure out what was the changeset that introduced
>>>> this problem so that we can have a Fixes: tag that helps me determine if
>>>> this should go to perf/urgent (likely) or (perf/core) and to help the
>>>> stable guys as well?
>>> 
>>> sry, I keep forgetting this..
>>> 
>>> Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
>> 
>> I had just added:
>> 
>> Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
>> 
>> matches, good :-)
>> 
>> At firts I thought hey the look checks for NULL, then, hey, different
>> variable... good catch!
> 
> Ah, I also changed the summary from:
> 
>   "perf tools: Fix perf_env__find_bpf_prog_info rb tree"
> 
> to:
> 
>  perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info()
> 
> Thanks,
> 
> - Arnaldo

Thanks Jiri and Arnaldo!

I think we will need similar fix for perf_env__find_btf(). 

Song

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

* Re: [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup
  2019-04-16 20:25         ` Song Liu
@ 2019-04-17  7:38           ` Jiri Olsa
  0 siblings, 0 replies; 8+ messages in thread
From: Jiri Olsa @ 2019-04-17  7:38 UTC (permalink / raw)
  To: Song Liu
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, lkml, Ingo Molnar,
	Namhyung Kim, Alexander Shishkin, Peter Zijlstra

On Tue, Apr 16, 2019 at 08:25:17PM +0000, Song Liu wrote:
> 
> 
> > On Apr 16, 2019, at 7:37 AM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> > 
> > Em Tue, Apr 16, 2019 at 11:35:54AM -0300, Arnaldo Carvalho de Melo escreveu:
> >> Em Tue, Apr 16, 2019 at 04:34:52PM +0200, Jiri Olsa escreveu:
> >>> On Tue, Apr 16, 2019 at 11:20:28AM -0300, Arnaldo Carvalho de Melo wrote:
> >>>> Em Tue, Apr 16, 2019 at 03:41:51PM +0200, Jiri Olsa escreveu:
> >>>>> We currently don't return NULL in case we don't find
> >>>>> the bpf_prog_info_node, fixing that.
> >>>> 
> >>>> Can you please try to figure out what was the changeset that introduced
> >>>> this problem so that we can have a Fixes: tag that helps me determine if
> >>>> this should go to perf/urgent (likely) or (perf/core) and to help the
> >>>> stable guys as well?
> >>> 
> >>> sry, I keep forgetting this..
> >>> 
> >>> Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
> >> 
> >> I had just added:
> >> 
> >> Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
> >> 
> >> matches, good :-)
> >> 
> >> At firts I thought hey the look checks for NULL, then, hey, different
> >> variable... good catch!
> > 
> > Ah, I also changed the summary from:
> > 
> >   "perf tools: Fix perf_env__find_bpf_prog_info rb tree"
> > 
> > to:
> > 
> >  perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info()
> > 
> > Thanks,
> > 
> > - Arnaldo
> 
> Thanks Jiri and Arnaldo!
> 
> I think we will need similar fix for perf_env__find_btf(). 

right, I'll post it

thanks,
jirka

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

* [tip:perf/urgent] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info()
  2019-04-16 13:41 [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup Jiri Olsa
  2019-04-16 14:20 ` Arnaldo Carvalho de Melo
@ 2019-04-19 17:17 ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Jiri Olsa @ 2019-04-19 17:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, jolsa, namhyung, songliubraving, mingo, acme,
	alexander.shishkin, linux-kernel, tglx, hpa

Commit-ID:  aa52660231410b13d237299e691c43e346e3a73f
Gitweb:     https://git.kernel.org/tip/aa52660231410b13d237299e691c43e346e3a73f
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 16 Apr 2019 15:41:51 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 17 Apr 2019 14:30:06 -0300

perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info()

We currently don't return NULL in case we don't find the
bpf_prog_info_node, fixing that.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in perf_env")
Link: http://lkml.kernel.org/r/20190416134151.15282-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/env.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index c6351b557bb0..34a363f2e71b 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
 		else if (prog_id > node->info_linear->info.id)
 			n = n->rb_right;
 		else
-			break;
+			goto out;
 	}
+	node = NULL;
 
+out:
 	up_read(&env->bpf_progs.lock);
 	return node;
 }

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

end of thread, other threads:[~2019-04-19 19:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 13:41 [PATCH] perf tools: Fix perf_env__find_bpf_prog_info rb tree lookup Jiri Olsa
2019-04-16 14:20 ` Arnaldo Carvalho de Melo
2019-04-16 14:34   ` Jiri Olsa
2019-04-16 14:35     ` Arnaldo Carvalho de Melo
2019-04-16 14:37       ` Arnaldo Carvalho de Melo
2019-04-16 20:25         ` Song Liu
2019-04-17  7:38           ` Jiri Olsa
2019-04-19 17:17 ` [tip:perf/urgent] perf bpf: Return NULL when RB tree lookup fails in perf_env__find_bpf_prog_info() tip-bot for 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).