]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
perf unwind: Add initialized arg into unwind__prepare_access
authorJiri Olsa <jolsa@kernel.org>
Mon, 4 Jul 2016 12:16:22 +0000 (14:16 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 4 Jul 2016 23:27:12 +0000 (20:27 -0300)
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>
tools/perf/util/thread.c
tools/perf/util/unwind-libunwind.c
tools/perf/util/unwind.h

index f30f9566fddc6eac3b00fd66c71e304c0bd9b5d2..2439b122a4e4ab8b421ffbf72a0db23f428c8e2e 100644 (file)
@@ -202,7 +202,7 @@ int thread__insert_map(struct thread *thread, struct map *map)
 {
        int ret;
 
-       ret = unwind__prepare_access(thread, map);
+       ret = unwind__prepare_access(thread, map, NULL);
        if (ret)
                return ret;
 
index 854711966cad2e5770c620e1504abf9631819e11..6d542a4e0648eeabb0cb58eda0cefbfa03d1028a 100644 (file)
@@ -14,15 +14,19 @@ static void unwind__register_ops(struct thread *thread,
        thread->unwind_libunwind_ops = ops;
 }
 
-int unwind__prepare_access(struct thread *thread, struct map *map)
+int unwind__prepare_access(struct thread *thread, struct map *map,
+                          bool *initialized)
 {
        const char *arch;
        enum dso_type dso_type;
        struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops;
+       int err;
 
        if (thread->addr_space) {
                pr_debug("unwind: thread map already set, dso=%s\n",
                         map->dso->name);
+               if (initialized)
+                       *initialized = true;
                return 0;
        }
 
@@ -51,7 +55,10 @@ int unwind__prepare_access(struct thread *thread, struct map *map)
 out_register:
        unwind__register_ops(thread, ops);
 
-       return thread->unwind_libunwind_ops->prepare_access(thread);
+       err = thread->unwind_libunwind_ops->prepare_access(thread);
+       if (initialized)
+               *initialized = err ? false : true;
+       return err;
 }
 
 void unwind__flush_access(struct thread *thread)
index 84c6d44d52f98d9c6c7e4997ab6f812f68b414f8..61fb1e90ff5166c6c1f50f8446650cf302aa610d 100644 (file)
@@ -42,12 +42,14 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 #endif
 
 int LIBUNWIND__ARCH_REG_ID(int regnum);
-int unwind__prepare_access(struct thread *thread, struct map *map);
+int unwind__prepare_access(struct thread *thread, struct map *map,
+                          bool *initialized);
 void unwind__flush_access(struct thread *thread);
 void unwind__finish_access(struct thread *thread);
 #else
 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
-                                        struct map *map __maybe_unused)
+                                        struct map *map __maybe_unused,
+                                        bool *initialized __maybe_unused)
 {
        return 0;
 }
@@ -67,7 +69,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
 }
 
 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
-                                        struct map *map __maybe_unused)
+                                        struct map *map __maybe_unused,
+                                        bool *initialized __maybe_unused)
 {
        return 0;
 }