]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/x86/oprofile/nmi_int.c
x86, nmi: Wire up NMI handlers to new routines
[karo-tx-linux.git] / arch / x86 / oprofile / nmi_int.c
index 68894fdc034bc3cb01cd79b66ec995dadc7b7c67..adf8fb31aa7b30eb27f940f1c5e29b5c01159eec 100644 (file)
@@ -61,26 +61,15 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
 }
 
 
-static int profile_exceptions_notify(struct notifier_block *self,
-                                    unsigned long val, void *data)
+static int profile_exceptions_notify(unsigned int val, struct pt_regs *regs)
 {
-       struct die_args *args = (struct die_args *)data;
-       int ret = NOTIFY_DONE;
-
-       switch (val) {
-       case DIE_NMI:
-               if (ctr_running)
-                       model->check_ctrs(args->regs, &__get_cpu_var(cpu_msrs));
-               else if (!nmi_enabled)
-                       break;
-               else
-                       model->stop(&__get_cpu_var(cpu_msrs));
-               ret = NOTIFY_STOP;
-               break;
-       default:
-               break;
-       }
-       return ret;
+       if (ctr_running)
+               model->check_ctrs(regs, &__get_cpu_var(cpu_msrs));
+       else if (!nmi_enabled)
+               return NMI_DONE;
+       else
+               model->stop(&__get_cpu_var(cpu_msrs));
+       return NMI_HANDLED;
 }
 
 static void nmi_cpu_save_registers(struct op_msrs *msrs)
@@ -363,12 +352,6 @@ static void nmi_cpu_setup(void *dummy)
        apic_write(APIC_LVTPC, APIC_DM_NMI);
 }
 
-static struct notifier_block profile_exceptions_nb = {
-       .notifier_call = profile_exceptions_notify,
-       .next = NULL,
-       .priority = NMI_LOCAL_LOW_PRIOR,
-};
-
 static void nmi_cpu_restore_registers(struct op_msrs *msrs)
 {
        struct op_msr *counters = msrs->counters;
@@ -508,7 +491,8 @@ static int nmi_setup(void)
        ctr_running = 0;
        /* make variables visible to the nmi handler: */
        smp_mb();
-       err = register_die_notifier(&profile_exceptions_nb);
+       err = register_nmi_handler(NMI_LOCAL, profile_exceptions_notify,
+                                       0, "oprofile");
        if (err)
                goto fail;
 
@@ -538,7 +522,7 @@ static void nmi_shutdown(void)
        put_online_cpus();
        /* make variables visible to the nmi handler: */
        smp_mb();
-       unregister_die_notifier(&profile_exceptions_nb);
+       unregister_nmi_handler(NMI_LOCAL, "oprofile");
        msrs = &get_cpu_var(cpu_msrs);
        model->shutdown(msrs);
        free_msrs();