* [PATCH] perf tools: Fix not finding kcore in buildid cache
@ 2013-11-26 13:19 Adrian Hunter
2013-11-26 16:15 ` Ingo Molnar
2013-11-30 12:53 ` [tip:perf/core] perf symbols: " tip-bot for Adrian Hunter
0 siblings, 2 replies; 8+ messages in thread
From: Adrian Hunter @ 2013-11-26 13:19 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, David Ahern,
Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
Paul Mackerras, Stephane Eranian
The logic was not looking in the buildid cache for kcore
if the host kernel buildid did not match the recorded
kernel buildid.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/symbol.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index ce9ce10..360eefe 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1526,14 +1526,15 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ scnprintf(path, sizeof(path), "%s/[kernel.kcore]/%s", buildid_dir,
+ sbuild_id);
+
/* Use /proc/kallsyms if possible */
if (is_host) {
DIR *d;
int fd;
/* If no cached kcore go with /proc/kallsyms */
- scnprintf(path, sizeof(path), "%s/[kernel.kcore]/%s",
- buildid_dir, sbuild_id);
d = opendir(path);
if (!d)
goto proc_kallsyms;
@@ -1558,6 +1559,10 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
goto proc_kallsyms;
}
+ /* Find kallsyms in build-id cache with kcore */
+ if (!find_matching_kcore(map, path, sizeof(path)))
+ return strdup(path);
+
scnprintf(path, sizeof(path), "%s/[kernel.kallsyms]/%s",
buildid_dir, sbuild_id);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] perf tools: Fix not finding kcore in buildid cache
2013-11-26 13:19 [PATCH] perf tools: Fix not finding kcore in buildid cache Adrian Hunter
@ 2013-11-26 16:15 ` Ingo Molnar
2013-11-27 8:18 ` Adrian Hunter
2013-11-30 12:53 ` [tip:perf/core] perf symbols: " tip-bot for Adrian Hunter
1 sibling, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2013-11-26 16:15 UTC (permalink / raw)
To: Adrian Hunter
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
linux-kernel, David Ahern, Frederic Weisbecker, Jiri Olsa,
Mike Galbraith, Namhyung Kim, Paul Mackerras, Stephane Eranian
* Adrian Hunter <adrian.hunter@intel.com> wrote:
> The logic was not looking in the buildid cache for kcore
> if the host kernel buildid did not match the recorded
> kernel buildid.
It would be nice to also include the specific failure mode in the
changelog: exactly how can users run into this. That will be more
useful to most people reading these changelogs than a more abstract
bug description.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf tools: Fix not finding kcore in buildid cache
2013-11-26 16:15 ` Ingo Molnar
@ 2013-11-27 8:18 ` Adrian Hunter
2013-11-27 11:32 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2013-11-27 8:18 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
linux-kernel, David Ahern, Frederic Weisbecker, Jiri Olsa,
Mike Galbraith, Namhyung Kim, Paul Mackerras, Stephane Eranian
On 26/11/13 18:15, Ingo Molnar wrote:
>
> * Adrian Hunter <adrian.hunter@intel.com> wrote:
>
>> The logic was not looking in the buildid cache for kcore
>> if the host kernel buildid did not match the recorded
>> kernel buildid.
>
> It would be nice to also include the specific failure mode in the
> changelog: exactly how can users run into this. That will be more
> useful to most people reading these changelogs than a more abstract
> bug description.
The preconditions for the problem are that kcore is in the buildid
cache and that the running kernel has a different buildid e.g.
$ perf buildid-list | grep kernel.kallsyms
b18fbe769dea12513028a4287dae02efc1582c29 [kernel.kallsyms]
$ perf record -o /tmp/junk true >/dev/null 2>&1 ; perf buildid-list -i /tmp/junk | grep kernel.kallsyms
504f9fd9328c40714995ce76fe1354c6e90136ce [kernel.kallsyms]
Before the patch:
$ perf script -v >out.txt
build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
<SNIP>
Using /home/ahunter/.debug/[kernel.kallsyms]/b18fbe769dea12513028a4287dae02efc1582c29 for symbols
perf script stopped
After the patch:
$ perf script -v >out.txt
build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
<SNIP>
Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kcore for kernel object code
Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kallsyms for symbols
perf script stopped
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf tools: Fix not finding kcore in buildid cache
2013-11-27 8:18 ` Adrian Hunter
@ 2013-11-27 11:32 ` Ingo Molnar
2013-11-27 11:51 ` Adrian Hunter
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2013-11-27 11:32 UTC (permalink / raw)
To: Adrian Hunter
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
linux-kernel, David Ahern, Frederic Weisbecker, Jiri Olsa,
Mike Galbraith, Namhyung Kim, Paul Mackerras, Stephane Eranian
* Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 26/11/13 18:15, Ingo Molnar wrote:
> >
> > * Adrian Hunter <adrian.hunter@intel.com> wrote:
> >
> >> The logic was not looking in the buildid cache for kcore
> >> if the host kernel buildid did not match the recorded
> >> kernel buildid.
> >
> > It would be nice to also include the specific failure mode in the
> > changelog: exactly how can users run into this. That will be more
> > useful to most people reading these changelogs than a more abstract
> > bug description.
>
> The preconditions for the problem are that kcore is in the buildid
> cache and that the running kernel has a different buildid e.g.
>
> $ perf buildid-list | grep kernel.kallsyms
> b18fbe769dea12513028a4287dae02efc1582c29 [kernel.kallsyms]
>
> $ perf record -o /tmp/junk true >/dev/null 2>&1 ; perf buildid-list -i /tmp/junk | grep kernel.kallsyms
> 504f9fd9328c40714995ce76fe1354c6e90136ce [kernel.kallsyms]
>
>
>
> Before the patch:
>
>
> $ perf script -v >out.txt
> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
> <SNIP>
> Using /home/ahunter/.debug/[kernel.kallsyms]/b18fbe769dea12513028a4287dae02efc1582c29 for symbols
>
> perf script stopped
>
>
> After the patch:
>
>
> $ perf script -v >out.txt
> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
> <SNIP>
> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kcore for kernel object code
> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kallsyms for symbols
>
> perf script stopped
So the result of the patch is that kernel symbols get
resolved/annotated correctly, as expected from the live kcore feature,
right?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf tools: Fix not finding kcore in buildid cache
2013-11-27 11:32 ` Ingo Molnar
@ 2013-11-27 11:51 ` Adrian Hunter
2013-11-27 11:52 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2013-11-27 11:51 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
linux-kernel, David Ahern, Frederic Weisbecker, Jiri Olsa,
Mike Galbraith, Namhyung Kim, Paul Mackerras, Stephane Eranian
On 27/11/13 13:32, Ingo Molnar wrote:
>
> * Adrian Hunter <adrian.hunter@intel.com> wrote:
>
>> On 26/11/13 18:15, Ingo Molnar wrote:
>>>
>>> * Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>
>>>> The logic was not looking in the buildid cache for kcore
>>>> if the host kernel buildid did not match the recorded
>>>> kernel buildid.
>>>
>>> It would be nice to also include the specific failure mode in the
>>> changelog: exactly how can users run into this. That will be more
>>> useful to most people reading these changelogs than a more abstract
>>> bug description.
>>
>> The preconditions for the problem are that kcore is in the buildid
>> cache and that the running kernel has a different buildid e.g.
>>
>> $ perf buildid-list | grep kernel.kallsyms
>> b18fbe769dea12513028a4287dae02efc1582c29 [kernel.kallsyms]
>>
>> $ perf record -o /tmp/junk true >/dev/null 2>&1 ; perf buildid-list -i /tmp/junk | grep kernel.kallsyms
>> 504f9fd9328c40714995ce76fe1354c6e90136ce [kernel.kallsyms]
>>
>>
>>
>> Before the patch:
>>
>>
>> $ perf script -v >out.txt
>> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
>> <SNIP>
>> Using /home/ahunter/.debug/[kernel.kallsyms]/b18fbe769dea12513028a4287dae02efc1582c29 for symbols
>>
>> perf script stopped
>>
>>
>> After the patch:
>>
>>
>> $ perf script -v >out.txt
>> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
>> <SNIP>
>> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kcore for kernel object code
>> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kallsyms for symbols
>>
>> perf script stopped
>
> So the result of the patch is that kernel symbols get
> resolved/annotated correctly, as expected from the live kcore feature,
> right?
Yes but this is the non-live case i.e. the kernel has changed and we are
looking at a special copy of kcore that we placed in the buildid cache
(using "perf buildid-cache -v -k /proc/kcore") when the data was recorded.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf tools: Fix not finding kcore in buildid cache
2013-11-27 11:51 ` Adrian Hunter
@ 2013-11-27 11:52 ` Ingo Molnar
2013-11-27 14:42 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2013-11-27 11:52 UTC (permalink / raw)
To: Adrian Hunter
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
linux-kernel, David Ahern, Frederic Weisbecker, Jiri Olsa,
Mike Galbraith, Namhyung Kim, Paul Mackerras, Stephane Eranian
* Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 27/11/13 13:32, Ingo Molnar wrote:
> >
> > * Adrian Hunter <adrian.hunter@intel.com> wrote:
> >
> >> On 26/11/13 18:15, Ingo Molnar wrote:
> >>>
> >>> * Adrian Hunter <adrian.hunter@intel.com> wrote:
> >>>
> >>>> The logic was not looking in the buildid cache for kcore
> >>>> if the host kernel buildid did not match the recorded
> >>>> kernel buildid.
> >>>
> >>> It would be nice to also include the specific failure mode in the
> >>> changelog: exactly how can users run into this. That will be more
> >>> useful to most people reading these changelogs than a more abstract
> >>> bug description.
> >>
> >> The preconditions for the problem are that kcore is in the buildid
> >> cache and that the running kernel has a different buildid e.g.
> >>
> >> $ perf buildid-list | grep kernel.kallsyms
> >> b18fbe769dea12513028a4287dae02efc1582c29 [kernel.kallsyms]
> >>
> >> $ perf record -o /tmp/junk true >/dev/null 2>&1 ; perf buildid-list -i /tmp/junk | grep kernel.kallsyms
> >> 504f9fd9328c40714995ce76fe1354c6e90136ce [kernel.kallsyms]
> >>
> >>
> >>
> >> Before the patch:
> >>
> >>
> >> $ perf script -v >out.txt
> >> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
> >> <SNIP>
> >> Using /home/ahunter/.debug/[kernel.kallsyms]/b18fbe769dea12513028a4287dae02efc1582c29 for symbols
> >>
> >> perf script stopped
> >>
> >>
> >> After the patch:
> >>
> >>
> >> $ perf script -v >out.txt
> >> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
> >> <SNIP>
> >> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kcore for kernel object code
> >> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kallsyms for symbols
> >>
> >> perf script stopped
> >
> > So the result of the patch is that kernel symbols get
> > resolved/annotated correctly, as expected from the live kcore feature,
> > right?
>
> Yes but this is the non-live case i.e. the kernel has changed and we are
> looking at a special copy of kcore that we placed in the buildid cache
> (using "perf buildid-cache -v -k /proc/kcore") when the data was recorded.
Okay.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] perf tools: Fix not finding kcore in buildid cache
2013-11-27 11:52 ` Ingo Molnar
@ 2013-11-27 14:42 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-11-27 14:42 UTC (permalink / raw)
To: Ingo Molnar
Cc: Adrian Hunter, Peter Zijlstra, Ingo Molnar, linux-kernel,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Stephane Eranian
Em Wed, Nov 27, 2013 at 12:52:47PM +0100, Ingo Molnar escreveu:
>
> * Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> > On 27/11/13 13:32, Ingo Molnar wrote:
> > >
> > > * Adrian Hunter <adrian.hunter@intel.com> wrote:
> > >
> > >> On 26/11/13 18:15, Ingo Molnar wrote:
> > >>>
> > >>> * Adrian Hunter <adrian.hunter@intel.com> wrote:
> > >>>
> > >>>> The logic was not looking in the buildid cache for kcore
> > >>>> if the host kernel buildid did not match the recorded
> > >>>> kernel buildid.
> > >>>
> > >>> It would be nice to also include the specific failure mode in the
> > >>> changelog: exactly how can users run into this. That will be more
> > >>> useful to most people reading these changelogs than a more abstract
> > >>> bug description.
> > >>
> > >> The preconditions for the problem are that kcore is in the buildid
> > >> cache and that the running kernel has a different buildid e.g.
> > >>
> > >> $ perf buildid-list | grep kernel.kallsyms
> > >> b18fbe769dea12513028a4287dae02efc1582c29 [kernel.kallsyms]
> > >>
> > >> $ perf record -o /tmp/junk true >/dev/null 2>&1 ; perf buildid-list -i /tmp/junk | grep kernel.kallsyms
> > >> 504f9fd9328c40714995ce76fe1354c6e90136ce [kernel.kallsyms]
> > >>
> > >>
> > >>
> > >> Before the patch:
> > >>
> > >>
> > >> $ perf script -v >out.txt
> > >> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
> > >> <SNIP>
> > >> Using /home/ahunter/.debug/[kernel.kallsyms]/b18fbe769dea12513028a4287dae02efc1582c29 for symbols
> > >>
> > >> perf script stopped
> > >>
> > >>
> > >> After the patch:
> > >>
> > >>
> > >> $ perf script -v >out.txt
> > >> build id event received for [kernel.kallsyms]: b18fbe769dea12513028a4287dae02efc1582c29
> > >> <SNIP>
> > >> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kcore for kernel object code
> > >> Using /home/ahunter/.debug/[kernel.kcore]/b18fbe769dea12513028a4287dae02efc1582c29/2013112617084061/kallsyms for symbols
> > >>
> > >> perf script stopped
> > >
> > > So the result of the patch is that kernel symbols get
> > > resolved/annotated correctly, as expected from the live kcore feature,
> > > right?
> >
> > Yes but this is the non-live case i.e. the kernel has changed and we are
> > looking at a special copy of kcore that we placed in the buildid cache
> > (using "perf buildid-cache -v -k /proc/kcore") when the data was recorded.
>
> Okay.
Thanks for the questions and answers, I'll edit it and add to the patch.
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:perf/core] perf symbols: Fix not finding kcore in buildid cache
2013-11-26 13:19 [PATCH] perf tools: Fix not finding kcore in buildid cache Adrian Hunter
2013-11-26 16:15 ` Ingo Molnar
@ 2013-11-30 12:53 ` tip-bot for Adrian Hunter
1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Adrian Hunter @ 2013-11-30 12:53 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, eranian, paulus, mingo, hpa, mingo,
a.p.zijlstra, efault, namhyung, jolsa, fweisbec, adrian.hunter,
dsahern, tglx
Commit-ID: 449867e346bfd52c5df6bba5b706a795c35e78d4
Gitweb: http://git.kernel.org/tip/449867e346bfd52c5df6bba5b706a795c35e78d4
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 26 Nov 2013 15:19:24 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 Nov 2013 14:58:38 -0300
perf symbols: Fix not finding kcore in buildid cache
The logic was not looking in the buildid cache for kcore if the host
kernel buildid did not match the recorded kernel buildid.
This affects the non-live case i.e. the kernel has changed and we are
looking at a special copy of kcore that we placed in the buildid cache
(using "perf buildid-cache -v -k /proc/kcore") when the data was
recorded.
After this fix kernel symbols get resolved/annotated correctly.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1385471964-4037-1-git-send-email-adrian.hunter@intel.com
[ Added further explanation extracted from conversation between Ingo & Adrian on lkml ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index ce9ce10..360eefe 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1526,14 +1526,15 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ scnprintf(path, sizeof(path), "%s/[kernel.kcore]/%s", buildid_dir,
+ sbuild_id);
+
/* Use /proc/kallsyms if possible */
if (is_host) {
DIR *d;
int fd;
/* If no cached kcore go with /proc/kallsyms */
- scnprintf(path, sizeof(path), "%s/[kernel.kcore]/%s",
- buildid_dir, sbuild_id);
d = opendir(path);
if (!d)
goto proc_kallsyms;
@@ -1558,6 +1559,10 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
goto proc_kallsyms;
}
+ /* Find kallsyms in build-id cache with kcore */
+ if (!find_matching_kcore(map, path, sizeof(path)))
+ return strdup(path);
+
scnprintf(path, sizeof(path), "%s/[kernel.kallsyms]/%s",
buildid_dir, sbuild_id);
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-11-30 12:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-26 13:19 [PATCH] perf tools: Fix not finding kcore in buildid cache Adrian Hunter
2013-11-26 16:15 ` Ingo Molnar
2013-11-27 8:18 ` Adrian Hunter
2013-11-27 11:32 ` Ingo Molnar
2013-11-27 11:51 ` Adrian Hunter
2013-11-27 11:52 ` Ingo Molnar
2013-11-27 14:42 ` Arnaldo Carvalho de Melo
2013-11-30 12:53 ` [tip:perf/core] perf symbols: " tip-bot for Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox