* 'branches' perf event mapping differs on ARC and ARM
@ 2018-11-27 14:36 Eugeniy Paltsev
2018-11-27 15:28 ` Robin Murphy
2018-11-27 17:06 ` Vineet Gupta
0 siblings, 2 replies; 3+ messages in thread
From: Eugeniy Paltsev @ 2018-11-27 14:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
While playing with perf tool on ARMv7 and ARCv2 processors and profiling the
same application I got interesting results. Even if we got pretty
similar total
execution time and instructions number the number of branches on ARC is about
three times more then on ARM.
I dug into architecture
specific perf sources and found that we map different
HW counters into generic 'branches' event on ARC and ARM.
- We use "ijmp" event on ARC which
counts all jump and branch instructions (regardless
of real execution flow - even if no real jump happens)
- We use "pc_write_retired" event on ARM
which counts only taken branches (Instruction
architecturally executed, condition check pass - software change of the PC)
So I was wondering do you know
which approach is correct?
I guess counting all jump and branch instructions is correct because we use
'branches' event value to calculate relative value of 'branch-misses' using
following formula:
----------------------------8----------------------------
branch-misses-ration = 'branch-misses' / 'branches' * 100.0
----------------
------------8----------------------------
And using only taken branches here is incorrect IMHO. So I guess we should
map 'br_immed_retired' instead of
"pc_write_retired" into generic 'branches'
event on ARM.
--
Eugeniy Paltsev
^ permalink raw reply [flat|nested] 3+ messages in thread
* 'branches' perf event mapping differs on ARC and ARM
2018-11-27 14:36 'branches' perf event mapping differs on ARC and ARM Eugeniy Paltsev
@ 2018-11-27 15:28 ` Robin Murphy
2018-11-27 17:06 ` Vineet Gupta
1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2018-11-27 15:28 UTC (permalink / raw)
To: linux-arm-kernel
On 27/11/2018 14:36, Eugeniy Paltsev wrote:
> Hi,
>
> While playing with perf tool on ARMv7 and ARCv2 processors and profiling the
> same application I got interesting results. Even if we got pretty
> similar total
> execution time and instructions number the number of branches on ARC is about
> three times more then on ARM.
>
> I dug into architecture
> specific perf sources and found that we map different
> HW counters into generic 'branches' event on ARC and ARM.
> - We use "ijmp" event on ARC which
> counts all jump and branch instructions (regardless
> of real execution flow - even if no real jump happens)
> - We use "pc_write_retired" event on ARM
> which counts only taken branches (Instruction
> architecturally executed, condition check pass - software change of the PC)
>
> So I was wondering do you know
> which approach is correct?
>
>
>
> I guess counting all jump and branch instructions is correct because we use
> 'branches' event value to calculate relative value of 'branch-misses' using
>
> following formula:
> ----------------------------8----------------------------
> branch-misses-ration = 'branch-misses' / 'branches' * 100.0
> ----------------
> ------------8----------------------------
> And using only taken branches here is incorrect IMHO. So I guess we should
> map 'br_immed_retired' instead of
> "pc_write_retired" into generic 'branches'
> event on ARM.
But register branches (including procedure returns) are also branches,
so only counting immediate branches would be just as, if not more,
misleading.
Robin.
^ permalink raw reply [flat|nested] 3+ messages in thread
* 'branches' perf event mapping differs on ARC and ARM
2018-11-27 14:36 'branches' perf event mapping differs on ARC and ARM Eugeniy Paltsev
2018-11-27 15:28 ` Robin Murphy
@ 2018-11-27 17:06 ` Vineet Gupta
1 sibling, 0 replies; 3+ messages in thread
From: Vineet Gupta @ 2018-11-27 17:06 UTC (permalink / raw)
To: linux-arm-kernel
On 11/27/18 6:36 AM, Eugeniy Paltsev wrote:
> Hi,
>
> While playing with perf tool on ARMv7 and ARCv2 processors and profiling the
> same application I got interesting results. Even if we got pretty
> similar total
> execution time and instructions number the number of branches on ARC is about
> three times more then on ARM.
>
> I dug into architecture
> specific perf sources and found that we map different
> HW counters into generic 'branches' event on ARC and ARM.
> - We use "ijmp" event on ARC which
> counts all jump and branch instructions (regardless
> of real execution flow - even if no real jump happens)
That doesn't seem correct IMO. A NOT taken conditional branch doesn't change
control flow, so semantically doesn't qualify as a branch.
On ARC, the generic branches event should be mapped to "actually taken branches"
condition i.e. ijmptak
> - We use "pc_write_retired" event on ARM
> which counts only taken branches (Instruction
> architecturally executed, condition check pass - software change of the PC)
That seems correct.
> I guess counting all jump and branch instructions is correct because we use
> 'branches' event value to calculate relative value of 'branch-misses' using
>
> following formula:
> ----------------------------8----------------------------
> branch-misses-ration = 'branch-misses' / 'branches' * 100.0
> ----------------
> ------------8----------------------------
> And using only taken branches here is incorrect IMHO.
Why ? branch-misses is a CPU specific micro-arch state where the a changed control
flow was NOT predicted. If an implementation mispredicts NOT taken branches, those
should actually get counted and be fed to hardware folks to improve the micro-arch.
> So I guess we should
> map 'br_immed_retired' instead of
> "pc_write_retired" into generic 'branches'
> event on ARM.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-27 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-27 14:36 'branches' perf event mapping differs on ARC and ARM Eugeniy Paltsev
2018-11-27 15:28 ` Robin Murphy
2018-11-27 17:06 ` Vineet Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).