mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Dave Martin <dave.martin@linaro.org>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
	dave.martin@linaro.org, hpa@zytor.com, mingo@redhat.com,
	nicolas.pitre@linaro.org, tglx@linutronix.de,
	Will.Deacon@arm.com
Subject: [tip:perf/core] perf events: Fix mmap offset determination
Date: Thu, 5 Aug 2010 08:00:46 GMT	[thread overview]
Message-ID: <tip-b5a6325464b700c4bdac8799c495970516eed41c@git.kernel.org> (raw)
In-Reply-To: <1280836116-6654-2-git-send-email-dave.martin@linaro.org>

Commit-ID:  b5a6325464b700c4bdac8799c495970516eed41c
Gitweb:     http://git.kernel.org/tip/b5a6325464b700c4bdac8799c495970516eed41c
Author:     Dave Martin <dave.martin@linaro.org>
AuthorDate: Tue, 3 Aug 2010 12:48:35 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 4 Aug 2010 12:41:23 -0300

perf events: Fix mmap offset determination

Fix buggy-looking code which unnecessarily adjusts the file offset
fields read from /proc/*/maps.

This may have gone unnoticed since the offset is usually 0 (and the
logic in util/symbol.c may work incorrectly for other offset values).

Commiter note:

This fixes a bug introduced in 4af8b35, there is no need to shift pgoff
twice, the show_map_vma routine in fs/proc/task_mmu.c already converts
it from the number of pages to the size in bytes, and that is what
appears in /proc/PID/map.

Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Will Deacon <Will.Deacon@arm.com>
LKML-Reference: <1280836116-6654-2-git-send-email-dave.martin@linaro.org>
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 6b0db55..db8a1d4 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -151,7 +151,6 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
 			continue;
 		pbf += n + 3;
 		if (*pbf == 'x') { /* vm_exec */
-			u64 vm_pgoff;
 			char *execname = strchr(bf, '/');
 
 			/* Catch VDSO */
@@ -162,12 +161,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
 				continue;
 
 			pbf += 3;
-			n = hex2u64(pbf, &vm_pgoff);
-			/* pgoff is in bytes, not pages */
-			if (n >= 0)
-				ev.mmap.pgoff = vm_pgoff << getpagesize();
-			else
-				ev.mmap.pgoff = 0;
+			n = hex2u64(pbf, &ev.mmap.pgoff);
 
 			size = strlen(execname);
 			execname[size - 1] = '\0'; /* Remove \n */

  parent reply	other threads:[~2010-08-05  8:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03 11:48 [PATCH 0/2] perf: symbol offset breakage with separated debug Dave Martin
2010-08-03 11:48 ` [PATCH 1/2] perf events: Fix mmap offset determination Dave Martin
2010-08-03 14:31   ` Arnaldo Carvalho de Melo
2010-08-05  8:00   ` tip-bot for Dave Martin [this message]
2010-08-03 11:48 ` [PATCH 2/2] perf symbols: work around incorrect ET_EXEC symbol adjustment Dave Martin
2010-08-12 13:19   ` [PATCH v2] perf symbols: fix symbol offset breakage with separated debug Dave Martin
2010-08-13  9:27     ` [PATCH v3] " Dave Martin
2010-08-03 13:54 ` [PATCH 0/2] perf: " Arnaldo Carvalho de Melo
2010-08-04  8:29 ` Dave Martin

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-b5a6325464b700c4bdac8799c495970516eed41c@git.kernel.org \
    --to=dave.martin@linaro.org \
    --cc=Will.Deacon@arm.com \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nicolas.pitre@linaro.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

Powered by JetHome