* [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report
@ 2014-06-15 8:35 Jiri Olsa
2014-06-15 12:46 ` Namhyung Kim
2014-06-25 5:52 ` [tip:perf/core] " tip-bot for Jiri Olsa
0 siblings, 2 replies; 6+ messages in thread
From: Jiri Olsa @ 2014-06-15 8:35 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Corey Ashford, David Ahern,
Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
Peter Zijlstra
heya,
not completely sure this is what we want to do, but have no
streght to dive into annotation code ;-)
thanks,
jirka
---
When cumulative callchain mode is on, we could get samples with
with no actual hits. This breaks the assumption of the annotation
code, that each sample has annotation counts allocated and leads
to segfault.
Fixing this by additional checks for annotation stats.
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 52c03fb..04a229a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -17,6 +17,7 @@
#include "../util.h"
#include "../ui.h"
#include "map.h"
+#include "annotate.h"
struct hist_browser {
struct ui_browser b;
@@ -1593,13 +1594,18 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
bi->to.sym->name) > 0)
annotate_t = nr_options++;
} else {
-
if (browser->selection != NULL &&
browser->selection->sym != NULL &&
- !browser->selection->map->dso->annotate_warned &&
- asprintf(&options[nr_options], "Annotate %s",
- browser->selection->sym->name) > 0)
- annotate = nr_options++;
+ !browser->selection->map->dso->annotate_warned) {
+ struct annotation *notes;
+
+ notes = symbol__annotation(browser->selection->sym);
+
+ if (notes->src &&
+ asprintf(&options[nr_options], "Annotate %s",
+ browser->selection->sym->name) > 0)
+ annotate = nr_options++;
+ }
}
if (thread != NULL &&
@@ -1656,6 +1662,7 @@ retry_popup_menu:
if (choice == annotate || choice == annotate_t || choice == annotate_f) {
struct hist_entry *he;
+ struct annotation *notes;
int err;
do_annotate:
if (!objdump_path && perf_session_env__lookup_objdump(env))
@@ -1679,6 +1686,10 @@ do_annotate:
he->ms.map = he->branch_info->to.map;
}
+ notes = symbol__annotation(he->ms.sym);
+ if (!notes->src)
+ continue;
+
/*
* Don't let this be freed, say, by hists__decay_entry.
*/
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report
2014-06-15 8:35 [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report Jiri Olsa
@ 2014-06-15 12:46 ` Namhyung Kim
2014-06-15 16:34 ` Jiri Olsa
2014-06-25 5:52 ` [tip:perf/core] " tip-bot for Jiri Olsa
1 sibling, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2014-06-15 12:46 UTC (permalink / raw)
To: Jiri Olsa
Cc: linux-kernel, Arnaldo Carvalho de Melo, Corey Ashford,
David Ahern, Frederic Weisbecker, Ingo Molnar, Paul Mackerras,
Peter Zijlstra
Hi Jiri,
2014-06-15 (일), 10:35 +0200, Jiri Olsa:
> heya,
> not completely sure this is what we want to do, but have no
> streght to dive into annotation code ;-)
Currently, cumulative entries do not accounts annotation info so
annotation only works for normal entries. I'm not sure we should
support it or not, but anyway it also needs some updates on the
annotation code IMHO.
So I'm okay with disabling annotation on pure cumulative entries.
Thanks,
Namhyung
>
> ---
> When cumulative callchain mode is on, we could get samples with
> with no actual hits. This breaks the assumption of the annotation
> code, that each sample has annotation counts allocated and leads
> to segfault.
>
> Fixing this by additional checks for annotation stats.
>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/perf/ui/browsers/hists.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 52c03fb..04a229a 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -17,6 +17,7 @@
> #include "../util.h"
> #include "../ui.h"
> #include "map.h"
> +#include "annotate.h"
>
> struct hist_browser {
> struct ui_browser b;
> @@ -1593,13 +1594,18 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
> bi->to.sym->name) > 0)
> annotate_t = nr_options++;
> } else {
> -
> if (browser->selection != NULL &&
> browser->selection->sym != NULL &&
> - !browser->selection->map->dso->annotate_warned &&
> - asprintf(&options[nr_options], "Annotate %s",
> - browser->selection->sym->name) > 0)
> - annotate = nr_options++;
> + !browser->selection->map->dso->annotate_warned) {
> + struct annotation *notes;
> +
> + notes = symbol__annotation(browser->selection->sym);
> +
> + if (notes->src &&
> + asprintf(&options[nr_options], "Annotate %s",
> + browser->selection->sym->name) > 0)
> + annotate = nr_options++;
> + }
> }
>
> if (thread != NULL &&
> @@ -1656,6 +1662,7 @@ retry_popup_menu:
>
> if (choice == annotate || choice == annotate_t || choice == annotate_f) {
> struct hist_entry *he;
> + struct annotation *notes;
> int err;
> do_annotate:
> if (!objdump_path && perf_session_env__lookup_objdump(env))
> @@ -1679,6 +1686,10 @@ do_annotate:
> he->ms.map = he->branch_info->to.map;
> }
>
> + notes = symbol__annotation(he->ms.sym);
> + if (!notes->src)
> + continue;
> +
> /*
> * Don't let this be freed, say, by hists__decay_entry.
> */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report
2014-06-15 12:46 ` Namhyung Kim
@ 2014-06-15 16:34 ` Jiri Olsa
2014-06-16 13:14 ` Namhyung Kim
0 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2014-06-15 16:34 UTC (permalink / raw)
To: Namhyung Kim
Cc: Jiri Olsa, linux-kernel, Arnaldo Carvalho de Melo, Corey Ashford,
David Ahern, Frederic Weisbecker, Ingo Molnar, Paul Mackerras,
Peter Zijlstra
On Sun, Jun 15, 2014 at 09:46:31PM +0900, Namhyung Kim wrote:
> Hi Jiri,
>
> 2014-06-15 (일), 10:35 +0200, Jiri Olsa:
> > heya,
> > not completely sure this is what we want to do, but have no
> > streght to dive into annotation code ;-)
>
> Currently, cumulative entries do not accounts annotation info so
> annotation only works for normal entries. I'm not sure we should
> support it or not, but anyway it also needs some updates on the
> annotation code IMHO.
>
> So I'm okay with disabling annotation on pure cumulative entries.
is that an ack? ;-)
thanks,
jirka
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report
2014-06-15 16:34 ` Jiri Olsa
@ 2014-06-16 13:14 ` Namhyung Kim
2014-06-19 15:36 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2014-06-16 13:14 UTC (permalink / raw)
To: Jiri Olsa
Cc: Jiri Olsa, linux-kernel, Arnaldo Carvalho de Melo, Corey Ashford,
David Ahern, Frederic Weisbecker, Ingo Molnar, Paul Mackerras,
Peter Zijlstra
2014-06-15 (일), 18:34 +0200, Jiri Olsa:
> On Sun, Jun 15, 2014 at 09:46:31PM +0900, Namhyung Kim wrote:
> > Hi Jiri,
> >
> > 2014-06-15 (일), 10:35 +0200, Jiri Olsa:
> > > heya,
> > > not completely sure this is what we want to do, but have no
> > > streght to dive into annotation code ;-)
> >
> > Currently, cumulative entries do not accounts annotation info so
> > annotation only works for normal entries. I'm not sure we should
> > support it or not, but anyway it also needs some updates on the
> > annotation code IMHO.
> >
> > So I'm okay with disabling annotation on pure cumulative entries.
>
> is that an ack? ;-)
Yep,
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report
2014-06-16 13:14 ` Namhyung Kim
@ 2014-06-19 15:36 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-06-19 15:36 UTC (permalink / raw)
To: Namhyung Kim
Cc: Jiri Olsa, Jiri Olsa, linux-kernel, Corey Ashford, David Ahern,
Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra
Em Mon, Jun 16, 2014 at 10:14:22PM +0900, Namhyung Kim escreveu:
> 2014-06-15 (일), 18:34 +0200, Jiri Olsa:
> > On Sun, Jun 15, 2014 at 09:46:31PM +0900, Namhyung Kim wrote:
> > > 2014-06-15 (일), 10:35 +0200, Jiri Olsa:
> > > > not completely sure this is what we want to do, but have no
> > > > streght to dive into annotation code ;-)
> > > Currently, cumulative entries do not accounts annotation info so
> > > annotation only works for normal entries. I'm not sure we should
> > > support it or not, but anyway it also needs some updates on the
> > > annotation code IMHO.
> > > So I'm okay with disabling annotation on pure cumulative entries.
> > is that an ack? ;-)
> Yep,
> Acked-by: Namhyung Kim <namhyung@kernel.org>
>From a quick look, this looks sane, i.e. only offering annotation for
symbols where samples were taken.
Otherwise we would have to figure out which samples came thru the
specific point in the callchain selected, which, as Namhyung mentioned,
requires more thinking and coding.
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:perf/core] perf tools: Fix segfault in cumulative.callchain report
2014-06-15 8:35 [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report Jiri Olsa
2014-06-15 12:46 ` Namhyung Kim
@ 2014-06-25 5:52 ` tip-bot for Jiri Olsa
1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Jiri Olsa @ 2014-06-25 5:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, paulus, acme, hpa, mingo, jolsa, a.p.zijlstra,
acme, namhyung, fweisbec, dsahern, tglx, cjashfor
Commit-ID: d755330c5e0658d8056242b5b81e2f44ed7a96d8
Gitweb: http://git.kernel.org/tip/d755330c5e0658d8056242b5b81e2f44ed7a96d8
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Sun, 15 Jun 2014 10:22:15 +0200
Committer: Jiri Olsa <jolsa@kernel.org>
CommitDate: Fri, 20 Jun 2014 09:34:18 +0200
perf tools: Fix segfault in cumulative.callchain report
When cumulative callchain mode is on, we could get samples with
with no actual hits. This breaks the assumption of the annotation
code, that each sample has annotation counts allocated and leads
to segfault.
Fixing this by additional checks for annotation stats.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1402821332-12419-1-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 52c03fb..04a229a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -17,6 +17,7 @@
#include "../util.h"
#include "../ui.h"
#include "map.h"
+#include "annotate.h"
struct hist_browser {
struct ui_browser b;
@@ -1593,13 +1594,18 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
bi->to.sym->name) > 0)
annotate_t = nr_options++;
} else {
-
if (browser->selection != NULL &&
browser->selection->sym != NULL &&
- !browser->selection->map->dso->annotate_warned &&
- asprintf(&options[nr_options], "Annotate %s",
- browser->selection->sym->name) > 0)
- annotate = nr_options++;
+ !browser->selection->map->dso->annotate_warned) {
+ struct annotation *notes;
+
+ notes = symbol__annotation(browser->selection->sym);
+
+ if (notes->src &&
+ asprintf(&options[nr_options], "Annotate %s",
+ browser->selection->sym->name) > 0)
+ annotate = nr_options++;
+ }
}
if (thread != NULL &&
@@ -1656,6 +1662,7 @@ retry_popup_menu:
if (choice == annotate || choice == annotate_t || choice == annotate_f) {
struct hist_entry *he;
+ struct annotation *notes;
int err;
do_annotate:
if (!objdump_path && perf_session_env__lookup_objdump(env))
@@ -1679,6 +1686,10 @@ do_annotate:
he->ms.map = he->branch_info->to.map;
}
+ notes = symbol__annotation(he->ms.sym);
+ if (!notes->src)
+ continue;
+
/*
* Don't let this be freed, say, by hists__decay_entry.
*/
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-25 5:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15 8:35 [RFC/PATCH] perf tools: Fix segfault in cumulative.callchain report Jiri Olsa
2014-06-15 12:46 ` Namhyung Kim
2014-06-15 16:34 ` Jiri Olsa
2014-06-16 13:14 ` Namhyung Kim
2014-06-19 15:36 ` Arnaldo Carvalho de Melo
2014-06-25 5:52 ` [tip:perf/core] " tip-bot for Jiri Olsa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.