Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-20 Thread Arnaldo Carvalho de Melo
Em Wed, Mar 19, 2014 at 02:30:25PM +0100, Jiri Olsa escreveu:
> On Wed, Mar 19, 2014 at 09:19:45AM -0400, Don Zickus wrote:
> > On Wed, Mar 19, 2014 at 09:13:38AM +0200, Adrian Hunter wrote:
> > > On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
> > > > From: Don Zickus 
> > > > 
> > > > Now that we can properly synthesize threads system-wide, make sure the
> > > > mmap and mmap2 events use tids instead of pids to locate their maps.
> > > 
> > > This is a good change but it cannot go yet because it is dependent on 
> > > Jiri's
> > > "perf tools: Share map groups within process" series.
> > 
> > No it isn't. :-) Commit bfd66cc71a3f831ba7c2116d79416cfb8883f6cf is the
> > reason why.  It synthesizes thread events to make this work correctly.
> 
> ok, I haven't realized this one was pulled in as well ;-)
> it's ok then..
> 
> Arnaldo, I'll rebase the perf/core_mmaps (shared map groups) to your
> latest perf/core

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-19 Thread Adrian Hunter

On 19/03/2014 4:43 p.m., Don Zickus wrote:

On Wed, Mar 19, 2014 at 04:27:25PM +0200, Adrian Hunter wrote:

On 19.03.2014 15:30, Jiri Olsa wrote:

On Wed, Mar 19, 2014 at 09:19:45AM -0400, Don Zickus wrote:

On Wed, Mar 19, 2014 at 09:13:38AM +0200, Adrian Hunter wrote:

On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:

From: Don Zickus 

Now that we can properly synthesize threads system-wide, make sure the
mmap and mmap2 events use tids instead of pids to locate their maps.


This is a good change but it cannot go yet because it is dependent on Jiri's
"perf tools: Share map groups within process" series.


No it isn't. :-) Commit bfd66cc71a3f831ba7c2116d79416cfb8883f6cf is the
reason why.  It synthesizes thread events to make this work correctly.


ok, I haven't realized this one was pulled in as well ;-)
it's ok then..


No, you mustn't split up the maps between threads.  We currently assume
CLONE_VM is always used to create threads.


But that doesn't work when you try to synthesize threads which was the
problem I was trying to solve.


It worked if you looked up the maps on the pid not the tid.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-19 Thread Don Zickus
On Wed, Mar 19, 2014 at 04:27:25PM +0200, Adrian Hunter wrote:
> On 19.03.2014 15:30, Jiri Olsa wrote:
> > On Wed, Mar 19, 2014 at 09:19:45AM -0400, Don Zickus wrote:
> >> On Wed, Mar 19, 2014 at 09:13:38AM +0200, Adrian Hunter wrote:
> >>> On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
>  From: Don Zickus 
> 
>  Now that we can properly synthesize threads system-wide, make sure the
>  mmap and mmap2 events use tids instead of pids to locate their maps.
> >>>
> >>> This is a good change but it cannot go yet because it is dependent on 
> >>> Jiri's
> >>> "perf tools: Share map groups within process" series.
> >>
> >> No it isn't. :-) Commit bfd66cc71a3f831ba7c2116d79416cfb8883f6cf is the
> >> reason why.  It synthesizes thread events to make this work correctly.
> > 
> > ok, I haven't realized this one was pulled in as well ;-)
> > it's ok then..
> 
> No, you mustn't split up the maps between threads.  We currently assume
> CLONE_VM is always used to create threads.

But that doesn't work when you try to synthesize threads which was the
problem I was trying to solve.

Cheers,
Don
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-19 Thread Adrian Hunter
On 19.03.2014 15:30, Jiri Olsa wrote:
> On Wed, Mar 19, 2014 at 09:19:45AM -0400, Don Zickus wrote:
>> On Wed, Mar 19, 2014 at 09:13:38AM +0200, Adrian Hunter wrote:
>>> On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
 From: Don Zickus 

 Now that we can properly synthesize threads system-wide, make sure the
 mmap and mmap2 events use tids instead of pids to locate their maps.
>>>
>>> This is a good change but it cannot go yet because it is dependent on Jiri's
>>> "perf tools: Share map groups within process" series.
>>
>> No it isn't. :-) Commit bfd66cc71a3f831ba7c2116d79416cfb8883f6cf is the
>> reason why.  It synthesizes thread events to make this work correctly.
> 
> ok, I haven't realized this one was pulled in as well ;-)
> it's ok then..

No, you mustn't split up the maps between threads.  We currently assume
CLONE_VM is always used to create threads.

> 
> Arnaldo, I'll rebase the perf/core_mmaps (shared map groups) to your
> latest perf/core
> 
> jirka
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-19 Thread Jiri Olsa
On Wed, Mar 19, 2014 at 09:19:45AM -0400, Don Zickus wrote:
> On Wed, Mar 19, 2014 at 09:13:38AM +0200, Adrian Hunter wrote:
> > On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
> > > From: Don Zickus 
> > > 
> > > Now that we can properly synthesize threads system-wide, make sure the
> > > mmap and mmap2 events use tids instead of pids to locate their maps.
> > 
> > This is a good change but it cannot go yet because it is dependent on Jiri's
> > "perf tools: Share map groups within process" series.
> 
> No it isn't. :-) Commit bfd66cc71a3f831ba7c2116d79416cfb8883f6cf is the
> reason why.  It synthesizes thread events to make this work correctly.

ok, I haven't realized this one was pulled in as well ;-)
it's ok then..

Arnaldo, I'll rebase the perf/core_mmaps (shared map groups) to your
latest perf/core

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-19 Thread Jiri Olsa
On Wed, Mar 19, 2014 at 09:13:38AM +0200, Adrian Hunter wrote:
> On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
> > From: Don Zickus 
> > 
> > Now that we can properly synthesize threads system-wide, make sure the
> > mmap and mmap2 events use tids instead of pids to locate their maps.
> 
> This is a good change but it cannot go yet because it is dependent on Jiri's
> "perf tools: Share map groups within process" series.
> 
> perf tools assume that threads share virtual memory.  That means that a
> mapping created by one thread is visible to all threads in the thread group.
>  That was implemented by putting all the maps on the thread group leader
> (pid == tid).  The alternative is to share the map groups instead, which is
> what Jiri is doing.

right, this needs the sharing map groups changes
(or the 1/2 patch Don sent prior to this patch)

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

2014-03-19 Thread Adrian Hunter
On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
> From: Don Zickus 
> 
> Now that we can properly synthesize threads system-wide, make sure the
> mmap and mmap2 events use tids instead of pids to locate their maps.

This is a good change but it cannot go yet because it is dependent on Jiri's
"perf tools: Share map groups within process" series.

perf tools assume that threads share virtual memory.  That means that a
mapping created by one thread is visible to all threads in the thread group.
 That was implemented by putting all the maps on the thread group leader
(pid == tid).  The alternative is to share the map groups instead, which is
what Jiri is doing.

> 
> Signed-off-by: Don Zickus 
> Cc: Jiri Olsa 
> Cc: Stephane Eranian 
> Link: 
> http://lkml.kernel.org/r/1393429527-167840-3-git-send-email-dzic...@redhat.com
> Signed-off-by: Arnaldo Carvalho de Melo 
> ---
>  tools/perf/tests/hists_link.c | 1 +
>  tools/perf/util/machine.c | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
> index 2b6519e0e36f..7ccbc7b6ae77 100644
> --- a/tools/perf/tests/hists_link.c
> +++ b/tools/perf/tests/hists_link.c
> @@ -101,6 +101,7 @@ static struct machine *setup_fake_machine(struct machines 
> *machines)
>   .mmap = {
>   .header = { .misc = PERF_RECORD_MISC_USER, },
>   .pid = fake_mmap_info[i].pid,
> + .tid = fake_mmap_info[i].pid,
>   .start = fake_mmap_info[i].start,
>   .len = 0x1000ULL,
>   .pgoff = 0ULL,
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index d280bf210183..a53cd0b8c151 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1027,7 +1027,7 @@ int machine__process_mmap2_event(struct machine 
> *machine,
>   }
>  
>   thread = machine__findnew_thread(machine, event->mmap2.pid,
> - event->mmap2.pid);
> + event->mmap2.tid);
>   if (thread == NULL)
>   goto out_problem;
>  
> @@ -1075,7 +1075,7 @@ int machine__process_mmap_event(struct machine 
> *machine, union perf_event *event
>   }
>  
>   thread = machine__findnew_thread(machine, event->mmap.pid,
> -  event->mmap.pid);
> +  event->mmap.tid);
>   if (thread == NULL)
>   goto out_problem;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/