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


Groups > linux.kernel > #1684746

Re: [PATCH v6 1/7] perf/core: Define the common branch type classification

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH v6 1/7] perf/core: Define the common branch type classification
Date 2017-07-11 04:20 +0200
Message-ID <u1SWm-4Ny-5@gated-at.bofh.it> (permalink)
References (2 earlier) <u1A3o-1hK-5@gated-at.bofh.it> <u1C5c-2xU-15@gated-at.bofh.it> <u1EgF-3Sw-1@gated-at.bofh.it> <u1Fmq-4u7-5@gated-at.bofh.it> <u1GLw-5vA-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Segher Boessenkool <segher@kernel.crashing.org> writes:
> Hi!
>
> On Mon, Jul 10, 2017 at 07:46:17PM +0800, Jin, Yao wrote:
>> 1. We all agree these definitions:
>> 
>> +	PERF_BR_COND		= 1,	/* conditional */
>> +	PERF_BR_UNCOND		= 2,	/* unconditional */
>> +	PERF_BR_IND		= 3,	/* indirect */
>> +	PERF_BR_CALL		= 4,	/* call */
>> +	PERF_BR_IND_CALL	= 5,	/* indirect call */
>> +	PERF_BR_RET		= 6,	/* return */
>> +	PERF_BR_SYSCALL		= 7,	/* syscall */
>> +	PERF_BR_SYSRET		= 8,	/* syscall return */
>> +	PERF_BR_IRET		= 11,	/* return from interrupt */
>
> Do we?  It does not map very well to PowerPC branch types.

I think they map well enough to the types of branches that are actually
used in practice.

To represent the full range of possibilities we'd need to switch to a
bitmap of flags, ie. COND, IND, CALL, RET, SYSCALL, INT, etc. But it
would need more than 4 bits and I don't think there's that much added
value in being able to represent all the bizarre combinations.

But maybe that is the best option as it makes the API more flexible and
means we don't have to get the list of branches correct up front?


I ran some quick numbers on a kernel I had here (powernv w/gcc 7):

  Type      Percent
  -----------------
  cond      40.92%	beq (79166) bne (57379) ble (10411) bgt (9587) blt (6248) bge (3704) bdnz (1251) bdz (353) bns (30) bdnzf (2) bdnzt (1)
  uncond    14.89%	b (61182) 
  indirect  0.10%	bctr (418)
  call      33.33%	bl (136926)
  ind call  1.44%	bctrl (5912)
  return    9.23%	blr (37943)
        =   99.91%

If we add cond call/return that covers another 0.08% taking us to 99.99%
of branches.

I know future compilers and or different code might use a different
distribution, but I doubt it will change all that much.

Maybe cond could be broken down further, but the only really meaningful
sub category I can think of is the decrementing type, and those are
quite rare.

cheers

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


Thread

Re: [PATCH v6 1/7] perf/core: Define the common branch type classification Michael Ellerman <mpe@ellerman.id.au> - 2017-07-10 08:10 +0200
  Re: [PATCH v6 1/7] perf/core: Define the common branch type  classification "Jin, Yao" <yao.jin@linux.intel.com> - 2017-07-10 10:20 +0200
    Re: [PATCH v6 1/7] perf/core: Define the common branch type classification Michael Ellerman <mpe@ellerman.id.au> - 2017-07-10 12:40 +0200
      Re: [PATCH v6 1/7] perf/core: Define the common branch type  classification "Jin, Yao" <yao.jin@linux.intel.com> - 2017-07-10 13:50 +0200
        Re: [PATCH v6 1/7] perf/core: Define the common branch type classification Segher Boessenkool <segher@kernel.crashing.org> - 2017-07-10 15:20 +0200
          Re: [PATCH v6 1/7] perf/core: Define the common branch type  classification "Jin, Yao" <yao.jin@linux.intel.com> - 2017-07-10 15:30 +0200
          Re: [PATCH v6 1/7] perf/core: Define the common branch type  classification Peter Zijlstra <peterz@infradead.org> - 2017-07-10 15:50 +0200
            Re: [PATCH v6 1/7] perf/core: Define the common branch type  classification "Jin, Yao" <yao.jin@linux.intel.com> - 2017-07-10 16:10 +0200
              Re: [PATCH v6 1/7] perf/core: Define the common branch type classification Michael Ellerman <mpe@ellerman.id.au> - 2017-07-11 04:30 +0200
                Re: [PATCH v6 1/7] perf/core: Define the common branch type  classification "Jin, Yao" <yao.jin@linux.intel.com> - 2017-07-11 05:10 +0200
            Re: [PATCH v6 1/7] perf/core: Define the common branch type classification Segher Boessenkool <segher@kernel.crashing.org> - 2017-07-10 16:40 +0200
          Re: [PATCH v6 1/7] perf/core: Define the common branch type classification Michael Ellerman <mpe@ellerman.id.au> - 2017-07-11 04:20 +0200

csiph-web