Skip to content

Commit 287840f

Browse files
author
Mamatha Inamdar
committed
arch/powerpc/perf: Update get_mem_data_src function to use saved values of sier and mmcra regs
JIRA: https://issues.redhat.com/browse/RHEL-80602 commit f848e7e Author: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Date: Tue Jan 21 18:46:21 2025 +0530 arch/powerpc/perf: Update get_mem_data_src function to use saved values of sier and mmcra regs During performance monitor interrupt handling, the regs are setup using perf_read_regs function. Here some of the pt_regs fields is overloaded. Samples Instruction Event Register (SIER) is loaded into pt_regs, overloading regs->dar. And regs->dsisr to store MMCRA (Monitor Mode Control Register A) so that we only need to read these once on each interrupt. Update the isa207_get_mem_data_src function to use regs->dar instead of reading from SPRN_SIER again. Also use regs->dsisr to read the mmcra value Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20250121131621.39054-2-atrajeev@linux.vnet.ibm.com Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
1 parent 0cdda9f commit 287840f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

arch/powerpc/perf/isa207-common.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,13 @@ void isa207_get_mem_data_src(union perf_mem_data_src *dsrc, u32 flags,
319319
return;
320320
}
321321

322-
sier = mfspr(SPRN_SIER);
322+
/*
323+
* Use regs-dar for SPRN_SIER which is saved
324+
* during perf_read_regs at the beginning
325+
* of the PMU interrupt handler to avoid multiple
326+
* reads of SPRN_SIER
327+
*/
328+
sier = regs->dar;
323329
val = (sier & ISA207_SIER_TYPE_MASK) >> ISA207_SIER_TYPE_SHIFT;
324330
if (val != 1 && val != 2 && !(val == 7 && cpu_has_feature(CPU_FTR_ARCH_31))) {
325331
dsrc->val = 0;
@@ -340,8 +346,12 @@ void isa207_get_mem_data_src(union perf_mem_data_src *dsrc, u32 flags,
340346
* to determine the exact instruction type. If the sampling
341347
* criteria is neither load or store, set the type as default
342348
* to NA.
349+
*
350+
* Use regs->dsisr for MMCRA which is saved during perf_read_regs
351+
* at the beginning of the PMU interrupt handler to avoid
352+
* multiple reads of SPRN_MMCRA
343353
*/
344-
mmcra = mfspr(SPRN_MMCRA);
354+
mmcra = regs->dsisr;
345355

346356
op_type = (mmcra >> MMCRA_SAMP_ELIG_SHIFT) & MMCRA_SAMP_ELIG_MASK;
347357
switch (op_type) {

0 commit comments

Comments
 (0)