* [PATCH 1/2] powerpc/perf: Use stack siar instead of mfspr
@ 2021-08-13 8:30 Kajol Jain
2021-08-13 8:30 ` [PATCH 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0 Kajol Jain
0 siblings, 1 reply; 2+ messages in thread
From: Kajol Jain @ 2021-08-13 8:30 UTC (permalink / raw)
To: mpe, linuxppc-dev; +Cc: kjain, atrajeev, maddy, rnsastry
Minor optimization in the 'perf_instruction_pointer' function code by
making use of stack siar instead of mfspr.
Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs
into perf_read_regs")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
arch/powerpc/perf/core-book3s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index bb0ee716de91..1b464aad29c4 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -2260,7 +2260,7 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
else
return regs->nip;
} else if (use_siar && siar_valid(regs))
- return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
+ return siar + perf_ip_adjust(regs);
else if (use_siar)
return 0; // no valid instruction pointer
else
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0
2021-08-13 8:30 [PATCH 1/2] powerpc/perf: Use stack siar instead of mfspr Kajol Jain
@ 2021-08-13 8:30 ` Kajol Jain
0 siblings, 0 replies; 2+ messages in thread
From: Kajol Jain @ 2021-08-13 8:30 UTC (permalink / raw)
To: mpe, linuxppc-dev; +Cc: kjain, atrajeev, maddy, rnsastry
Incase of random sampling, there can be scenarios where SIAR is not
latching sample address and results in 0 value. Since current code
directly returning the siar value, we could see multiple instruction
pointer values as 0 in perf report.
Patch resolves this issue by adding a ternary condition to return
regs->nip incase SIAR is 0.
Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs
into perf_read_regs")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
arch/powerpc/perf/core-book3s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 1b464aad29c4..aeecaaf6810f 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -2260,7 +2260,7 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
else
return regs->nip;
} else if (use_siar && siar_valid(regs))
- return siar + perf_ip_adjust(regs);
+ return siar ? siar + perf_ip_adjust(regs) : regs->nip;
else if (use_siar)
return 0; // no valid instruction pointer
else
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-13 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 8:30 [PATCH 1/2] powerpc/perf: Use stack siar instead of mfspr Kajol Jain
2021-08-13 8:30 ` [PATCH 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0 Kajol Jain
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.