linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"mingo@elte.hu" <mingo@elte.hu>,
	Namhyung Kim <namhyung@kernel.org>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH] perf tools: fix processing of pid/tid for mmap records
Date: Tue, 22 Apr 2014 16:45:22 -0400	[thread overview]
Message-ID: <20140422204522.GN8488@redhat.com> (raw)
In-Reply-To: <CABPqkBTcOT+BEd1dSrp6bz22o5g+ZvBwx5e4GZvbwft6No+Shw@mail.gmail.com>

On Tue, Apr 22, 2014 at 09:50:17PM +0200, Stephane Eranian wrote:
> On Tue, Apr 22, 2014 at 9:40 PM, Don Zickus <dzickus@redhat.com> wrote:
> > On Mon, Apr 21, 2014 at 06:06:55PM +0200, Stephane Eranian wrote:
> >> perf tools: fix processing of pid/tid for mmap records
> >>
> >> Mmaps are global to a process (always). Processing them
> >> per-thread was causing some serious issues in case mmaps
> >> would overlap. The overlap fixups would only occur in the
> >> context of the thread which generated the overlapping
> >> mmap. But that was cause issues later on when a sample
> >> from another thread would fall into that overlapping
> >> mmap.
> >
> > eh?  You are basically reverting my patch for a similar problem. :-)
> >
> > I was running a large multi-threading program (specjbb) and the threads
> > were not being seperated into their own map'd areas.  So either I had to
> > lump all threads in to the same pid space or make the change you are
> > reverting.
> >
> I don't understand your problem. The address space is shared by ALL
> threads of a process. The mmaps are always shared by all threads?

Sure.


> 
> > The problem I had with the double pid (as you propose), I would later look
> > up samples based on pid/tid and there would be _no_ map available because
> > it was created as a pid/pid pair.  As a result, our c2c program would drop
> > thousands of samples on the floor (because there was no mapping for the
> > data address to get the major/minor/inode info).
> 
> That is your problem. You should only lookup mapping baseds on pid only
> not pid/tid. Why do you need tid?

Because the function is machine__findnew_thread not
machine__findnew_map.  I want the thread info.  That includes the tid,
comm and any other thread specific info.  :-)

The problem was the thread maps were not being shared internally, leading
to your problem and my problem.

Jiri fixed that.  So now I can request a thread struct based on a pid/tid
and the map groups all point to the same one created by the pid.  As it
should.


> 
> >
> > Now I modified our c2c program to lookup samples as pid/pid but now the
> > maps lost tid info, and I had to hack around that by carrying the tid info
> > in a private struct.
> >
> If you need the tid, then it is okay to carry it on the side. I believe mmap
> lookups should ONLY use pid. That is how the address space of a process
> is contructed.

The tid is stored in the thread struct.  So if I have a pointer to the
thread struct, I shouldn't have to carry the tid on the side.  That was
the point. :-)  In fact the thread struct is inside the hist_entry which
is referenced by struct hist.  So now I can easily sort and display tid
without carrying anything on the side.

But that only works if the pid/tid mappings are setup correctly.  Which I
believe Jiri has done with his recent patchset.

Cheers,
Don

  reply	other threads:[~2014-04-22 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 16:06 [PATCH] perf tools: fix processing of pid/tid for mmap records Stephane Eranian
2014-04-22 13:32 ` Jiri Olsa
2014-04-22 13:37   ` Stephane Eranian
2014-04-22 19:40 ` Don Zickus
2014-04-22 19:50   ` Stephane Eranian
2014-04-22 20:45     ` Don Zickus [this message]
2014-04-23 12:52       ` Stephane Eranian
2014-04-23 13:30         ` Don Zickus
2014-04-23 15:06           ` Stephane Eranian
2014-04-23 15:42             ` Jiri Olsa

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=20140422204522.GN8488@redhat.com \
    --to=dzickus@redhat.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).