public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Nelson Elhage <nelhage@nelhage.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
	hpa@zytor.com, mingo@redhat.com, a.p.zijlstra@chello.nl,
	nelhage@nelhage.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf: builtin-record: Provide advice if mmap' ing fails with EPERM.
Date: Thu, 29 Dec 2011 12:50:01 -0800	[thread overview]
Message-ID: <tip-18e6093904abfd51671ff5846c2fdaba9ebbf21b@git.kernel.org> (raw)
In-Reply-To: <1324301972-22740-3-git-send-email-nelhage@nelhage.com>

Commit-ID:  18e6093904abfd51671ff5846c2fdaba9ebbf21b
Gitweb:     http://git.kernel.org/tip/18e6093904abfd51671ff5846c2fdaba9ebbf21b
Author:     Nelson Elhage <nelhage@nelhage.com>
AuthorDate: Mon, 19 Dec 2011 08:39:31 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 23 Dec 2011 16:44:34 -0200

perf: builtin-record: Provide advice if mmap'ing fails with EPERM.

This failure is most likely due to running up against the
kernel.perf_event_mlock_kb sysctl, so we can tell the user what to do to
fix the issue.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1324301972-22740-3-git-send-email-nelhage@nelhage.com
Signed-off-by: Nelson Elhage <nelhage@nelhage.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f8fd14f..56bb447 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -272,8 +272,15 @@ try_again:
 		exit(-1);
 	}
 
-	if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0)
+	if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0) {
+		if (errno == EPERM)
+			die("Permission error mapping pages.\n"
+			    "Consider increasing "
+			    "/proc/sys/kernel/perf_event_mlock_kb,\n"
+			    "or try again with a smaller value of -m/--mmap_pages.\n"
+			    "(current value: %d)\n", opts->mmap_pages);
 		die("failed to mmap with %d (%s)\n", errno, strerror(errno));
+	}
 
 	if (rec->file_new)
 		session->evlist = evlist;

  reply	other threads:[~2011-12-29 20:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 13:39 [PATCH 0/3] perf: builtin-record: Be more helpful when running up against mlock limits Nelson Elhage
2011-12-19 13:39 ` [PATCH 1/3] perf: __perf_evlist__mmap: Fix errno value on failed map Nelson Elhage
2011-12-19 15:33   ` Namhyung Kim
2011-12-19 16:29     ` Arnaldo Carvalho de Melo
2011-12-20 17:55     ` Arnaldo Carvalho de Melo
2011-12-21  8:43   ` [tip:perf/core] perf evlist: Fix errno value reporting on failed mmap tip-bot for Nelson Elhage
2011-12-19 13:39 ` [PATCH 2/3] perf: builtin-record: Provide advice if mmap'ing fails with EPERM Nelson Elhage
2011-12-29 20:50   ` tip-bot for Nelson Elhage [this message]
2011-12-19 13:39 ` [PATCH 3/3] perf: builtin-record: Document and check that mmap_pages must be a power of two Nelson Elhage
2011-12-29 20:50   ` [tip:perf/core] " tip-bot for Nelson Elhage

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=tip-18e6093904abfd51671ff5846c2fdaba9ebbf21b@git.kernel.org \
    --to=nelhage@nelhage.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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