Merge commit 'v2.6.31-rc3'; commit 'tip/oprofile' into oprofile/core
[pandora-kernel.git] / arch / x86 / oprofile / nmi_int.c
index 3b84b78..93df76d 100644 (file)
@@ -60,8 +60,9 @@ static int profile_exceptions_notify(struct notifier_block *self,
 
        switch (val) {
        case DIE_NMI:
-               if (model->check_ctrs(args->regs, &per_cpu(cpu_msrs, cpu)))
-                       ret = NOTIFY_STOP;
+       case DIE_NMI_IPI:
+               model->check_ctrs(args->regs, &per_cpu(cpu_msrs, cpu));
+               ret = NOTIFY_STOP;
                break;
        default:
                break;
@@ -71,18 +72,16 @@ static int profile_exceptions_notify(struct notifier_block *self,
 
 static void nmi_cpu_save_registers(struct op_msrs *msrs)
 {
-       unsigned int const nr_ctrs = model->num_counters;
-       unsigned int const nr_ctrls = model->num_controls;
        struct op_msr *counters = msrs->counters;
        struct op_msr *controls = msrs->controls;
        unsigned int i;
 
-       for (i = 0; i < nr_ctrs; ++i) {
+       for (i = 0; i < model->num_counters; ++i) {
                if (counters[i].addr)
                        rdmsrl(counters[i].addr, counters[i].saved);
        }
 
-       for (i = 0; i < nr_ctrls; ++i) {
+       for (i = 0; i < model->num_controls; ++i) {
                if (controls[i].addr)
                        rdmsrl(controls[i].addr, controls[i].saved);
        }
@@ -148,7 +147,7 @@ static void nmi_cpu_setup(void *dummy)
 static struct notifier_block profile_exceptions_nb = {
        .notifier_call = profile_exceptions_notify,
        .next = NULL,
-       .priority = 0
+       .priority = 2
 };
 
 static int nmi_setup(void)
@@ -191,18 +190,16 @@ static int nmi_setup(void)
 
 static void nmi_restore_registers(struct op_msrs *msrs)
 {
-       unsigned int const nr_ctrs = model->num_counters;
-       unsigned int const nr_ctrls = model->num_controls;
        struct op_msr *counters = msrs->counters;
        struct op_msr *controls = msrs->controls;
        unsigned int i;
 
-       for (i = 0; i < nr_ctrls; ++i) {
+       for (i = 0; i < model->num_controls; ++i) {
                if (controls[i].addr)
                        wrmsrl(controls[i].addr, controls[i].saved);
        }
 
-       for (i = 0; i < nr_ctrs; ++i) {
+       for (i = 0; i < model->num_counters; ++i) {
                if (counters[i].addr)
                        wrmsrl(counters[i].addr, counters[i].saved);
        }
@@ -397,7 +394,7 @@ static int __init p4_init(char **cpu_type)
 static int force_arch_perfmon;
 static int force_cpu_type(const char *str, struct kernel_param *kp)
 {
-       if (!strcmp(str, "archperfmon")) {
+       if (!strcmp(str, "arch_perfmon")) {
                force_arch_perfmon = 1;
                printk(KERN_INFO "oprofile: forcing architectural perfmon\n");
        }
@@ -409,6 +406,7 @@ module_param_call(cpu_type, force_cpu_type, NULL, NULL, 0);
 static int __init ppro_init(char **cpu_type)
 {
        __u8 cpu_model = boot_cpu_data.x86_model;
+       struct op_x86_model_spec const *spec = &op_ppro_spec;   /* default */
 
        if (force_arch_perfmon && cpu_has_arch_perfmon)
                return 0;
@@ -435,7 +433,7 @@ static int __init ppro_init(char **cpu_type)
                *cpu_type = "i386/core_2";
                break;
        case 26:
-               model = &op_arch_perfmon_spec;
+               spec = &op_arch_perfmon_spec;
                *cpu_type = "i386/core_i7";
                break;
        case 28:
@@ -446,7 +444,7 @@ static int __init ppro_init(char **cpu_type)
                return 0;
        }
 
-       model = &op_ppro_spec;
+       model = spec;
        return 1;
 }