2011-03-09 22:57:51

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [GIT PULL 0/1] perf/urgent fix

Hi Ingo,

Please consider pulling from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent

Regards,

- Arnaldo

Lin Ming (1):
perf symbols: Avoid resolving [kernel.kallsyms] to real path for buildid cache

tools/perf/util/header.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)


2011-03-09 22:57:41

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/1] perf symbols: Avoid resolving [kernel.kallsyms] to real path for buildid cache

From: Lin Ming <[email protected]>

kallsyms has a virtual file name [kernel.kallsyms]. Currently, it can't
be added to buildid cache successfully because the code
(build_id_cache__add_s) tries to resolve [kernel.kallsyms] to a real
absolute pathname and that fails.

Fixes it by not resolving it and just use the name [kernel.kallsyms].
So dir ~/.debug/[kernel.kallsyms] is created.

Original bug report at:
https://lkml.org/lkml/2011/3/1/524

Tested-by: Han Pingtian <[email protected]>
Cc: Han Pingtian <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Lin Ming <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/header.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index f6a929e..0866bcd 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -270,11 +270,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
const char *name, bool is_kallsyms)
{
const size_t size = PATH_MAX;
- char *realname = realpath(name, NULL),
- *filename = malloc(size),
+ char *realname, *filename = malloc(size),
*linkname = malloc(size), *targetname;
int len, err = -1;

+ if (is_kallsyms)
+ realname = (char *)name;
+ else
+ realname = realpath(name, NULL);
+
if (realname == NULL || filename == NULL || linkname == NULL)
goto out_free;

@@ -306,7 +310,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
if (symlink(targetname, linkname) == 0)
err = 0;
out_free:
- free(realname);
+ if (!is_kallsyms)
+ free(realname);
free(filename);
free(linkname);
return err;
--
1.6.2.5

2011-03-10 06:34:31

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL 0/1] perf/urgent fix


* Arnaldo Carvalho de Melo <[email protected]> wrote:

> Hi Ingo,
>
> Please consider pulling from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent
>
> Regards,
>
> - Arnaldo
>
> Lin Ming (1):
> perf symbols: Avoid resolving [kernel.kallsyms] to real path for buildid cache
>
> tools/perf/util/header.c | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)

Pulled, thanks a lot Arnaldo!

Ingo