From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754988AbcGEKVV (ORCPT ); Tue, 5 Jul 2016 06:21:21 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35290 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754854AbcGEKVS (ORCPT ); Tue, 5 Jul 2016 06:21:18 -0400 Date: Tue, 5 Jul 2016 03:21:03 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: acme@redhat.com, hpa@zytor.com, hekuang@huawei.com, jolsa@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, dsahern@gmail.com, a.p.zijlstra@chello.nl, tglx@linutronix.de, mingo@kernel.org Reply-To: acme@redhat.com, hpa@zytor.com, hekuang@huawei.com, jolsa@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de, dsahern@gmail.com, a.p.zijlstra@chello.nl In-Reply-To: <1467634583-29147-4-git-send-email-jolsa@kernel.org> References: <1467634583-29147-4-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf unwind: Add initialized arg into unwind__prepare_access Git-Commit-ID: a2873325ffb21cecca8032673eb698cb4d778dc6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a2873325ffb21cecca8032673eb698cb4d778dc6 Gitweb: http://git.kernel.org/tip/a2873325ffb21cecca8032673eb698cb4d778dc6 Author: Jiri Olsa AuthorDate: Mon, 4 Jul 2016 14:16:22 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 4 Jul 2016 20:27:12 -0300 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 Cc: David Ahern Cc: He Kuang Cc: Namhyung Kim Cc: Peter Zijlstra 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 --- tools/perf/util/thread.c | 2 +- tools/perf/util/unwind-libunwind.c | 11 +++++++++-- 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 f30f956..2439b12 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) { int ret; - ret = unwind__prepare_access(thread, map); + ret = unwind__prepare_access(thread, map, NULL); if (ret) return ret; diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 8547119..6d542a4 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, 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) diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index 84c6d44..61fb1e9 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, #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; }