linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Mike Galbraith" <efault@gmx.de>,
	"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
	"Paul Mackerras" <paulus@samba.org>
Subject: [PATCH 9/9] perf symbols: Ditch vdso global variable
Date: Wed, 27 Jan 2010 21:05:57 -0200	[thread overview]
Message-ID: <1264633557-17597-9-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1264633557-17597-1-git-send-email-acme@infradead.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

We can check using strcmp, most DSOs don't start with '[' so the test is
cheap enough and we had to test it there anyway since when reading
perf.data files we weren't calling the routine that created this global
variable and thus weren't setting it as "loaded", which was causing a
bogus:

Failed to open [vdso], continuing without symbols

Message as the first line of 'perf report'.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/map.c    |    7 ++++++-
 tools/perf/util/symbol.c |   26 ++++----------------------
 tools/perf/util/symbol.h |    6 +++++-
 3 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 36ff0bf..f6626cc 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -68,8 +68,13 @@ struct map *map__new(struct mmap_event *event, enum map_type type,
 		map__init(self, type, event->start, event->start + event->len,
 			  event->pgoff, dso);
 
-		if (self->dso == vdso || anon)
+		if (anon) {
+set_identity:
 			self->map_ip = self->unmap_ip = identity__map_ip;
+		} else if (strcmp(filename, "[vdso]") == 0) {
+			dso__set_loaded(dso, self->type);
+			goto set_identity;
+		}
 	}
 	return self;
 out_delete:
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 051d71b..e752837 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -53,11 +53,6 @@ bool dso__sorted_by_name(const struct dso *self, enum map_type type)
 	return self->sorted_by_name & (1 << type);
 }
 
-static void dso__set_loaded(struct dso *self, enum map_type type)
-{
-	self->loaded |= (1 << type);
-}
-
 static void dso__set_sorted_by_name(struct dso *self, enum map_type type)
 {
 	self->sorted_by_name |= (1 << type);
@@ -1697,7 +1692,6 @@ out_fixup:
 
 LIST_HEAD(dsos__user);
 LIST_HEAD(dsos__kernel);
-struct dso *vdso;
 
 static void dsos__add(struct list_head *head, struct dso *dso)
 {
@@ -1790,24 +1784,12 @@ static struct dso *dsos__create_kernel(const char *vmlinux)
 {
 	struct dso *kernel = dso__new_kernel(vmlinux);
 
-	if (kernel == NULL)
-		return NULL;
-
-	vdso = dso__new("[vdso]");
-	if (vdso == NULL)
-		goto out_delete_kernel_dso;
-	dso__set_loaded(vdso, MAP__FUNCTION);
-
-	dso__read_running_kernel_build_id(kernel);
-
-	dsos__add(&dsos__kernel, kernel);
-	dsos__add(&dsos__user, vdso);
+	if (kernel != NULL) {
+		dso__read_running_kernel_build_id(kernel);
+		dsos__add(&dsos__kernel, kernel);
+	}
 
 	return kernel;
-
-out_delete_kernel_dso:
-	dso__delete(kernel);
-	return NULL;
 }
 
 int __map_groups__create_kernel_maps(struct map_groups *self,
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index e6a59e5..e90568a 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -121,6 +121,11 @@ void dso__delete(struct dso *self);
 bool dso__loaded(const struct dso *self, enum map_type type);
 bool dso__sorted_by_name(const struct dso *self, enum map_type type);
 
+static inline void dso__set_loaded(struct dso *self, enum map_type type)
+{
+	self->loaded |= (1 << type);
+}
+
 void dso__sort_by_name(struct dso *self, enum map_type type);
 
 extern struct list_head dsos__user, dsos__kernel;
@@ -161,5 +166,4 @@ int kallsyms__parse(const char *filename, void *arg,
 int symbol__init(void);
 bool symbol_type__is_a(char symbol_type, enum map_type map_type);
 
-extern struct dso *vdso;
 #endif /* __PERF_SYMBOL */
-- 
1.6.2.5


      parent reply	other threads:[~2010-01-27 23:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 23:05 [PATCH 1/9] perf top: Exit if specified --vmlinux can't be used Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 2/9] perf symbols: Factor out dso__load_vmlinux_path() Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 3/9] perf symbols: Split helpers used when creating kernel dso object Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 4/9] perf session: Create kernel maps in the constructor Arnaldo Carvalho de Melo
2010-01-27 23:17   ` Masami Hiramatsu
2010-01-27 23:29     ` Arnaldo Carvalho de Melo
2010-01-28 16:28       ` Masami Hiramatsu
2010-01-28 18:29         ` Arnaldo Carvalho de Melo
2010-01-28 20:59           ` Masami Hiramatsu
2010-01-29  0:42             ` Arnaldo Carvalho de Melo
2010-01-29  7:01               ` Masami Hiramatsu
2010-01-27 23:05 ` [PATCH 5/9] perf symbols: Remove perf_session usage in symbols layer Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 6/9] perf: Ignore perf-archive temp file Arnaldo Carvalho de Melo
2010-01-29  9:33   ` [tip:perf/core] " tip-bot for John Kacur
2010-01-29  9:39   ` tip-bot for John Kacur
2010-01-27 23:05 ` [PATCH 7/9] tools/perf/perf.c: Clean up trivial style issues Arnaldo Carvalho de Melo
2010-01-29  9:32   ` [tip:perf/core] " tip-bot for Thiago Farina
2010-01-29  9:39   ` tip-bot for Thiago Farina
2010-01-27 23:05 ` [PATCH 8/9] perf symbols: Fixup vsyscall maps Arnaldo Carvalho de Melo
2010-01-27 23:05 ` Arnaldo Carvalho de Melo [this message]

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=1264633557-17597-9-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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).