All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: eranian@gmail.com
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Andres Freund <andres@anarazel.de>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Ingo Molnar <mingo@kernel.org>,
	Anton Blanchard <anton@ozlabs.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH] handle munmap records in tools/perf was: Re: perf/jit doesn't cope well with mprotect() to jit containing pages
Date: Fri, 27 Jan 2017 16:18:54 -0300	[thread overview]
Message-ID: <20170127191854.GE9082@kernel.org> (raw)
In-Reply-To: <CAMsRxfJ=ngV92Vqq4O_+cFS0+2amz0pKWgR78xyTLGJ45gR90A@mail.gmail.com>

Em Fri, Jan 27, 2017 at 10:10:09AM -0800, Stephane Eranian escreveu:
> On Fri, Jan 27, 2017 at 10:05 AM, Arnaldo Carvalho de Melo
> <arnaldo.melo@gmail.com> wrote:
> > Em Fri, Jan 27, 2017 at 09:46:55AM -0800, Stephane Eranian escreveu:
> >> On Fri, Jan 27, 2017 at 9:38 AM, Arnaldo Carvalho de Melo
> >> <arnaldo.melo@gmail.com> wrote:
> >> > Em Fri, Jan 27, 2017 at 12:43:05PM -0300, Arnaldo Carvalho de Melo escreveu:
> >> >> Em Fri, Jan 27, 2017 at 02:07:02PM +0100, Peter Zijlstra escreveu:
> >> >> > Something like the (compile tested only) below might be sufficient to
> >> >> > disambiguate things. It would need a corresponding tools/perf patch of
> >> >> > course, but I'm not too familiar with that code anymore.
> >> >>
> >> >> I'm working on patch to do feature test, fallback and handling of the
> >> >> event, etc, will post later.
> >> >
> >> > Just compile tested, need to build a kernel with PeterZ's patch to test,
> >> > feel free to go from there if in a hurry.
> >> >
> >> >
> >> > The place where the map is yanked out of the thread's maps rbtree is at
> >> >
> >> > machine__process_munmap_event()
> >> >
> >> > The rest is making sure the tool works with older kernels, deals with
> >> > endianness in the record in a perf.data file for cross platform
> >> > analysis, hooking it to the various tools where handling this event
> >> > makes sense.
> >> >
> >> At first glance this patch handles the munmap() well. But it will not solve
> >> the case of Andres. Unless you're telling me that the kernel with Peterz's patch
> >
> >
> > Nah, I just tried to implement support for the facility PeterZ was
> > proposing for the kernel, not trying to solve Andres, silly me ;-)
> >
> > But then it doesn't even does that well, as it needs to take munmap.len
> > into account, to possibly split the map if they aren't a perfect match
> > (start, len).
> >
> Ah, yes, that's correct. You need to consider len and possibly split
> the maps you have.

In fact we need to replicate the kernel's do_munmap() routine, as the
munmap range may straddle multiple existing maps, possibly splitting the
first and/or the last, ditching whatever is in between.

- Arnaldo

  reply	other threads:[~2017-01-27 19:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-10  5:02 perf/jit doesn't cope well with mprotect() to jit containing pages Andres Freund
2016-12-12  8:49 ` Peter Zijlstra
2016-12-12  9:01   ` Andres Freund
2016-12-12  9:28     ` Peter Zijlstra
2017-01-26  1:25       ` Andres Freund
2017-01-26 22:15   ` Peter Zijlstra
2017-01-26 23:04     ` Andres Freund
2017-01-30 11:52     ` [tip:perf/core] perf/core: Fix PERF_RECORD_MMAP2 prot/flags for anonymous memory tip-bot for Peter Zijlstra
2017-01-26 20:32 ` perf/jit doesn't cope well with mprotect() to jit containing pages Stephane Eranian
2017-01-26 21:00   ` Andres Freund
2017-01-26 21:17     ` Stephane Eranian
2017-01-26 21:22       ` Andres Freund
2017-01-26 21:34         ` Stephane Eranian
2017-01-26 21:51           ` Andres Freund
2017-01-26 22:19     ` Peter Zijlstra
2017-01-26 22:26       ` Stephane Eranian
2017-01-26 22:38         ` Andres Freund
2017-01-26 22:51           ` Stephane Eranian
2017-01-26 23:09             ` Andres Freund
2017-01-26 23:16               ` Stephane Eranian
2017-01-27 13:07                 ` Peter Zijlstra
2017-01-27 15:43                   ` Arnaldo Carvalho de Melo
2017-01-27 17:35                     ` Stephane Eranian
2017-01-27 17:38                     ` [PATCH] handle munmap records in tools/perf was: " Arnaldo Carvalho de Melo
2017-01-27 17:46                       ` Stephane Eranian
2017-01-27 18:05                         ` Arnaldo Carvalho de Melo
2017-01-27 18:10                           ` Stephane Eranian
2017-01-27 19:18                             ` Arnaldo Carvalho de Melo [this message]
2017-01-27 19:26                               ` Stephane Eranian

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=20170127191854.GE9082@kernel.org \
    --to=acme@kernel.org \
    --cc=andres@anarazel.de \
    --cc=anton@ozlabs.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@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.