Commit 728f660c authored by Richard Henderson's avatar Richard Henderson Committed by Richard Henderson

[OPROF] Tidy model handle_interrupt handling.

parent bf6831cf
...@@ -36,17 +36,8 @@ static struct op_register_config reg; ...@@ -36,17 +36,8 @@ static struct op_register_config reg;
static void static void
op_handle_interrupt(unsigned long which, struct pt_regs *regs) op_handle_interrupt(unsigned long which, struct pt_regs *regs)
{ {
if (model->handle_interrupt) { model->handle_interrupt(which, regs, ctr);
model->handle_interrupt(which, regs, ctr);
} else {
/* EV4 can't properly disable counters individually.
Discard "disabled" events now. */
if (!ctr[which].enabled)
return;
/* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id());
}
/* If the user has selected an interrupt frequency that is /* If the user has selected an interrupt frequency that is
not exactly the width of the counter, write a new value not exactly the width of the counter, write a new value
into the counter such that it'll overflow after N more into the counter such that it'll overflow after N more
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <linux/oprofile.h> #include <linux/oprofile.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp.h>
#include <asm/ptrace.h>
#include <asm/system.h> #include <asm/system.h>
#include "op_impl.h" #include "op_impl.h"
...@@ -89,10 +91,25 @@ ev4_cpu_setup(void *x) ...@@ -89,10 +91,25 @@ ev4_cpu_setup(void *x)
wrperfmon(3, reg->proc_mode); wrperfmon(3, reg->proc_mode);
} }
static void
ev4_handle_interrupt(unsigned long which, struct pt_regs *regs,
struct op_counter_config *ctr)
{
/* EV4 can't properly disable counters individually.
Discard "disabled" events now. */
if (!ctr[which].enabled)
return;
/* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id());
}
struct op_axp_model op_model_ev4 = { struct op_axp_model op_model_ev4 = {
.reg_setup = ev4_reg_setup, .reg_setup = ev4_reg_setup,
.cpu_setup = ev4_cpu_setup, .cpu_setup = ev4_cpu_setup,
.reset_ctr = NULL, .reset_ctr = NULL,
.handle_interrupt = ev4_handle_interrupt,
.cpu = OPROFILE_CPU_AXP_EV4, .cpu = OPROFILE_CPU_AXP_EV4,
.num_counters = 2, .num_counters = 2,
.can_set_proc_mode = 0, .can_set_proc_mode = 0,
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <linux/oprofile.h> #include <linux/oprofile.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp.h>
#include <asm/ptrace.h>
#include <asm/system.h> #include <asm/system.h>
#include "op_impl.h" #include "op_impl.h"
...@@ -179,10 +181,20 @@ ev5_reset_ctr(struct op_register_config *reg, unsigned long ctr) ...@@ -179,10 +181,20 @@ ev5_reset_ctr(struct op_register_config *reg, unsigned long ctr)
} }
} }
static void
ev5_handle_interrupt(unsigned long which, struct pt_regs *regs,
struct op_counter_config *ctr)
{
/* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id());
}
struct op_axp_model op_model_ev5 = { struct op_axp_model op_model_ev5 = {
.reg_setup = ev5_reg_setup, .reg_setup = ev5_reg_setup,
.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,
.cpu = OPROFILE_CPU_AXP_EV5, .cpu = OPROFILE_CPU_AXP_EV5,
.num_counters = 3, .num_counters = 3,
.can_set_proc_mode = 1, .can_set_proc_mode = 1,
...@@ -192,6 +204,7 @@ struct op_axp_model op_model_pca56 = { ...@@ -192,6 +204,7 @@ struct op_axp_model op_model_pca56 = {
.reg_setup = pca56_reg_setup, .reg_setup = pca56_reg_setup,
.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,
.cpu = OPROFILE_CPU_AXP_PCA56, .cpu = OPROFILE_CPU_AXP_PCA56,
.num_counters = 3, .num_counters = 3,
.can_set_proc_mode = 1, .can_set_proc_mode = 1,
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <linux/oprofile.h> #include <linux/oprofile.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp.h>
#include <asm/ptrace.h>
#include <asm/system.h> #include <asm/system.h>
#include "op_impl.h" #include "op_impl.h"
...@@ -81,10 +83,20 @@ ev6_reset_ctr(struct op_register_config *reg, unsigned long ctr) ...@@ -81,10 +83,20 @@ ev6_reset_ctr(struct op_register_config *reg, unsigned long ctr)
wrperfmon(6, reg->reset_values | (1 << ctr)); wrperfmon(6, reg->reset_values | (1 << ctr));
} }
static void
ev6_handle_interrupt(unsigned long which, struct pt_regs *regs,
struct op_counter_config *ctr)
{
/* Record the sample. */
oprofile_add_sample(regs->pc, which, smp_processor_id());
}
struct op_axp_model op_model_ev6 = { struct op_axp_model op_model_ev6 = {
.reg_setup = ev6_reg_setup, .reg_setup = ev6_reg_setup,
.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,
.cpu = OPROFILE_CPU_AXP_EV6, .cpu = OPROFILE_CPU_AXP_EV6,
.num_counters = 2, .num_counters = 2,
.can_set_proc_mode = 0, .can_set_proc_mode = 0,
......
...@@ -132,7 +132,8 @@ enum profileme_counters { ...@@ -132,7 +132,8 @@ enum profileme_counters {
static void static void
op_add_pm(unsigned long pc, unsigned long counter, op_add_pm(unsigned long pc, 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;
...@@ -142,7 +143,8 @@ op_add_pm(unsigned long pc, unsigned long counter, ...@@ -142,7 +143,8 @@ op_add_pm(unsigned long pc, unsigned long counter,
static void static void
ev67_handle_interrupt(unsigned long which, struct pt_regs *regs, 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 mispredict = 0; int mispredict = 0;
union { union {
......
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