All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Don Zickus <dzickus@redhat.com>
Cc: acme@ghostprotocols.net, peterz@infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	jolsa@redhat.com, jmario@redhat.com, fowles@inreach.com,
	eranian@google.com, andi.kleen@intel.com
Subject: Re: [PATCH 2/6] perf: Update mmap2 interface with protection and flag bits
Date: Wed, 09 Apr 2014 11:17:44 +0900	[thread overview]
Message-ID: <871tx7utyv.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1395689676-214799-3-git-send-email-dzickus@redhat.com> (Don Zickus's message of "Mon, 24 Mar 2014 15:34:32 -0400")

On Mon, 24 Mar 2014 15:34:32 -0400, Don Zickus wrote:
> The kernel piece passes more info now.  Update the perf tool to reflect
> that and adjust the synthesized maps to play along.
>
> Signed-off-by: Don Zickus <dzickus@redhat.com>
> ---
>  tools/perf/util/event.c   | 23 +++++++++++++++++++++--
>  tools/perf/util/event.h   |  2 ++
>  tools/perf/util/machine.c |  4 +++-
>  tools/perf/util/map.c     |  4 +++-
>  tools/perf/util/map.h     |  4 +++-
>  5 files changed, 32 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index 9d12aa6..6b8646c 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -1,4 +1,5 @@
>  #include <linux/types.h>
> +#include <sys/mman.h>
>  #include "event.h"
>  #include "debug.h"
>  #include "hist.h"
> @@ -212,6 +213,21 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
>  		else
>  			event->header.misc = PERF_RECORD_MISC_GUEST_USER;
>  
> +		/* map protection and flags bits */
> +		event->mmap2.prot = 0;
> +		event->mmap2.flags = 0;
> +		if (prot[0] == 'r')
> +			event->mmap2.prot |= PROT_READ;
> +		if (prot[1] == 'w')
> +			event->mmap2.prot |= PROT_WRITE;
> +		if (prot[2] == 'x')
> +			event->mmap2.prot |= PROT_EXEC;
> +
> +		if (prot[3] == 's')
> +			event->mmap2.flags |= MAP_SHARED;
> +		else
> +			event->mmap2.flags |= MAP_PRIVATE;
> +

So you need to synthesize a PERF_RECORD_MMAP2 event then.  The
mmap_event and mmap2_event shares same fields util ->pgoff only.  So
copying to mmap.filename will overwrite other bits in mmap2.

Thanks,
Namhyung

  reply	other threads:[~2014-04-09  2:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 19:34 [PATCH 0/6] perf, events: Enable mmap2 support Don Zickus
2014-03-24 19:34 ` [PATCH 1/6] events, perf: Pass protection and flags bits through mmap2 interface Don Zickus
2014-03-24 19:34 ` [PATCH 2/6] perf: Update mmap2 interface with protection and flag bits Don Zickus
2014-04-09  2:17   ` Namhyung Kim [this message]
2014-04-09  2:20     ` Namhyung Kim
2014-03-24 19:34 ` [PATCH 3/6] Revert "perf: Disable PERF_RECORD_MMAP2 support" Don Zickus
2014-04-09  2:32   ` Namhyung Kim
2014-03-24 19:34 ` [PATCH 4/6] perf, sort: Add physid sorting based on mmap2 data Don Zickus
2014-03-24 19:54   ` Andi Kleen
2014-03-24 20:17     ` Don Zickus
2014-03-24 20:20       ` Andi Kleen
2014-03-24 20:26         ` Don Zickus
2014-03-24 20:54   ` [PATCH 01/15 V3] perf: Fix stddev calculation Don Zickus
2014-03-24 20:57     ` Don Zickus
2014-03-24 20:57   ` [PATCH 4/6 V2] perf, sort: Add physid sorting based on mmap2 data Don Zickus
2014-03-29 17:11     ` Jiri Olsa
2014-04-01  2:58       ` Don Zickus
2014-04-09  5:21     ` Namhyung Kim
2014-04-09  5:45       ` Peter Zijlstra
2014-04-09  3:06   ` [PATCH 4/6] " Don Zickus
2014-03-24 19:34 ` [PATCH 5/6] perf: Update sort to handle MAP_SHARED bits Don Zickus
2014-03-24 19:34 ` [PATCH 6/6] perf, sort: Allow unique sorting instead of combining hist_entries Don Zickus
2014-04-09  5:31   ` Namhyung Kim
2014-04-09 13:57     ` Don Zickus
2014-04-10  5:09       ` Namhyung Kim

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=871tx7utyv.fsf@sejong.aot.lge.com \
    --to=namhyung@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=andi.kleen@intel.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=fowles@inreach.com \
    --cc=jmario@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.