diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-07-04 08:16:22 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-04 19:27:12 -0400 |
commit | a2873325ffb21cecca8032673eb698cb4d778dc6 (patch) | |
tree | a71d006f2ccebeefa1cd52a1e38a1dba5fa81e25 /tools | |
parent | 347ca878062d5fb0e16db1fae81b0994f2457efd (diff) |
perf unwind: Add initialized arg into unwind__prepare_access
Adding initialized arg into unwind__prepare_access to get feedback about
the initialization state.
It's not possible to get it from error code, because we return 0 even in
case we don't recognize dso, which is valid.
The 'initialized' value is used in following patch to speedup
unwind__prepare_access calls logic in fork path.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1467634583-29147-4-git-send-email-jolsa@kernel.org
[ Remove ; after static inline function signatures, fixes build break ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/thread.c | 2 | ||||
-rw-r--r-- | tools/perf/util/unwind-libunwind.c | 11 | ||||
-rw-r--r-- | tools/perf/util/unwind.h | 9 |
3 files changed, 16 insertions, 6 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index f30f9566fddc..2439b122a4e4 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -202,7 +202,7 @@ int thread__insert_map(struct thread *thread, struct map *map) | |||
202 | { | 202 | { |
203 | int ret; | 203 | int ret; |
204 | 204 | ||
205 | ret = unwind__prepare_access(thread, map); | 205 | ret = unwind__prepare_access(thread, map, NULL); |
206 | if (ret) | 206 | if (ret) |
207 | return ret; | 207 | return ret; |
208 | 208 | ||
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 854711966cad..6d542a4e0648 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
@@ -14,15 +14,19 @@ static void unwind__register_ops(struct thread *thread, | |||
14 | thread->unwind_libunwind_ops = ops; | 14 | thread->unwind_libunwind_ops = ops; |
15 | } | 15 | } |
16 | 16 | ||
17 | int unwind__prepare_access(struct thread *thread, struct map *map) | 17 | int unwind__prepare_access(struct thread *thread, struct map *map, |
18 | bool *initialized) | ||
18 | { | 19 | { |
19 | const char *arch; | 20 | const char *arch; |
20 | enum dso_type dso_type; | 21 | enum dso_type dso_type; |
21 | struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops; | 22 | struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops; |
23 | int err; | ||
22 | 24 | ||
23 | if (thread->addr_space) { | 25 | if (thread->addr_space) { |
24 | pr_debug("unwind: thread map already set, dso=%s\n", | 26 | pr_debug("unwind: thread map already set, dso=%s\n", |
25 | map->dso->name); | 27 | map->dso->name); |
28 | if (initialized) | ||
29 | *initialized = true; | ||
26 | return 0; | 30 | return 0; |
27 | } | 31 | } |
28 | 32 | ||
@@ -51,7 +55,10 @@ int unwind__prepare_access(struct thread *thread, struct map *map) | |||
51 | out_register: | 55 | out_register: |
52 | unwind__register_ops(thread, ops); | 56 | unwind__register_ops(thread, ops); |
53 | 57 | ||
54 | return thread->unwind_libunwind_ops->prepare_access(thread); | 58 | err = thread->unwind_libunwind_ops->prepare_access(thread); |
59 | if (initialized) | ||
60 | *initialized = err ? false : true; | ||
61 | return err; | ||
55 | } | 62 | } |
56 | 63 | ||
57 | void unwind__flush_access(struct thread *thread) | 64 | void unwind__flush_access(struct thread *thread) |
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index 84c6d44d52f9..61fb1e90ff51 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h | |||
@@ -42,12 +42,14 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | int LIBUNWIND__ARCH_REG_ID(int regnum); | 44 | int LIBUNWIND__ARCH_REG_ID(int regnum); |
45 | int unwind__prepare_access(struct thread *thread, struct map *map); | 45 | int unwind__prepare_access(struct thread *thread, struct map *map, |
46 | bool *initialized); | ||
46 | void unwind__flush_access(struct thread *thread); | 47 | void unwind__flush_access(struct thread *thread); |
47 | void unwind__finish_access(struct thread *thread); | 48 | void unwind__finish_access(struct thread *thread); |
48 | #else | 49 | #else |
49 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused, | 50 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused, |
50 | struct map *map __maybe_unused) | 51 | struct map *map __maybe_unused, |
52 | bool *initialized __maybe_unused) | ||
51 | { | 53 | { |
52 | return 0; | 54 | return 0; |
53 | } | 55 | } |
@@ -67,7 +69,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, | |||
67 | } | 69 | } |
68 | 70 | ||
69 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused, | 71 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused, |
70 | struct map *map __maybe_unused) | 72 | struct map *map __maybe_unused, |
73 | bool *initialized __maybe_unused) | ||
71 | { | 74 | { |
72 | return 0; | 75 | return 0; |
73 | } | 76 | } |