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>,
	"Masami Hiramatsu" <mhiramat@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 4/9] perf session: Create kernel maps in the constructor
Date: Wed, 27 Jan 2010 21:05:52 -0200	[thread overview]
Message-ID: <1264633557-17597-4-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>

Removing one extra step needed in the tools that need this, fixing a bug
in 'perf probe' where this was not being done.

Cc: Masami Hiramatsu <mhiramat@redhat.com>
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/builtin-kmem.c   |    5 -----
 tools/perf/builtin-record.c |    5 -----
 tools/perf/builtin-top.c    |    5 -----
 tools/perf/util/session.c   |   13 +++++++++++--
 4 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index e8d716b..5d5dc6b 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -491,11 +491,6 @@ static int __cmd_kmem(void)
 	if (!perf_session__has_traces(session, "kmem record"))
 		goto out_delete;
 
-	if (perf_session__create_kernel_maps(session) < 0) {
-		pr_err("Problems creating kernel maps\n");
-		return -1;
-	}
-
 	setup_pager();
 	err = perf_session__process_events(session, &event_ops);
 	if (err != 0)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 7bb9ca1..9034522 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -477,11 +477,6 @@ static int __cmd_record(int argc, const char **argv)
 		return -1;
 	}
 
-	if (perf_session__create_kernel_maps(session) < 0) {
-		pr_err("Problems creating kernel maps\n");
-		return -1;
-	}
-
 	if (!file_new) {
 		err = perf_header__read(&session->header, output);
 		if (err < 0)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 78f9c45..1fc018e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1191,11 +1191,6 @@ static int __cmd_top(void)
 	if (session == NULL)
 		return -ENOMEM;
 
-	if (perf_session__create_kernel_maps(session) < 0) {
-		pr_err("Problems creating kernel maps\n");
-		return -1;
-	}
-
 	if (target_pid != -1)
 		event__synthesize_thread(target_pid, event__process, session);
 	else
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 1951e33..8e7c189 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -70,8 +70,17 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
 	self->unknown_events = 0;
 	map_groups__init(&self->kmaps);
 
-	if (mode == O_RDONLY && perf_session__open(self, force) < 0)
-		goto out_delete;
+	if (mode == O_RDONLY) {
+		if (perf_session__open(self, force) < 0)
+			goto out_delete;
+	} else if (mode == O_WRONLY) {
+		/*
+		 * In O_RDONLY mode this will be performed when reading the
+		 * kernel MMAP event, in event__process_mmap().
+		 */
+		if (perf_session__create_kernel_maps(self) < 0)
+			goto out_delete;
+	}
 
 	self->sample_type = perf_header__sample_type(&self->header);
 out:
-- 
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 ` Arnaldo Carvalho de Melo [this message]
2010-01-27 23:17   ` [PATCH 4/9] perf session: Create kernel maps in the constructor 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 ` [PATCH 9/9] perf symbols: Ditch vdso global variable Arnaldo Carvalho de Melo

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-4-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=mhiramat@redhat.com \
    --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).