diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-19 11:12:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-19 11:38:56 -0400 |
commit | e02092b9a922f17e951b2df5f12f4aafe7383a21 (patch) | |
tree | bbcccedf69f950f1a29346ae611b14557f36adfb /tools | |
parent | 2cc4666927402ec748122cac15ceac35a5e298a3 (diff) |
perf symbols: Allow loading kallsyms without considering kcore files
Before the support for using /proc/kcore was introduced, the kallsyms
routines used /proc/modules and the first 'perf test' entry expected
finding maps for each module in the system, which is not the case with
the kcore code. Provide a way to ignore kcore files so that the test can
have its expectations met.
Improving the test to cover kcore files as well needs to be done.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ek5urnu103dlhfk4l6pcw041@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/machine.c | 12 | ||||
-rw-r--r-- | tools/perf/util/machine.h | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 12 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 2 |
4 files changed, 22 insertions, 6 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 52b51e004fe8..656c1d7ee7d4 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -908,11 +908,11 @@ int machines__create_kernel_maps(struct machines *machines, pid_t pid) | |||
908 | return machine__create_kernel_maps(machine); | 908 | return machine__create_kernel_maps(machine); |
909 | } | 909 | } |
910 | 910 | ||
911 | int machine__load_kallsyms(struct machine *machine, const char *filename, | 911 | int __machine__load_kallsyms(struct machine *machine, const char *filename, |
912 | enum map_type type, symbol_filter_t filter) | 912 | enum map_type type, bool no_kcore, symbol_filter_t filter) |
913 | { | 913 | { |
914 | struct map *map = machine__kernel_map(machine); | 914 | struct map *map = machine__kernel_map(machine); |
915 | int ret = dso__load_kallsyms(map->dso, filename, map, filter); | 915 | int ret = __dso__load_kallsyms(map->dso, filename, map, no_kcore, filter); |
916 | 916 | ||
917 | if (ret > 0) { | 917 | if (ret > 0) { |
918 | dso__set_loaded(map->dso, type); | 918 | dso__set_loaded(map->dso, type); |
@@ -927,6 +927,12 @@ int machine__load_kallsyms(struct machine *machine, const char *filename, | |||
927 | return ret; | 927 | return ret; |
928 | } | 928 | } |
929 | 929 | ||
930 | int machine__load_kallsyms(struct machine *machine, const char *filename, | ||
931 | enum map_type type, symbol_filter_t filter) | ||
932 | { | ||
933 | return __machine__load_kallsyms(machine, filename, type, false, filter); | ||
934 | } | ||
935 | |||
930 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, | 936 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, |
931 | symbol_filter_t filter) | 937 | symbol_filter_t filter) |
932 | { | 938 | { |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index 382873bdc563..4822de5e4544 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
@@ -215,6 +215,8 @@ struct symbol *machine__find_kernel_function_by_name(struct machine *machine, | |||
215 | struct map *machine__findnew_module_map(struct machine *machine, u64 start, | 215 | struct map *machine__findnew_module_map(struct machine *machine, u64 start, |
216 | const char *filename); | 216 | const char *filename); |
217 | 217 | ||
218 | int __machine__load_kallsyms(struct machine *machine, const char *filename, | ||
219 | enum map_type type, bool no_kcore, symbol_filter_t filter); | ||
218 | int machine__load_kallsyms(struct machine *machine, const char *filename, | 220 | int machine__load_kallsyms(struct machine *machine, const char *filename, |
219 | enum map_type type, symbol_filter_t filter); | 221 | enum map_type type, symbol_filter_t filter); |
220 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, | 222 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index a36823c3b7c0..415c4f6d98fd 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1208,8 +1208,8 @@ static int kallsyms__delta(struct map *map, const char *filename, u64 *delta) | |||
1208 | return 0; | 1208 | return 0; |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | int dso__load_kallsyms(struct dso *dso, const char *filename, | 1211 | int __dso__load_kallsyms(struct dso *dso, const char *filename, |
1212 | struct map *map, symbol_filter_t filter) | 1212 | struct map *map, bool no_kcore, symbol_filter_t filter) |
1213 | { | 1213 | { |
1214 | u64 delta = 0; | 1214 | u64 delta = 0; |
1215 | 1215 | ||
@@ -1230,12 +1230,18 @@ int dso__load_kallsyms(struct dso *dso, const char *filename, | |||
1230 | else | 1230 | else |
1231 | dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; | 1231 | dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; |
1232 | 1232 | ||
1233 | if (!dso__load_kcore(dso, map, filename)) | 1233 | if (!no_kcore && !dso__load_kcore(dso, map, filename)) |
1234 | return dso__split_kallsyms_for_kcore(dso, map, filter); | 1234 | return dso__split_kallsyms_for_kcore(dso, map, filter); |
1235 | else | 1235 | else |
1236 | return dso__split_kallsyms(dso, map, delta, filter); | 1236 | return dso__split_kallsyms(dso, map, delta, filter); |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | int dso__load_kallsyms(struct dso *dso, const char *filename, | ||
1240 | struct map *map, symbol_filter_t filter) | ||
1241 | { | ||
1242 | return __dso__load_kallsyms(dso, filename, map, false, filter); | ||
1243 | } | ||
1244 | |||
1239 | static int dso__load_perf_map(struct dso *dso, struct map *map, | 1245 | static int dso__load_perf_map(struct dso *dso, struct map *map, |
1240 | symbol_filter_t filter) | 1246 | symbol_filter_t filter) |
1241 | { | 1247 | { |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 1da7b101bc7f..c8e43979ed5c 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -240,6 +240,8 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, | |||
240 | symbol_filter_t filter); | 240 | symbol_filter_t filter); |
241 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, | 241 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, |
242 | symbol_filter_t filter); | 242 | symbol_filter_t filter); |
243 | int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, | ||
244 | bool no_kcore, symbol_filter_t filter); | ||
243 | int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, | 245 | int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, |
244 | symbol_filter_t filter); | 246 | symbol_filter_t filter); |
245 | 247 | ||