2009-12-28 07:37:00 +08:00
|
|
|
#ifndef __PERF_MAP_H
|
|
|
|
#define __PERF_MAP_H
|
|
|
|
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/rbtree.h>
|
2010-03-26 06:58:58 +08:00
|
|
|
#include <stdio.h>
|
2010-04-28 08:17:50 +08:00
|
|
|
#include <stdbool.h>
|
2010-03-26 06:58:58 +08:00
|
|
|
#include "types.h"
|
2009-12-28 07:37:00 +08:00
|
|
|
|
|
|
|
enum map_type {
|
|
|
|
MAP__FUNCTION = 0,
|
|
|
|
MAP__VARIABLE,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAP__NR_TYPES (MAP__VARIABLE + 1)
|
|
|
|
|
2010-02-23 03:15:39 +08:00
|
|
|
extern const char *map_type__name[MAP__NR_TYPES];
|
|
|
|
|
2009-12-28 07:37:00 +08:00
|
|
|
struct dso;
|
2011-11-28 17:56:39 +08:00
|
|
|
struct ip_callchain;
|
2010-02-04 02:52:00 +08:00
|
|
|
struct ref_reloc_sym;
|
|
|
|
struct map_groups;
|
2010-04-28 08:17:50 +08:00
|
|
|
struct machine;
|
2011-11-28 17:56:39 +08:00
|
|
|
struct perf_evsel;
|
2009-12-28 07:37:00 +08:00
|
|
|
|
|
|
|
struct map {
|
|
|
|
union {
|
|
|
|
struct rb_node rb_node;
|
|
|
|
struct list_head node;
|
|
|
|
};
|
|
|
|
u64 start;
|
|
|
|
u64 end;
|
perf tools: Don't keep unreferenced maps when unmaps are detected
For a file with:
[root@emilia linux-2.6-tip]# perf report -D -fi allmodconfig-j32.perf.data | grep events:
TOTAL events: 36933
MMAP events: 9056
LOST events: 0
COMM events: 1702
EXIT events: 1887
THROTTLE events: 8
UNTHROTTLE events: 8
FORK events: 1894
READ events: 0
SAMPLE events: 22378
ATTR events: 0
EVENT_TYPE events: 0
TRACING_DATA events: 0
BUILD_ID events: 0
[root@emilia linux-2.6-tip]#
Testing with valgrind and making perf_session__delete() a nop, so that
we can notice how many maps were actually deleted due to not having any
samples on it:
==== HEAP SUMMARY:
Before:
==10339== in use at exit: 8,909,997 bytes in 68,690 blocks
==10339== total heap usage: 78,696 allocs, 10,007 frees, 11,925,853 bytes allocated
After:
==10506== in use at exit: 8,902,605 bytes in 68,606 blocks
==10506== total heap usage: 78,696 allocs, 10,091 frees, 11,925,853 bytes allocated
I.e. just 84 detected unmaps with no hits out of 9056 for this workload,
not much, but in some other long running workload this may save more
bytes.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-08-03 06:45:23 +08:00
|
|
|
u8 /* enum map_type */ type;
|
|
|
|
bool referenced;
|
2012-03-27 23:55:57 +08:00
|
|
|
bool erange_warned;
|
2010-04-30 02:25:23 +08:00
|
|
|
u32 priv;
|
2009-12-28 07:37:00 +08:00
|
|
|
u64 pgoff;
|
2014-01-29 22:14:36 +08:00
|
|
|
u64 reloc;
|
2013-08-21 18:10:25 +08:00
|
|
|
u32 maj, min; /* only valid for MMAP2 record */
|
|
|
|
u64 ino; /* only valid for MMAP2 record */
|
|
|
|
u64 ino_generation;/* only valid for MMAP2 record */
|
perf annotate: Fix it for non-prelinked *.so
The problem was we were incorrectly calculating objdump
addresses for sym->start and sym->end, look:
For simple ET_DYN type DSO (*.so) with one function, objdump -dS
output is something like this:
000004ac <my_strlen>:
int my_strlen(const char *s)
4ac: 55 push %ebp
4ad: 89 e5 mov %esp,%ebp
4af: 83 ec 10 sub $0x10,%esp
{
i.e. we have relative-to-dso-mapping IPs (=RIP) there.
For ET_EXEC type and probably for prelinked libs as well (sorry
can't test - I don't use prelink) objdump outputs absolute IPs,
e.g.
08048604 <zz_strlen>:
extern "C"
int zz_strlen(const char *s)
8048604: 55 push %ebp
8048605: 89 e5 mov %esp,%ebp
8048607: 83 ec 10 sub $0x10,%esp
{
So, if sym->start is always relative to dso mapping(*), we'll
have to unmap it for ET_EXEC like cases, and leave as is for
ET_DYN cases.
(*) and it is - we've explicitely made it relative. Look for
adjust_symbols handling in dso__load_sym()
Previously we were always unmapping sym->start and for ET_DYN
dsos resulting addresses were wrong, and so objdump output was
empty.
The end result was that perf annotate output for symbols from
non-prelinked *.so had always 0.00% percents only, which is
wrong.
To fix it, let's introduce a helper for converting rip to
objdump address, and also let's document what map_ip() and
unmap_ip() do -- I had to study sources for several hours to
understand it.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-04 02:52:07 +08:00
|
|
|
|
|
|
|
/* ip -> dso rip */
|
2009-12-28 07:37:00 +08:00
|
|
|
u64 (*map_ip)(struct map *, u64);
|
perf annotate: Fix it for non-prelinked *.so
The problem was we were incorrectly calculating objdump
addresses for sym->start and sym->end, look:
For simple ET_DYN type DSO (*.so) with one function, objdump -dS
output is something like this:
000004ac <my_strlen>:
int my_strlen(const char *s)
4ac: 55 push %ebp
4ad: 89 e5 mov %esp,%ebp
4af: 83 ec 10 sub $0x10,%esp
{
i.e. we have relative-to-dso-mapping IPs (=RIP) there.
For ET_EXEC type and probably for prelinked libs as well (sorry
can't test - I don't use prelink) objdump outputs absolute IPs,
e.g.
08048604 <zz_strlen>:
extern "C"
int zz_strlen(const char *s)
8048604: 55 push %ebp
8048605: 89 e5 mov %esp,%ebp
8048607: 83 ec 10 sub $0x10,%esp
{
So, if sym->start is always relative to dso mapping(*), we'll
have to unmap it for ET_EXEC like cases, and leave as is for
ET_DYN cases.
(*) and it is - we've explicitely made it relative. Look for
adjust_symbols handling in dso__load_sym()
Previously we were always unmapping sym->start and for ET_DYN
dsos resulting addresses were wrong, and so objdump output was
empty.
The end result was that perf annotate output for symbols from
non-prelinked *.so had always 0.00% percents only, which is
wrong.
To fix it, let's introduce a helper for converting rip to
objdump address, and also let's document what map_ip() and
unmap_ip() do -- I had to study sources for several hours to
understand it.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-04 02:52:07 +08:00
|
|
|
/* dso rip -> ip */
|
2009-12-28 07:37:00 +08:00
|
|
|
u64 (*unmap_ip)(struct map *, u64);
|
perf annotate: Fix it for non-prelinked *.so
The problem was we were incorrectly calculating objdump
addresses for sym->start and sym->end, look:
For simple ET_DYN type DSO (*.so) with one function, objdump -dS
output is something like this:
000004ac <my_strlen>:
int my_strlen(const char *s)
4ac: 55 push %ebp
4ad: 89 e5 mov %esp,%ebp
4af: 83 ec 10 sub $0x10,%esp
{
i.e. we have relative-to-dso-mapping IPs (=RIP) there.
For ET_EXEC type and probably for prelinked libs as well (sorry
can't test - I don't use prelink) objdump outputs absolute IPs,
e.g.
08048604 <zz_strlen>:
extern "C"
int zz_strlen(const char *s)
8048604: 55 push %ebp
8048605: 89 e5 mov %esp,%ebp
8048607: 83 ec 10 sub $0x10,%esp
{
So, if sym->start is always relative to dso mapping(*), we'll
have to unmap it for ET_EXEC like cases, and leave as is for
ET_DYN cases.
(*) and it is - we've explicitely made it relative. Look for
adjust_symbols handling in dso__load_sym()
Previously we were always unmapping sym->start and for ET_DYN
dsos resulting addresses were wrong, and so objdump output was
empty.
The end result was that perf annotate output for symbols from
non-prelinked *.so had always 0.00% percents only, which is
wrong.
To fix it, let's introduce a helper for converting rip to
objdump address, and also let's document what map_ip() and
unmap_ip() do -- I had to study sources for several hours to
understand it.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-04 02:52:07 +08:00
|
|
|
|
2009-12-28 07:37:00 +08:00
|
|
|
struct dso *dso;
|
2010-04-19 13:32:50 +08:00
|
|
|
struct map_groups *groups;
|
2009-12-28 07:37:00 +08:00
|
|
|
};
|
|
|
|
|
2010-02-04 02:52:00 +08:00
|
|
|
struct kmap {
|
|
|
|
struct ref_reloc_sym *ref_reloc_sym;
|
|
|
|
struct map_groups *kmaps;
|
|
|
|
};
|
|
|
|
|
2010-04-19 13:32:50 +08:00
|
|
|
struct map_groups {
|
2010-04-28 08:17:50 +08:00
|
|
|
struct rb_root maps[MAP__NR_TYPES];
|
|
|
|
struct list_head removed_maps[MAP__NR_TYPES];
|
|
|
|
struct machine *machine;
|
2010-04-19 13:32:50 +08:00
|
|
|
};
|
|
|
|
|
2013-01-25 08:59:59 +08:00
|
|
|
static inline struct kmap *map__kmap(struct map *map)
|
2010-02-04 02:52:00 +08:00
|
|
|
{
|
2013-01-25 08:59:59 +08:00
|
|
|
return (struct kmap *)(map + 1);
|
2010-02-04 02:52:00 +08:00
|
|
|
}
|
|
|
|
|
2009-12-28 07:37:00 +08:00
|
|
|
static inline u64 map__map_ip(struct map *map, u64 ip)
|
|
|
|
{
|
|
|
|
return ip - map->start + map->pgoff;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u64 map__unmap_ip(struct map *map, u64 ip)
|
|
|
|
{
|
|
|
|
return ip + map->start - map->pgoff;
|
|
|
|
}
|
|
|
|
|
2012-09-11 06:15:03 +08:00
|
|
|
static inline u64 identity__map_ip(struct map *map __maybe_unused, u64 ip)
|
2009-12-28 07:37:00 +08:00
|
|
|
{
|
|
|
|
return ip;
|
|
|
|
}
|
|
|
|
|
perf annotate: Fix it for non-prelinked *.so
The problem was we were incorrectly calculating objdump
addresses for sym->start and sym->end, look:
For simple ET_DYN type DSO (*.so) with one function, objdump -dS
output is something like this:
000004ac <my_strlen>:
int my_strlen(const char *s)
4ac: 55 push %ebp
4ad: 89 e5 mov %esp,%ebp
4af: 83 ec 10 sub $0x10,%esp
{
i.e. we have relative-to-dso-mapping IPs (=RIP) there.
For ET_EXEC type and probably for prelinked libs as well (sorry
can't test - I don't use prelink) objdump outputs absolute IPs,
e.g.
08048604 <zz_strlen>:
extern "C"
int zz_strlen(const char *s)
8048604: 55 push %ebp
8048605: 89 e5 mov %esp,%ebp
8048607: 83 ec 10 sub $0x10,%esp
{
So, if sym->start is always relative to dso mapping(*), we'll
have to unmap it for ET_EXEC like cases, and leave as is for
ET_DYN cases.
(*) and it is - we've explicitely made it relative. Look for
adjust_symbols handling in dso__load_sym()
Previously we were always unmapping sym->start and for ET_DYN
dsos resulting addresses were wrong, and so objdump output was
empty.
The end result was that perf annotate output for symbols from
non-prelinked *.so had always 0.00% percents only, which is
wrong.
To fix it, let's introduce a helper for converting rip to
objdump address, and also let's document what map_ip() and
unmap_ip() do -- I had to study sources for several hours to
understand it.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-04 02:52:07 +08:00
|
|
|
|
perf top: Fix annotate for userspace
First, for programs and prelinked libraries, annotate code was
fooled by objdump output IPs (src->eip in the code) being
wrongly converted to absolute IPs. In such case there were no
conversion needed, but in
src->eip = strtoull(src->line, NULL, 16);
src->eip = map->unmap_ip(map, src->eip); // = eip + map->start - map->pgoff
we were reading absolute address from objdump (e.g. 8048604) and
then almost doubling it, because eip & map->start are
approximately close for small programs.
Needless to say, that later, in record_precise_ip() there was no
matching with real runtime IPs.
And second, like with `perf annotate` the problem with
non-prelinked *.so was that we were doing rip -> objdump address
conversion wrong.
Also, because unlike `perf annotate`, `perf top` code does
annotation based on absolute IPs for performance reasons(*), new
helper for mapping objdump addresse to IP is introduced.
(*) we get samples info in absolute IPs, and since we do lots of
hit-testing on absolute IPs at runtime in record_precise_ip(), it's
better to convert objdump addresses to IPs once and do no conversion
at runtime.
I also had to fix how objdump output is parsed (with hardcoded
8/16 characters format, which was inappropriate for ET_DYN dsos
with small addresses like '4ac')
Also note, that not all objdump output lines has associtated
IPs, e.g. look at source lines here:
000004ac <my_strlen>:
extern "C"
int my_strlen(const char *s)
4ac: 55 push %ebp
4ad: 89 e5 mov %esp,%ebp
4af: 83 ec 10 sub $0x10,%esp
{
int len = 0;
4b2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
4b9: eb 08 jmp 4c3 <my_strlen+0x17>
while (*s) {
++len;
4bb: 83 45 fc 01 addl $0x1,-0x4(%ebp)
++s;
4bf: 83 45 08 01 addl $0x1,0x8(%ebp)
So we mark them with eip=0, and ignore such lines in annotate
lookup code.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
[ Note: one hunk of this patch was applied by Mike in 57d8188 ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265550376-12665-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-07 21:46:15 +08:00
|
|
|
/* rip/ip <-> addr suitable for passing to `objdump --start-address=` */
|
perf annotate: Fix it for non-prelinked *.so
The problem was we were incorrectly calculating objdump
addresses for sym->start and sym->end, look:
For simple ET_DYN type DSO (*.so) with one function, objdump -dS
output is something like this:
000004ac <my_strlen>:
int my_strlen(const char *s)
4ac: 55 push %ebp
4ad: 89 e5 mov %esp,%ebp
4af: 83 ec 10 sub $0x10,%esp
{
i.e. we have relative-to-dso-mapping IPs (=RIP) there.
For ET_EXEC type and probably for prelinked libs as well (sorry
can't test - I don't use prelink) objdump outputs absolute IPs,
e.g.
08048604 <zz_strlen>:
extern "C"
int zz_strlen(const char *s)
8048604: 55 push %ebp
8048605: 89 e5 mov %esp,%ebp
8048607: 83 ec 10 sub $0x10,%esp
{
So, if sym->start is always relative to dso mapping(*), we'll
have to unmap it for ET_EXEC like cases, and leave as is for
ET_DYN cases.
(*) and it is - we've explicitely made it relative. Look for
adjust_symbols handling in dso__load_sym()
Previously we were always unmapping sym->start and for ET_DYN
dsos resulting addresses were wrong, and so objdump output was
empty.
The end result was that perf annotate output for symbols from
non-prelinked *.so had always 0.00% percents only, which is
wrong.
To fix it, let's introduce a helper for converting rip to
objdump address, and also let's document what map_ip() and
unmap_ip() do -- I had to study sources for several hours to
understand it.
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-02-04 02:52:07 +08:00
|
|
|
u64 map__rip_2objdump(struct map *map, u64 rip);
|
|
|
|
|
2013-10-14 18:43:44 +08:00
|
|
|
/* objdump address -> memory address */
|
|
|
|
u64 map__objdump_2mem(struct map *map, u64 ip);
|
|
|
|
|
2009-12-28 07:37:00 +08:00
|
|
|
struct symbol;
|
|
|
|
|
|
|
|
typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
|
|
|
|
|
2013-01-25 08:59:59 +08:00
|
|
|
void map__init(struct map *map, enum map_type type,
|
2009-12-28 07:37:00 +08:00
|
|
|
u64 start, u64 end, u64 pgoff, struct dso *dso);
|
2010-04-19 13:32:50 +08:00
|
|
|
struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
|
2013-08-21 18:10:25 +08:00
|
|
|
u64 pgoff, u32 pid, u32 d_maj, u32 d_min, u64 ino,
|
|
|
|
u64 ino_gen,
|
|
|
|
char *filename, enum map_type type);
|
2012-08-06 12:41:20 +08:00
|
|
|
struct map *map__new2(u64 start, struct dso *dso, enum map_type type);
|
2013-01-25 08:59:59 +08:00
|
|
|
void map__delete(struct map *map);
|
|
|
|
struct map *map__clone(struct map *map);
|
2009-12-28 07:37:00 +08:00
|
|
|
int map__overlap(struct map *l, struct map *r);
|
2013-01-25 08:59:59 +08:00
|
|
|
size_t map__fprintf(struct map *map, FILE *fp);
|
2012-01-30 12:42:57 +08:00
|
|
|
size_t map__fprintf_dsoname(struct map *map, FILE *fp);
|
2013-12-06 15:42:57 +08:00
|
|
|
int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix,
|
|
|
|
FILE *fp);
|
2009-12-28 07:37:00 +08:00
|
|
|
|
2013-01-25 08:59:59 +08:00
|
|
|
int map__load(struct map *map, symbol_filter_t filter);
|
|
|
|
struct symbol *map__find_symbol(struct map *map,
|
2009-12-28 07:37:00 +08:00
|
|
|
u64 addr, symbol_filter_t filter);
|
2013-01-25 08:59:59 +08:00
|
|
|
struct symbol *map__find_symbol_by_name(struct map *map, const char *name,
|
2009-12-28 07:37:00 +08:00
|
|
|
symbol_filter_t filter);
|
2013-01-25 08:59:59 +08:00
|
|
|
void map__fixup_start(struct map *map);
|
|
|
|
void map__fixup_end(struct map *map);
|
2009-12-28 07:37:00 +08:00
|
|
|
|
2013-01-25 08:59:59 +08:00
|
|
|
void map__reloc_vmlinux(struct map *map);
|
2010-02-04 02:52:00 +08:00
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
size_t __map_groups__fprintf_maps(struct map_groups *mg,
|
2010-03-26 23:11:06 +08:00
|
|
|
enum map_type type, int verbose, FILE *fp);
|
2010-03-26 06:58:58 +08:00
|
|
|
void maps__insert(struct rb_root *maps, struct map *map);
|
2011-08-24 01:31:30 +08:00
|
|
|
void maps__remove(struct rb_root *maps, struct map *map);
|
2010-03-26 06:58:58 +08:00
|
|
|
struct map *maps__find(struct rb_root *maps, u64 addr);
|
2013-08-07 19:38:51 +08:00
|
|
|
struct map *maps__first(struct rb_root *maps);
|
|
|
|
struct map *maps__next(struct map *map);
|
2011-08-24 01:31:30 +08:00
|
|
|
void map_groups__init(struct map_groups *mg);
|
|
|
|
void map_groups__exit(struct map_groups *mg);
|
|
|
|
int map_groups__clone(struct map_groups *mg,
|
2010-03-26 23:11:06 +08:00
|
|
|
struct map_groups *parent, enum map_type type);
|
2011-08-24 01:31:30 +08:00
|
|
|
size_t map_groups__fprintf(struct map_groups *mg, int verbose, FILE *fp);
|
|
|
|
size_t map_groups__fprintf_maps(struct map_groups *mg, int verbose, FILE *fp);
|
2010-03-26 06:58:58 +08:00
|
|
|
|
2011-11-28 17:56:39 +08:00
|
|
|
int maps__set_kallsyms_ref_reloc_sym(struct map **maps, const char *symbol_name,
|
|
|
|
u64 addr);
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
static inline void map_groups__insert(struct map_groups *mg, struct map *map)
|
2010-03-26 06:58:58 +08:00
|
|
|
{
|
2011-08-24 01:31:30 +08:00
|
|
|
maps__insert(&mg->maps[map->type], map);
|
|
|
|
map->groups = mg;
|
2010-03-26 06:58:58 +08:00
|
|
|
}
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
static inline void map_groups__remove(struct map_groups *mg, struct map *map)
|
perf session: Free the ref_reloc_sym memory at the right place
Which is at perf_session__destroy_kernel_maps, counterpart to the
perf_session__create_kernel_maps where the kmap structure is located, just
after the vmlinux_maps.
Make it also check if the kernel maps were actually created, which may not
be the case if, for instance, perf_session__new can't complete due to
permission problems in, for instance, a 'perf report' case, when a
segfault will take place, that is how this was noticed.
The problem was introduced in d65a458, thus post .35.
This also adds code to release guest machines as them are also created
in perf_session__create_kernel_maps, so should be deleted on this newly
introduced counterpart, perf_session__destroy_kernel_maps.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-08-03 05:18:28 +08:00
|
|
|
{
|
2011-08-24 01:31:30 +08:00
|
|
|
maps__remove(&mg->maps[map->type], map);
|
perf session: Free the ref_reloc_sym memory at the right place
Which is at perf_session__destroy_kernel_maps, counterpart to the
perf_session__create_kernel_maps where the kmap structure is located, just
after the vmlinux_maps.
Make it also check if the kernel maps were actually created, which may not
be the case if, for instance, perf_session__new can't complete due to
permission problems in, for instance, a 'perf report' case, when a
segfault will take place, that is how this was noticed.
The problem was introduced in d65a458, thus post .35.
This also adds code to release guest machines as them are also created
in perf_session__create_kernel_maps, so should be deleted on this newly
introduced counterpart, perf_session__destroy_kernel_maps.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-08-03 05:18:28 +08:00
|
|
|
}
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
static inline struct map *map_groups__find(struct map_groups *mg,
|
2010-03-26 06:58:58 +08:00
|
|
|
enum map_type type, u64 addr)
|
|
|
|
{
|
2011-08-24 01:31:30 +08:00
|
|
|
return maps__find(&mg->maps[type], addr);
|
2010-03-26 06:58:58 +08:00
|
|
|
}
|
|
|
|
|
2013-08-07 19:38:51 +08:00
|
|
|
static inline struct map *map_groups__first(struct map_groups *mg,
|
|
|
|
enum map_type type)
|
|
|
|
{
|
|
|
|
return maps__first(&mg->maps[type]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct map *map_groups__next(struct map *map)
|
|
|
|
{
|
|
|
|
return maps__next(map);
|
|
|
|
}
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
struct symbol *map_groups__find_symbol(struct map_groups *mg,
|
2010-03-26 06:58:58 +08:00
|
|
|
enum map_type type, u64 addr,
|
2010-03-26 23:30:40 +08:00
|
|
|
struct map **mapp,
|
2010-03-26 06:58:58 +08:00
|
|
|
symbol_filter_t filter);
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg,
|
2010-03-26 23:30:40 +08:00
|
|
|
enum map_type type,
|
|
|
|
const char *name,
|
|
|
|
struct map **mapp,
|
|
|
|
symbol_filter_t filter);
|
|
|
|
|
2013-10-14 18:43:38 +08:00
|
|
|
struct addr_map_symbol;
|
|
|
|
|
|
|
|
int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter);
|
|
|
|
|
2010-03-26 23:30:40 +08:00
|
|
|
static inline
|
2011-08-24 01:31:30 +08:00
|
|
|
struct symbol *map_groups__find_function_by_name(struct map_groups *mg,
|
2010-03-26 23:30:40 +08:00
|
|
|
const char *name, struct map **mapp,
|
|
|
|
symbol_filter_t filter)
|
2010-03-26 06:58:58 +08:00
|
|
|
{
|
2011-08-24 01:31:30 +08:00
|
|
|
return map_groups__find_symbol_by_name(mg, MAP__FUNCTION, name, mapp, filter);
|
2010-03-26 06:58:58 +08:00
|
|
|
}
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map,
|
2010-03-26 23:11:06 +08:00
|
|
|
int verbose, FILE *fp);
|
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
struct map *map_groups__find_by_name(struct map_groups *mg,
|
2010-03-26 06:58:58 +08:00
|
|
|
enum map_type type, const char *name);
|
2010-04-19 13:32:50 +08:00
|
|
|
|
2011-08-24 01:31:30 +08:00
|
|
|
void map_groups__flush(struct map_groups *mg);
|
2010-03-26 06:58:58 +08:00
|
|
|
|
2009-12-28 07:37:00 +08:00
|
|
|
#endif /* __PERF_MAP_H */
|