linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	David Ahern <dsahern@gmail.com>, He Kuang <hekuang@huawei.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 10/16] perf unwind: Add initialized arg into unwind__prepare_access
Date: Mon,  4 Jul 2016 21:38:29 -0300	[thread overview]
Message-ID: <1467679115-20496-11-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1467679115-20496-1-git-send-email-acme@kernel.org>

From: Jiri Olsa <jolsa@kernel.org>

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           |  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 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)
 {
 	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 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,
 	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 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,
 #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;
 }
-- 
2.7.4

  parent reply	other threads:[~2016-07-05  0:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05  0:38 [GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 01/16] perf probe: Use cache entry if possible Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 02/16] perf probe: Show all cached probes Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 03/16] perf probe: Remove caches when --cache is given Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 04/16] perf build: Add feature detection for libelf's elf_getshdrstrndx() Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 05/16] perf sdt: ELF support for SDT Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 06/16] perf probe: Add group name support Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 07/16] perf buildid-cache: Scan and import user SDT events to probe cache Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 08/16] perf header: Transform nodes string info to struct Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 09/16] perf tests: Fix hist accumulation test Arnaldo Carvalho de Melo
2016-07-05  0:38 ` Arnaldo Carvalho de Melo [this message]
2016-07-05  0:38 ` [PATCH 11/16] perf unwind: Call unwind__prepare_access for forked thread Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 12/16] tools lib bpf: Add license header Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 13/16] tools lib api: Respect WERROR=0 for build Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 14/16] tools lib subcmd: " Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 15/16] perf tools: Update android build documentation Arnaldo Carvalho de Melo
2016-07-05  0:38 ` [PATCH 16/16] perf tools: Sync copy of syscall_64.tbl with the kernel Arnaldo Carvalho de Melo
2016-07-05 10:14 ` [GIT PULL 00/16] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467679115-20496-11-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).