public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: kan.liang@intel.com
Cc: acme@kernel.org, a.p.zijlstra@chello.nl, eranian@google.com,
	linux-kernel@vger.kernel.org, mingo@redhat.com, paulus@samba.org,
	ak@linux.intel.com
Subject: Re: [PATCH 2/2] perf tools: Construct LBR call chain
Date: Wed, 12 Nov 2014 13:33:43 +0100	[thread overview]
Message-ID: <20141112123305.GA27796@krava.redhat.com> (raw)
In-Reply-To: <1415285886-16949-3-git-send-email-kan.liang@intel.com>

On Thu, Nov 06, 2014 at 09:58:06AM -0500, kan.liang@intel.com wrote:
> From: Kan Liang <kan.liang@intel.com>
> 

SNIP

> +	/* LBR call stack */
> +	if (lbr) {
> +		struct branch_stack *lbr_stack = sample->branch_stack;
> +		int lbr_nr = lbr_stack->nr;
> +		int mix_chain_nr;
>  
> -		if (callchain_param.order == ORDER_CALLEE)
> -			j = i;
> -		else
> -			j = chain->nr - i - 1;
> +		for (i = 0; i < chain_nr; i++) {
> +			if (chain->ips[i] == PERF_CONTEXT_USER)
> +				break;
> +		}
>  
> -#ifdef HAVE_SKIP_CALLCHAIN_IDX
> -		if (j == skip_idx)
> -			continue;
> -#endif
> -		ip = chain->ips[j];
> +		/* LBR only affects the user callchain */
> +		if (i == chain_nr) {
> +			lbr = 0;
> +			goto again;
> +		}

'goto again' sounds like u want to try something again,
but you prepare the condition already with lbr = 0,
could you please restruct the code in another way?


SNIP

> +				goto exit;
>  		}
> +	} else {
>  
> -		err = callchain_cursor_append(&callchain_cursor,
> -					      ip, al.map, al.sym);
> -		if (err)
> -			return err;
> -	}
> +		/*
> +		 * Based on DWARF debug information, some architectures skip
> +		 * a callchain entry saved by the kernel.
> +		 */
> +		skip_idx = arch_skip_callchain_idx(thread, chain);
>  
> -	return 0;
> +		for (i = 0; i < chain_nr; i++) {
> +			struct addr_location al;
> +
> +			if (callchain_param.order == ORDER_CALLEE)
> +				j = i;
> +			else
> +				j = chain->nr - i - 1;
> +
> +#ifdef HAVE_SKIP_CALLCHAIN_IDX
> +			if (j == skip_idx)
> +				continue;
> +#endif
> +			ip = chain->ips[j];
> +			err = __thread__resolve_callchain_sample(thread,

Uou factored out the common functionality into __thread__resolve_callchain_sample
function and added your own functionality.. could you please split this into 2
separate patches? (first the new function, then your change)
IMO It'll make the change simple and more obvious.

thanks,
jirka

  parent reply	other threads:[~2014-11-12 12:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 14:58 [PATCH 0/2] perf tool: Haswell LBR call stack support (user) kan.liang
2014-11-06 14:58 ` [PATCH 1/2] perf tools: enable LBR call stack support kan.liang
2014-11-12  7:50   ` Jiri Olsa
2014-11-12  7:50   ` Jiri Olsa
2014-11-12 14:44     ` Liang, Kan
2014-11-06 14:58 ` [PATCH 2/2] perf tools: Construct LBR call chain kan.liang
2014-11-12  8:58   ` Jiri Olsa
2014-11-12  8:58   ` Jiri Olsa
2014-11-12  8:59   ` Jiri Olsa
2014-11-12 14:37     ` Liang, Kan
2014-11-12 15:05       ` Peter Zijlstra
2014-11-12 18:31       ` Jiri Olsa
2014-11-12 12:33   ` Jiri Olsa [this message]
2014-11-10 10:54 ` [PATCH 0/2] perf tool: Haswell LBR call stack support (user) Peter Zijlstra
2014-11-10 14:08   ` Liang, Kan

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=20141112123305.GA27796@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.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