powerpc/8xx: Use patch_site for perf counters setup
The 8xx TLB miss routines are patched when (de)activating perf counters. This patch uses the new patch_site functionality in order to get a better code readability and avoid a label mess when dumping the code with 'objdump -d' Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

父節點
1a210878bf
當前提交
709cf19c57
@@ -31,9 +31,6 @@
|
||||
|
||||
extern unsigned long itlb_miss_counter, dtlb_miss_counter;
|
||||
extern atomic_t instruction_counter;
|
||||
extern unsigned int itlb_miss_perf, dtlb_miss_perf;
|
||||
extern unsigned int itlb_miss_exit_1, itlb_miss_exit_2;
|
||||
extern unsigned int dtlb_miss_exit_1, dtlb_miss_exit_2, dtlb_miss_exit_3;
|
||||
|
||||
static atomic_t insn_ctr_ref;
|
||||
static atomic_t itlb_miss_ref;
|
||||
@@ -103,22 +100,22 @@ static int mpc8xx_pmu_add(struct perf_event *event, int flags)
|
||||
break;
|
||||
case PERF_8xx_ID_ITLB_LOAD_MISS:
|
||||
if (atomic_inc_return(&itlb_miss_ref) == 1) {
|
||||
unsigned long target = (unsigned long)&itlb_miss_perf;
|
||||
unsigned long target = patch_site_addr(&patch__itlbmiss_perf);
|
||||
|
||||
patch_branch(&itlb_miss_exit_1, target, 0);
|
||||
patch_branch_site(&patch__itlbmiss_exit_1, target, 0);
|
||||
#ifndef CONFIG_PIN_TLB_TEXT
|
||||
patch_branch(&itlb_miss_exit_2, target, 0);
|
||||
patch_branch_site(&patch__itlbmiss_exit_2, target, 0);
|
||||
#endif
|
||||
}
|
||||
val = itlb_miss_counter;
|
||||
break;
|
||||
case PERF_8xx_ID_DTLB_LOAD_MISS:
|
||||
if (atomic_inc_return(&dtlb_miss_ref) == 1) {
|
||||
unsigned long target = (unsigned long)&dtlb_miss_perf;
|
||||
unsigned long target = patch_site_addr(&patch__dtlbmiss_perf);
|
||||
|
||||
patch_branch(&dtlb_miss_exit_1, target, 0);
|
||||
patch_branch(&dtlb_miss_exit_2, target, 0);
|
||||
patch_branch(&dtlb_miss_exit_3, target, 0);
|
||||
patch_branch_site(&patch__dtlbmiss_exit_1, target, 0);
|
||||
patch_branch_site(&patch__dtlbmiss_exit_2, target, 0);
|
||||
patch_branch_site(&patch__dtlbmiss_exit_3, target, 0);
|
||||
}
|
||||
val = dtlb_miss_counter;
|
||||
break;
|
||||
@@ -180,17 +177,17 @@ static void mpc8xx_pmu_del(struct perf_event *event, int flags)
|
||||
break;
|
||||
case PERF_8xx_ID_ITLB_LOAD_MISS:
|
||||
if (atomic_dec_return(&itlb_miss_ref) == 0) {
|
||||
patch_instruction(&itlb_miss_exit_1, insn);
|
||||
patch_instruction_site(&patch__itlbmiss_exit_1, insn);
|
||||
#ifndef CONFIG_PIN_TLB_TEXT
|
||||
patch_instruction(&itlb_miss_exit_2, insn);
|
||||
patch_instruction_site(&patch__itlbmiss_exit_2, insn);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case PERF_8xx_ID_DTLB_LOAD_MISS:
|
||||
if (atomic_dec_return(&dtlb_miss_ref) == 0) {
|
||||
patch_instruction(&dtlb_miss_exit_1, insn);
|
||||
patch_instruction(&dtlb_miss_exit_2, insn);
|
||||
patch_instruction(&dtlb_miss_exit_3, insn);
|
||||
patch_instruction_site(&patch__dtlbmiss_exit_1, insn);
|
||||
patch_instruction_site(&patch__dtlbmiss_exit_2, insn);
|
||||
patch_instruction_site(&patch__dtlbmiss_exit_3, insn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user