Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1245733

Re: [PATCH 2/4] perf/x86: add support for PERF_SAMPLE_BRANCH_CALL

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] perf/x86: add support for PERF_SAMPLE_BRANCH_CALL
Date 2015-10-13 15:50 +0200
Message-ID <qj87N-8dT-45@gated-at.bofh.it> (permalink)
References <qj1SH-7Dx-33@gated-at.bofh.it> <qj22l-7Ov-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Stephane Eranian <eranian@google.com> wrote:

> This patch enables the suport for the PERF_SAMPLE_BRANCH_CALL
> for Intel x86 processors. When the processor support LBR filtering
> this the selection is done in hardware. Otherwise, the filter is
> applied by software. Note that we chose to include zero length calls
> because they also represent calls.
> 
> Signed-off-by: Stephane Eranian <eranian@google.com>
> ---
>  arch/x86/kernel/cpu/perf_event_intel_lbr.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
> index ad0b8b0..bfd0b71 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
> @@ -555,6 +555,8 @@ static int intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
>  	if (br_type & PERF_SAMPLE_BRANCH_IND_JUMP)
>  		mask |= X86_BR_IND_JMP;
>  
> +	if (br_type & PERF_SAMPLE_BRANCH_CALL)
> +		mask |= X86_BR_CALL | X86_BR_ZERO_CALL;

I'm wondering how frequent zero-length calls are. If they still occur in typical 
user-space, would it make sense to also have a separate branch sampling type for 
zero length calls?

Intel documents zero length calls as ones that (ab-)use the call instruction to 
push the current IP on the stack:

	call next_addr
next_addr:
	pop %reg

which can take over 10 cycles on certain microarchitectures (and it unbalances 
whatever call stack tracking/caching the CPU does as well).

So it might make sense to analyze them separately. I guess that's the reason why 
Intel added a separate flag for them in the PMU.

Thanks,

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] perf: add ability to sample direct call branches Stephane Eranian <eranian@google.com> - 2015-10-13 09:10 +0200
  [PATCH 3/4] perf/powerpc: add support for PERF_SAMPLE_BRANCH_CALL Stephane Eranian <eranian@google.com> - 2015-10-13 09:20 +0200
  [PATCH 4/4] perf record: add ability to sample call branches Stephane Eranian <eranian@google.com> - 2015-10-13 09:20 +0200
  [PATCH 1/4] perf: add PERF_SAMPLE_BRANCH_CALL Stephane Eranian <eranian@google.com> - 2015-10-13 09:20 +0200
  [PATCH 2/4] perf/x86: add support for PERF_SAMPLE_BRANCH_CALL Stephane Eranian <eranian@google.com> - 2015-10-13 09:20 +0200
    Re: [PATCH 2/4] perf/x86: add support for PERF_SAMPLE_BRANCH_CALL Ingo Molnar <mingo@kernel.org> - 2015-10-13 15:50 +0200
      Re: [PATCH 2/4] perf/x86: add support for PERF_SAMPLE_BRANCH_CALL Andi Kleen <ak@linux.intel.com> - 2015-10-13 17:50 +0200
      Re: [PATCH 2/4] perf/x86: add support for PERF_SAMPLE_BRANCH_CALL Stephane Eranian <eranian@google.com> - 2015-10-14 02:40 +0200

csiph-web