diff options
author | Namhyung Kim <namhyung@kernel.org> | 2017-06-08 03:31:09 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-08 14:39:34 -0400 |
commit | b89fe63fbafe307fb72546f7a2320380bf41bdd4 (patch) | |
tree | 934af0584c153c28d39aa2057e05d05cf939adca /tools | |
parent | c25ec42f846f702f8f532fbc890171e3a1f6ec85 (diff) |
perf symbols: Kill dso__build_id_is_kmod()
The commit e7ee40475760 ("perf symbols: Fix symbols searching for module
in buildid-cache") added the function to check kernel modules reside in
the build-id cache. This was because there's no way to identify a DSO
which is actually a kernel module. So it searched linkname of the file
and find ".ko" suffix.
But this does not work for compressed kernel modules and now such DSOs
hCcave correct symtab_type now. So no need to check it anymore. This
patch essentially reverts the commit.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-10-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/build-id.c | 45 | ||||
-rw-r--r-- | tools/perf/util/build-id.h | 1 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 4 |
3 files changed, 0 insertions, 50 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 168cc49654e7..e0148b081bdf 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c | |||
@@ -278,51 +278,6 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) | |||
278 | return bf; | 278 | return bf; |
279 | } | 279 | } |
280 | 280 | ||
281 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size) | ||
282 | { | ||
283 | char *id_name = NULL, *ch; | ||
284 | struct stat sb; | ||
285 | char sbuild_id[SBUILD_ID_SIZE]; | ||
286 | |||
287 | if (!dso->has_build_id) | ||
288 | goto err; | ||
289 | |||
290 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); | ||
291 | id_name = build_id_cache__linkname(sbuild_id, NULL, 0); | ||
292 | if (!id_name) | ||
293 | goto err; | ||
294 | if (access(id_name, F_OK)) | ||
295 | goto err; | ||
296 | if (lstat(id_name, &sb) == -1) | ||
297 | goto err; | ||
298 | if ((size_t)sb.st_size > size - 1) | ||
299 | goto err; | ||
300 | if (readlink(id_name, bf, size - 1) < 0) | ||
301 | goto err; | ||
302 | |||
303 | bf[sb.st_size] = '\0'; | ||
304 | |||
305 | /* | ||
306 | * link should be: | ||
307 | * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92 | ||
308 | */ | ||
309 | ch = strrchr(bf, '/'); | ||
310 | if (!ch) | ||
311 | goto err; | ||
312 | if (ch - 3 < bf) | ||
313 | goto err; | ||
314 | |||
315 | free(id_name); | ||
316 | return strncmp(".ko", ch - 3, 3) == 0; | ||
317 | err: | ||
318 | pr_err("Invalid build id: %s\n", id_name ? : | ||
319 | dso->long_name ? : | ||
320 | dso->short_name ? : | ||
321 | "[unknown]"); | ||
322 | free(id_name); | ||
323 | return false; | ||
324 | } | ||
325 | |||
326 | #define dsos__for_each_with_build_id(pos, head) \ | 281 | #define dsos__for_each_with_build_id(pos, head) \ |
327 | list_for_each_entry(pos, head, node) \ | 282 | list_for_each_entry(pos, head, node) \ |
328 | if (!pos->has_build_id) \ | 283 | if (!pos->has_build_id) \ |
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h index 8a89b195c1fc..96690a55c62c 100644 --- a/tools/perf/util/build-id.h +++ b/tools/perf/util/build-id.h | |||
@@ -17,7 +17,6 @@ char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, | |||
17 | size_t size); | 17 | size_t size); |
18 | 18 | ||
19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); | 19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); |
20 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size); | ||
21 | 20 | ||
22 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, | 21 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, |
23 | struct perf_sample *sample, struct perf_evsel *evsel, | 22 | struct perf_sample *sample, struct perf_evsel *evsel, |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 8f2b068ff756..e7a98dbd2aed 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1562,10 +1562,6 @@ int dso__load(struct dso *dso, struct map *map) | |||
1562 | if (!runtime_ss && syms_ss) | 1562 | if (!runtime_ss && syms_ss) |
1563 | runtime_ss = syms_ss; | 1563 | runtime_ss = syms_ss; |
1564 | 1564 | ||
1565 | if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
1566 | if (dso__build_id_is_kmod(dso, name, PATH_MAX)) | ||
1567 | kmod = true; | ||
1568 | |||
1569 | if (syms_ss) | 1565 | if (syms_ss) |
1570 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); | 1566 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
1571 | else | 1567 | else |