All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf unwind: fix libunwind when tid != pid
Date: Sun, 4 Aug 2019 12:44:34 +0100	[thread overview]
Message-ID: <20190804124434.204da4ac.john@metanate.com> (raw)
In-Reply-To: <20190802133039.GE27223@krava>

On Fri, 2 Aug 2019 15:30:39 +0200
Jiri Olsa <jolsa@redhat.com> wrote:

> On Mon, Jul 29, 2019 at 06:24:30PM +0100, John Keeping wrote:
> > Commit e5adfc3e7e77 ("perf map: Synthesize maps only for thread group
> > leader") changed the recording side so that we no longer get mmap events
> > for threads other than the thread group leader.
> > 
> > When a file recorded after this change is loaded, the lack of mmap
> > records mean that unwinding is not set up for any other threads.  
> 
> sry I dont' follow what's the problem here, could you please
> describe the scenrio where the current code is failing in
> more details

With perf compiled to use libunwind, run:

	perf record --call-graph=dwarf -t $TID -- sleep 5
	perf report

If $TID is a process, then the output has the call graph, but if it's a
secondary thread then it is as if --no-call-graph was specified.

> > 
> > Following the rationale in that commit, move the libunwind fields into
> > struct map_groups and update the libunwind functions to take this
> > instead of the struct thread.  This is only required for
> > unwind__finish_access which must now be called from map_groups__delete
> > and the others are changed for symmetry.
> > 
> > Note that unwind__get_entries keeps the thread argument since it is
> > required for symbol lookup and the libdw unwind provider uses the thread
> > ID.  
> 
> SNIP
> 
> > @@ -59,37 +59,31 @@ int unwind__prepare_access(struct thread *thread, struct map *map,
> >  		return 0;
> >  	}
> >  out_register:
> > -	unwind__register_ops(thread, ops);
> > +	unwind__register_ops(mg, ops);
> >  
> > -	err = thread->unwind_libunwind_ops->prepare_access(thread);
> > +	err = mg->unwind_libunwind_ops->prepare_access(mg);
> >  	if (initialized)
> >  		*initialized = err ? false : true;
> >  	return err;
> >  }
> >  
> > -void unwind__flush_access(struct thread *thread)
> > +void unwind__flush_access(struct map_groups *mg)
> >  {
> > -	if (!dwarf_callchain_users)
> > -		return;  
> 
> why did you remove this check?

I don't think there is any way for unwind_libunwind_ops to be set if
!dwarf_callchain_users so this is redundant given the following
condition.

But this should probably be a separate patch.

> > -
> > -	if (thread->unwind_libunwind_ops)
> > -		thread->unwind_libunwind_ops->flush_access(thread);
> > +	if (mg->unwind_libunwind_ops)
> > +		mg->unwind_libunwind_ops->flush_access(mg);
> >  }
> >  
> > -void unwind__finish_access(struct thread *thread)
> > +void unwind__finish_access(struct map_groups *mg)
> >  {
> > -	if (!dwarf_callchain_users)
> > -		return;  
> 
> why did you remove this check?

Likewise.


Regards,
John

  reply	other threads:[~2019-08-04 11:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 17:24 [PATCH 1/2] perf map: use zalloc for map_groups John Keeping
2019-07-29 17:24 ` [PATCH 2/2] perf unwind: fix libunwind when tid != pid John Keeping
2019-08-02 13:30   ` Jiri Olsa
2019-08-04 11:44     ` John Keeping [this message]
2019-08-15 10:01       ` [PATCH v2 1/3] perf map: use zalloc for map_groups John Keeping
2019-08-15 10:01         ` [PATCH v2 2/3] perf unwind: fix libunwind when tid != pid John Keeping
2019-08-15 14:10           ` Jiri Olsa
2019-08-16 15:30             ` Arnaldo Carvalho de Melo
2019-08-16 21:00           ` [tip:perf/core] perf unwind: Fix " tip-bot for John Keeping
2019-08-15 10:01         ` [PATCH v2 3/3] perf unwind: remove unnecessary test John Keeping
2019-08-16 21:01           ` [tip:perf/core] perf unwind: Remove " tip-bot for John Keeping
2019-08-16 20:59         ` [tip:perf/core] perf map: Use zalloc for map_groups tip-bot for John Keeping

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=20190804124434.204da4ac.john@metanate.com \
    --to=john@metanate.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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.