mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Anton Blanchard <anton@au1.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/powerpc: Cache the DWARF debug info
Date: Wed, 22 Oct 2014 10:17:30 +0200	[thread overview]
Message-ID: <20141022081730.GB9860@krava.brq.redhat.com> (raw)
In-Reply-To: <20141022000958.GB2228@us.ibm.com>

On Tue, Oct 21, 2014 at 05:09:58PM -0700, Sukadev Bhattiprolu wrote:
> Arnaldo Carvalho de Melo [acme@kernel.org] wrote:
> | Em Tue, Oct 21, 2014 at 11:56:10AM -0700, Sukadev Bhattiprolu escreveu:
> | > >From 773a3608a0cd2daf02e244cb9ffbf5bb6a0e724e Mon Sep 17 00:00:00 2001
> | > From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> | > Date: Tue, 21 Oct 2014 13:20:22 -0500
> | > Subject: [PATCH 1/1] perf/powerpc: Cache DWARF debug info
> | 
> | Jiri, isn't his related to that dsos caching thing you created?

well, yea.. but Sukadev needs dw handle on top of that

> | 
> | Anyway, there is a per machine struct (struct machine) where things like
> | this should be put, please do not add globals or static variables in
> | functions.
> 
> Good point. How about something like this:

yep, and the code got much shorter ;-)

SNIP

> --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
> @@ -145,7 +145,7 @@ static Dwarf_Frame *get_dwarf_frame(Dwfl_Module *mod, Dwarf_Addr pc)
>   *		yet used)
>   *	-1 in case of errors
>   */
> -static int check_return_addr(const char *exec_file, Dwarf_Addr pc)
> +static int check_return_addr(struct dso *dso, Dwarf_Addr pc)
>  {
>  	int		rc = -1;
>  	Dwfl		*dwfl;
> @@ -156,15 +156,27 @@ static int check_return_addr(const char *exec_file, Dwarf_Addr pc)
>  	Dwarf_Addr	end = pc;
>  	bool		signalp;
>  
> -	dwfl = dwfl_begin(&offline_callbacks);
> -	if (!dwfl) {
> -		pr_debug("dwfl_begin() failed: %s\n", dwarf_errmsg(-1));
> -		return -1;
> -	}
> +	dwfl = dso->dwfl;
>  
> -	if (dwfl_report_offline(dwfl, "",  exec_file, -1) == NULL) {
> -		pr_debug("dwfl_report_offline() failed %s\n", dwarf_errmsg(-1));
> -		goto out;
> +	if (!dwfl) {
> +		dwfl = dwfl_begin(&offline_callbacks);
> +		if (!dwfl) {
> +			pr_debug("dwfl_begin() failed: %s\n", dwarf_errmsg(-1));
> +			return -1;
> +		}
> +
> +		if (dwfl_report_offline(dwfl, "", dso->long_name, -1) == NULL) {
> +			pr_debug("dwfl_report_offline() failed %s\n",
> +						dwarf_errmsg(-1));
> +			/*
> +			 * We normally cache the DWARF debug info and never
> +			 * call dwfl_end(). But to prevent fd leak, free in
> +			 * case of error.
> +			 */
> +			dwfl_end(dwfl);
> +			goto out;
> +		}
> +		dso->dwfl = dwfl;

so by this we get powerpc arch code sharing dw handle via dso object,
but we have lot of generic code too ;-)

could you make this happen for unwind__get_entries.. probably
both sharing same generic code I guess

thanks,
jirka

  reply	other threads:[~2014-10-22  8:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 18:56 Sukadev Bhattiprolu
2014-10-21 19:08 ` Arnaldo Carvalho de Melo
2014-10-22  0:09   ` Sukadev Bhattiprolu
2014-10-22  8:17     ` Jiri Olsa [this message]
2014-10-22 17:46       ` Sukadev Bhattiprolu
2014-10-23 13:37         ` Arnaldo Carvalho de Melo
2014-10-23 14:12           ` Jiri Olsa
2014-10-23 14:26             ` Arnaldo Carvalho de Melo
2014-10-23 15:13               ` Jiri Olsa
2014-10-23 15:33                 ` Arnaldo Carvalho de Melo
2014-10-23 15:39                   ` Jiri Olsa
2014-10-30  6:42     ` [tip:perf/core] perf tools powerpc: " tip-bot for Sukadev Bhattiprolu

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=20141022081730.GB9860@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=anton@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sukadev@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®