Commit a377062a authored by Richard Henderson's avatar Richard Henderson

[OPROF] Fix arguments to oprofile_add_sample.

parent 8007f78e
...@@ -101,7 +101,8 @@ ev4_handle_interrupt(unsigned long which, struct pt_regs *regs, ...@@ -101,7 +101,8 @@ ev4_handle_interrupt(unsigned long which, struct pt_regs *regs,
return; return;
/* Record the sample. */ /* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id()); oprofile_add_sample(regs->pc, !user_mode(regs),
which, smp_processor_id());
} }
......
...@@ -186,7 +186,8 @@ ev5_handle_interrupt(unsigned long which, struct pt_regs *regs, ...@@ -186,7 +186,8 @@ ev5_handle_interrupt(unsigned long which, struct pt_regs *regs,
struct op_counter_config *ctr) struct op_counter_config *ctr)
{ {
/* Record the sample. */ /* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id()); oprofile_add_sample(regs->pc, !user_mode(regs),
which, smp_processor_id());
} }
...@@ -195,7 +196,7 @@ struct op_axp_model op_model_ev5 = { ...@@ -195,7 +196,7 @@ struct op_axp_model op_model_ev5 = {
.cpu_setup = ev5_cpu_setup, .cpu_setup = ev5_cpu_setup,
.reset_ctr = ev5_reset_ctr, .reset_ctr = ev5_reset_ctr,
.handle_interrupt = ev5_handle_interrupt, .handle_interrupt = ev5_handle_interrupt,
.cpu = "alpha/ev5", .cpu_type = "alpha/ev5",
.num_counters = 3, .num_counters = 3,
.can_set_proc_mode = 1, .can_set_proc_mode = 1,
}; };
...@@ -205,7 +206,7 @@ struct op_axp_model op_model_pca56 = { ...@@ -205,7 +206,7 @@ struct op_axp_model op_model_pca56 = {
.cpu_setup = ev5_cpu_setup, .cpu_setup = ev5_cpu_setup,
.reset_ctr = ev5_reset_ctr, .reset_ctr = ev5_reset_ctr,
.handle_interrupt = ev5_handle_interrupt, .handle_interrupt = ev5_handle_interrupt,
.cpu = "alpha/pca56", .cpu_type = "alpha/pca56",
.num_counters = 3, .num_counters = 3,
.can_set_proc_mode = 1, .can_set_proc_mode = 1,
}; };
...@@ -88,7 +88,8 @@ ev6_handle_interrupt(unsigned long which, struct pt_regs *regs, ...@@ -88,7 +88,8 @@ ev6_handle_interrupt(unsigned long which, struct pt_regs *regs,
struct op_counter_config *ctr) struct op_counter_config *ctr)
{ {
/* Record the sample. */ /* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id()); oprofile_add_sample(regs->pc, !user_mode(regs),
which, smp_processor_id());
} }
...@@ -97,7 +98,7 @@ struct op_axp_model op_model_ev6 = { ...@@ -97,7 +98,7 @@ struct op_axp_model op_model_ev6 = {
.cpu_setup = ev6_cpu_setup, .cpu_setup = ev6_cpu_setup,
.reset_ctr = ev6_reset_ctr, .reset_ctr = ev6_reset_ctr,
.handle_interrupt = ev6_handle_interrupt, .handle_interrupt = ev6_handle_interrupt,
.cpu = "alpha/ev6", .cpu_type = "alpha/ev6",
.num_counters = 2, .num_counters = 2,
.can_set_proc_mode = 0, .can_set_proc_mode = 0,
}; };
...@@ -130,15 +130,16 @@ enum profileme_counters { ...@@ -130,15 +130,16 @@ enum profileme_counters {
PM_NUM_COUNTERS PM_NUM_COUNTERS
}; };
static void static inline void
op_add_pm(unsigned long pc, unsigned long counter, op_add_pm(unsigned long pc, int kern, unsigned long counter,
struct op_counter_config *ctr, unsigned long event) struct op_counter_config *ctr, unsigned long event)
{ {
unsigned long fake_counter = 2 + event; unsigned long fake_counter = 2 + event;
if (counter == 1) if (counter == 1)
fake_counter += PM_NUM_COUNTERS; fake_counter += PM_NUM_COUNTERS;
if (ctr[fake_counter].enabled) if (ctr[fake_counter].enabled)
oprofile_add_sample(pc, fake_counter, smp_processor_id()); oprofile_add_sample(pc, kern, fake_counter,
smp_processor_id());
} }
static void static void
...@@ -146,6 +147,7 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs, ...@@ -146,6 +147,7 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
struct op_counter_config *ctr) struct op_counter_config *ctr)
{ {
unsigned long pmpc, pctr_ctl; unsigned long pmpc, pctr_ctl;
int kern = !user_mode(regs);
int mispredict = 0; int mispredict = 0;
union { union {
unsigned long v; unsigned long v;
...@@ -195,27 +197,27 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs, ...@@ -195,27 +197,27 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
to PALcode. Recognize ITB miss by PALcode to PALcode. Recognize ITB miss by PALcode
offset address, and get actual PC from offset address, and get actual PC from
EXC_ADDR. */ EXC_ADDR. */
oprofile_add_sample(regs->pc, which, oprofile_add_sample(regs->pc, kern, which,
smp_processor_id()); smp_processor_id());
if ((pmpc & ((1 << 15) - 1)) == 581) if ((pmpc & ((1 << 15) - 1)) == 581)
op_add_pm(regs->pc, which, ctr, PM_ITB_MISS); op_add_pm(regs->pc, kern, which,
ctr, PM_ITB_MISS);
/* Most other bit and counter values will be /* Most other bit and counter values will be
those for the first instruction in the those for the first instruction in the
fault handler, so we're done. */ fault handler, so we're done. */
return; return;
case TRAP_REPLAY: case TRAP_REPLAY:
if (i_stat.fields.load_store) op_add_pm(pmpc, kern, which, ctr,
op_add_pm(pmpc, which, ctr, PM_LOAD_STORE); (i_stat.fields.load_store
else ? PM_LOAD_STORE : PM_REPLAY));
op_add_pm(pmpc, which, ctr, PM_REPLAY);
break; break;
case TRAP_DTB_DOUBLE_MISS_3: case TRAP_DTB_DOUBLE_MISS_3:
case TRAP_DTB_DOUBLE_MISS_4: case TRAP_DTB_DOUBLE_MISS_4:
case TRAP_DTB_SINGLE_MISS: case TRAP_DTB_SINGLE_MISS:
op_add_pm(pmpc, which, ctr, PM_DTB_MISS); op_add_pm(pmpc, kern, which, ctr, PM_DTB_MISS);
break; break;
case TRAP_UNALIGNED: case TRAP_UNALIGNED:
op_add_pm(pmpc, which, ctr, PM_UNALIGNED); op_add_pm(pmpc, kern, which, ctr, PM_UNALIGNED);
break; break;
case TRAP_INVALID0: case TRAP_INVALID0:
case TRAP_FP_DISABLED: case TRAP_FP_DISABLED:
...@@ -235,21 +237,21 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs, ...@@ -235,21 +237,21 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
set. */ set. */
if (i_stat.fields.mispredict) { if (i_stat.fields.mispredict) {
mispredict = 1; mispredict = 1;
op_add_pm(pmpc, which, ctr, PM_MISPREDICT); op_add_pm(pmpc, kern, which, ctr, PM_MISPREDICT);
} }
} }
oprofile_add_sample(pmpc, which, smp_processor_id()); oprofile_add_sample(pmpc, kern, which, smp_processor_id());
pctr_ctl = wrperfmon(5, 0); pctr_ctl = wrperfmon(5, 0);
if (pctr_ctl & (1UL << 27)) if (pctr_ctl & (1UL << 27))
op_add_pm(pmpc, which, ctr, PM_STALLED); op_add_pm(pmpc, kern, which, ctr, PM_STALLED);
/* Unfortunately, TAK is undefined on mispredicted branches. /* Unfortunately, TAK is undefined on mispredicted branches.
??? It is also undefined for non-cbranch insns, should ??? It is also undefined for non-cbranch insns, should
check that. */ check that. */
if (!mispredict && pctr_ctl & (1UL << 0)) if (!mispredict && pctr_ctl & (1UL << 0))
op_add_pm(pmpc, which, ctr, PM_TAKEN); op_add_pm(pmpc, kern, which, ctr, PM_TAKEN);
} }
struct op_axp_model op_model_ev67 = { struct op_axp_model op_model_ev67 = {
...@@ -257,7 +259,7 @@ struct op_axp_model op_model_ev67 = { ...@@ -257,7 +259,7 @@ struct op_axp_model op_model_ev67 = {
.cpu_setup = ev67_cpu_setup, .cpu_setup = ev67_cpu_setup,
.reset_ctr = ev67_reset_ctr, .reset_ctr = ev67_reset_ctr,
.handle_interrupt = ev67_handle_interrupt, .handle_interrupt = ev67_handle_interrupt,
.cpu = "alpha/ev67", .cpu_type = "alpha/ev67",
.num_counters = 20, .num_counters = 20,
.can_set_proc_mode = 0, .can_set_proc_mode = 0,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment