* [PATCH 0/2] *** SUBJECT HERE ***
@ 2010-11-29 17:56 Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 1/2] perf symbols: Fix kallsyms kernel/module map splitting Arnaldo Carvalho de Melo
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-11-29 17:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
Ian Munsie, Ingo Molnar, Mike Galbraith, Ming Lei, Paul Mackerras,
Peter Zijlstra, Stephane Eranian, Thomas Gleixner, Tom Zanussi
*** BLURB HERE ***
Arnaldo Carvalho de Melo (1):
perf symbols: Fix kallsyms kernel/module map splitting
Ming Lei (1):
perf symbols: Figure out start address of kernel map from kallsyms
tools/perf/util/symbol.c | 59 +++++++++++++++++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] perf symbols: Fix kallsyms kernel/module map splitting
2010-11-29 17:56 [PATCH 0/2] *** SUBJECT HERE *** Arnaldo Carvalho de Melo
@ 2010-11-29 17:56 ` Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 2/2] perf symbols: Figure out start address of kernel map from kallsyms Arnaldo Carvalho de Melo
2010-11-29 18:53 ` [PATCH 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
2 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-11-29 17:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
Ingo Molnar, Mike Galbraith, Ming Lei, Paul Mackerras,
Peter Zijlstra, Stephane Eranian, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
On ARM, module addresss space is ahead of kernel space, so the module
symbols are handled before kernel symbol in dso__split_kallsyms, then
was causing one map to be created for each kernel symbol.
Reported-by: Ming Lei <tom.leiming@gmail.com>
Tested-by: Ming Lei <tom.leiming@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <20101124144540.GB15875@ghostprotocols.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0500895..2af4d7d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -532,7 +532,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
struct machine *machine = kmaps->machine;
struct map *curr_map = map;
struct symbol *pos;
- int count = 0;
+ int count = 0, moved = 0;
struct rb_root *root = &self->symbols[map->type];
struct rb_node *next = rb_first(root);
int kernel_range = 0;
@@ -590,6 +590,11 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
char dso_name[PATH_MAX];
struct dso *dso;
+ if (count == 0) {
+ curr_map = map;
+ goto filter_symbol;
+ }
+
if (self->kernel == DSO_TYPE_GUEST_KERNEL)
snprintf(dso_name, sizeof(dso_name),
"[guest.kernel].%d",
@@ -615,7 +620,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
map_groups__insert(kmaps, curr_map);
++kernel_range;
}
-
+filter_symbol:
if (filter && filter(curr_map, pos)) {
discard_symbol: rb_erase(&pos->rb_node, root);
symbol__delete(pos);
@@ -623,8 +628,9 @@ discard_symbol: rb_erase(&pos->rb_node, root);
if (curr_map != map) {
rb_erase(&pos->rb_node, root);
symbols__insert(&curr_map->dso->symbols[curr_map->type], pos);
- }
- count++;
+ ++moved;
+ } else
+ ++count;
}
}
@@ -634,7 +640,7 @@ discard_symbol: rb_erase(&pos->rb_node, root);
dso__set_loaded(curr_map->dso, curr_map->type);
}
- return count;
+ return count + moved;
}
int dso__load_kallsyms(struct dso *self, const char *filename,
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] perf symbols: Figure out start address of kernel map from kallsyms
2010-11-29 17:56 [PATCH 0/2] *** SUBJECT HERE *** Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 1/2] perf symbols: Fix kallsyms kernel/module map splitting Arnaldo Carvalho de Melo
@ 2010-11-29 17:56 ` Arnaldo Carvalho de Melo
2010-11-29 18:53 ` [PATCH 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
2 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-11-29 17:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Ming Lei, Ian Munsie, Ingo Molnar, Paul Mackerras,
Peter Zijlstra, Thomas Gleixner, Tom Zanussi,
Arnaldo Carvalho de Melo
From: Ming Lei <tom.leiming@gmail.com>
On ARM, module symbol start address is ahead of kernel symbol start address, so
we can't suppose that the start address of kernel map always is zero, otherwise
may cause incorrect .start and .end of kernel map (caused by fixup) when there
are modules loaded, then map_groups__find may return incorrect map for symbol
query.
This patch always figures out the start address of kernel map from
/proc/kallsyms if the file is available, so fix the issues on ARM for module
loaded case.
This patch fixes the following issues on ARM when modules are loaded:
- vmlinux symbol can't be found by kallsyms maps doing 'perf test'
- module symbols are parsed mistakenlly when doing 'perf top'/'perf report'
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <20101125192725.62d31b42@tom-lei>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2af4d7d..d628c8d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2131,14 +2131,55 @@ static struct dso *machine__create_kernel(struct machine *self)
return kernel;
}
+struct process_args {
+ u64 start;
+};
+
+static int symbol__in_kernel(void *arg, const char *name,
+ char type __used, u64 start)
+{
+ struct process_args *args = arg;
+
+ if (strchr(name, '['))
+ return 0;
+
+ args->start = start;
+ return 1;
+}
+
+/* Figure out the start address of kernel map from /proc/kallsyms */
+static u64 machine__get_kernel_start_addr(struct machine *machine)
+{
+ const char *filename;
+ char path[PATH_MAX];
+ struct process_args args;
+
+ if (machine__is_host(machine)) {
+ filename = "/proc/kallsyms";
+ } else {
+ if (machine__is_default_guest(machine))
+ filename = (char *)symbol_conf.default_guest_kallsyms;
+ else {
+ sprintf(path, "%s/proc/kallsyms", machine->root_dir);
+ filename = path;
+ }
+ }
+
+ if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0)
+ return 0;
+
+ return args.start;
+}
+
int __machine__create_kernel_maps(struct machine *self, struct dso *kernel)
{
enum map_type type;
+ u64 start = machine__get_kernel_start_addr(self);
for (type = 0; type < MAP__NR_TYPES; ++type) {
struct kmap *kmap;
- self->vmlinux_maps[type] = map__new2(0, kernel, type);
+ self->vmlinux_maps[type] = map__new2(start, kernel, type);
if (self->vmlinux_maps[type] == NULL)
return -1;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] perf/urgent fixes
2010-11-29 17:56 [PATCH 0/2] *** SUBJECT HERE *** Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 1/2] perf symbols: Fix kallsyms kernel/module map splitting Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 2/2] perf symbols: Figure out start address of kernel map from kallsyms Arnaldo Carvalho de Melo
@ 2010-11-29 18:53 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-11-29 18:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Frederic Weisbecker, Ian Munsie, Mike Galbraith,
Ming Lei, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
Thomas Gleixner, Tom Zanussi
ENOCOFFEE :-\ Sorry
Hi Ingo,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent
Regards,
- Arnaldo
Em Mon, Nov 29, 2010 at 03:56:10PM -0200, Arnaldo Carvalho de Melo escreveu:
> *** BLURB HERE ***
>
> Arnaldo Carvalho de Melo (1):
> perf symbols: Fix kallsyms kernel/module map splitting
>
> Ming Lei (1):
> perf symbols: Figure out start address of kernel map from kallsyms
>
> tools/perf/util/symbol.c | 59 +++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 53 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] perf/urgent fixes
@ 2011-03-16 19:48 Arnaldo Carvalho de Melo
2011-03-17 8:11 ` Ingo Molnar
0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-03-16 19:48 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Hitoshi Mitake,
Ingo Molnar, Josh Hunt, Marcin Slusarz, Paul Mackerras,
Peter Zijlstra, stable, Tapan Dhimant, Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent
Regards,
- Arnaldo
Josh Hunt (1):
perf tools: Version incorrect with some versions of grep
Marcin Slusarz (1):
perf lock: Fix sorting by wait_min
tools/perf/builtin-lock.c | 13 ++++++++++++-
tools/perf/util/PERF-VERSION-GEN | 8 ++++----
2 files changed, 16 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] perf/urgent fixes
2011-03-16 19:48 Arnaldo Carvalho de Melo
@ 2011-03-17 8:11 ` Ingo Molnar
0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2011-03-17 8:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Hitoshi Mitake, Josh Hunt, Marcin Slusarz,
Paul Mackerras, Peter Zijlstra, stable, Tapan Dhimant,
Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> Hi Ingo,
>
> Please consider pulling from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent
>
> Regards,
>
> - Arnaldo
>
> Josh Hunt (1):
> perf tools: Version incorrect with some versions of grep
>
> Marcin Slusarz (1):
> perf lock: Fix sorting by wait_min
>
> tools/perf/builtin-lock.c | 13 ++++++++++++-
> tools/perf/util/PERF-VERSION-GEN | 8 ++++----
> 2 files changed, 16 insertions(+), 5 deletions(-)
Pulled, thanks Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-17 8:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29 17:56 [PATCH 0/2] *** SUBJECT HERE *** Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 1/2] perf symbols: Fix kallsyms kernel/module map splitting Arnaldo Carvalho de Melo
2010-11-29 17:56 ` [PATCH 2/2] perf symbols: Figure out start address of kernel map from kallsyms Arnaldo Carvalho de Melo
2010-11-29 18:53 ` [PATCH 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
-- strict thread matches above, loose matches on Subject: below --
2011-03-16 19:48 Arnaldo Carvalho de Melo
2011-03-17 8:11 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox