powerpc/perf: Fix the check for SIAR value
authorKajol Jain <kjain@linux.ibm.com>
Wed, 18 Aug 2021 17:15:56 +0000 (22:45 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Aug 2021 12:38:19 +0000 (22:38 +1000)
commit3c69a5f22223fa3e312689ec218b5059784d49d7
tree44a26287f383bb63ce61cab83a3501e9d0c4d089
parentcc90c6742ef5b438f4cb86029d7a794bd0a44a06
powerpc/perf: Fix the check for SIAR value

Incase of random sampling, there can be scenarios where
Sample Instruction Address Register(SIAR) may not latch
to the sampled instruction and could result in
the value of 0. In these scenarios it is preferred to
return regs->nip. These corner cases are seen in the
previous generation (p9) also.

Patch adds the check for SIAR value along with regs_use_siar
and siar_valid checks so that the function will return
regs->nip incase SIAR is zero.

Patch drops the code under PPMU_P10_DD1 flag check
which handles SIAR 0 case only for Power10 DD1.

Fixes: 2ca13a4cc56c9 ("powerpc/perf: Use regs->nip when SIAR is zero")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210818171556.36912-3-kjain@linux.ibm.com
arch/powerpc/perf/core-book3s.c