提交 4d004365 编写于 作者: A Adrian Hunter 提交者: Arnaldo Carvalho de Melo

perf machine: Fix map_groups__split_kallsyms() for entry trampoline symbols

When kernel symbols are derived from /proc/kallsyms only (not using
vmlinux or /proc/kcore) map_groups__split_kallsyms() is used. However
that function makes assumptions that are not true with entry trampoline
symbols. For now, remove the entry trampoline symbols at that point, as
they are no longer needed at that point.
Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/1526986485-6562-7-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 4d99e413
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <pthread.h> #include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <stdbool.h> #include <stdbool.h>
#include <linux/types.h> #include <linux/types.h>
#include "rwsem.h" #include "rwsem.h"
...@@ -239,4 +240,11 @@ static inline bool __map__is_kmodule(const struct map *map) ...@@ -239,4 +240,11 @@ static inline bool __map__is_kmodule(const struct map *map)
bool map__has_symbols(const struct map *map); bool map__has_symbols(const struct map *map);
#define ENTRY_TRAMPOLINE_NAME "__entry_SYSCALL_64_trampoline"
static inline bool is_entry_trampoline(const char *name)
{
return !strcmp(name, ENTRY_TRAMPOLINE_NAME);
}
#endif /* __PERF_MAP_H */ #endif /* __PERF_MAP_H */
...@@ -737,12 +737,15 @@ static int map_groups__split_kallsyms(struct map_groups *kmaps, struct dso *dso, ...@@ -737,12 +737,15 @@ static int map_groups__split_kallsyms(struct map_groups *kmaps, struct dso *dso,
struct rb_root *root = &dso->symbols; struct rb_root *root = &dso->symbols;
struct rb_node *next = rb_first(root); struct rb_node *next = rb_first(root);
int kernel_range = 0; int kernel_range = 0;
bool x86_64;
if (!kmaps) if (!kmaps)
return -1; return -1;
machine = kmaps->machine; machine = kmaps->machine;
x86_64 = machine__is(machine, "x86_64");
while (next) { while (next) {
char *module; char *module;
...@@ -790,6 +793,16 @@ static int map_groups__split_kallsyms(struct map_groups *kmaps, struct dso *dso, ...@@ -790,6 +793,16 @@ static int map_groups__split_kallsyms(struct map_groups *kmaps, struct dso *dso,
*/ */
pos->start = curr_map->map_ip(curr_map, pos->start); pos->start = curr_map->map_ip(curr_map, pos->start);
pos->end = curr_map->map_ip(curr_map, pos->end); pos->end = curr_map->map_ip(curr_map, pos->end);
} else if (x86_64 && is_entry_trampoline(pos->name)) {
/*
* These symbols are not needed anymore since the
* trampoline maps refer to the text section and it's
* symbols instead. Avoid having to deal with
* relocations, and the assumption that the first symbol
* is the start of kernel text, by simply removing the
* symbols at this point.
*/
goto discard_symbol;
} else if (curr_map != initial_map) { } else if (curr_map != initial_map) {
char dso_name[PATH_MAX]; char dso_name[PATH_MAX];
struct dso *ndso; struct dso *ndso;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册