aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2011-11-08 09:52:15 -0500
committerRobert Richter <robert.richter@amd.com>2011-11-08 09:52:15 -0500
commitde346b6949063aa040ef607943b072835294f4b3 (patch)
tree11f5a10b9ab41a10ea26bf8ab1f133b802e7559e /arch/x86/oprofile
parentdcfce4a095932e6e95d83ad982be3609947963bc (diff)
parent9c48f1c629ecfa114850c03f875c6691003214de (diff)
Merge branch 'perf/core' into oprofile/master
Merge reason: Resolve conflicts with Don's NMI rework: commit 9c48f1c629ecfa114850c03f875c6691003214de Author: Don Zickus <dzickus@redhat.com> Date: Fri Sep 30 15:06:21 2011 -0400 x86, nmi: Wire up NMI handlers to new routines Conflicts: arch/x86/oprofile/nmi_timer_int.c Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r--arch/x86/oprofile/nmi_int.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 7ca4d43e8988..990c35bfa88f 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -61,26 +61,15 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
61} 61}
62 62
63 63
64static int profile_exceptions_notify(struct notifier_block *self, 64static int profile_exceptions_notify(unsigned int val, struct pt_regs *regs)
65 unsigned long val, void *data)
66{ 65{
67 struct die_args *args = (struct die_args *)data; 66 if (ctr_running)
68 int ret = NOTIFY_DONE; 67 model->check_ctrs(regs, &__get_cpu_var(cpu_msrs));
69 68 else if (!nmi_enabled)
70 switch (val) { 69 return NMI_DONE;
71 case DIE_NMI: 70 else
72 if (ctr_running) 71 model->stop(&__get_cpu_var(cpu_msrs));
73 model->check_ctrs(args->regs, &__get_cpu_var(cpu_msrs)); 72 return NMI_HANDLED;
74 else if (!nmi_enabled)
75 break;
76 else
77 model->stop(&__get_cpu_var(cpu_msrs));
78 ret = NOTIFY_STOP;
79 break;
80 default:
81 break;
82 }
83 return ret;
84} 73}
85 74
86static void nmi_cpu_save_registers(struct op_msrs *msrs) 75static void nmi_cpu_save_registers(struct op_msrs *msrs)
@@ -363,12 +352,6 @@ static void nmi_cpu_setup(void *dummy)
363 apic_write(APIC_LVTPC, APIC_DM_NMI); 352 apic_write(APIC_LVTPC, APIC_DM_NMI);
364} 353}
365 354
366static struct notifier_block profile_exceptions_nb = {
367 .notifier_call = profile_exceptions_notify,
368 .next = NULL,
369 .priority = NMI_LOCAL_LOW_PRIOR,
370};
371
372static void nmi_cpu_restore_registers(struct op_msrs *msrs) 355static void nmi_cpu_restore_registers(struct op_msrs *msrs)
373{ 356{
374 struct op_msr *counters = msrs->counters; 357 struct op_msr *counters = msrs->counters;
@@ -508,7 +491,8 @@ static int nmi_setup(void)
508 ctr_running = 0; 491 ctr_running = 0;
509 /* make variables visible to the nmi handler: */ 492 /* make variables visible to the nmi handler: */
510 smp_mb(); 493 smp_mb();
511 err = register_die_notifier(&profile_exceptions_nb); 494 err = register_nmi_handler(NMI_LOCAL, profile_exceptions_notify,
495 0, "oprofile");
512 if (err) 496 if (err)
513 goto fail; 497 goto fail;
514 498
@@ -538,7 +522,7 @@ static void nmi_shutdown(void)
538 put_online_cpus(); 522 put_online_cpus();
539 /* make variables visible to the nmi handler: */ 523 /* make variables visible to the nmi handler: */
540 smp_mb(); 524 smp_mb();
541 unregister_die_notifier(&profile_exceptions_nb); 525 unregister_nmi_handler(NMI_LOCAL, "oprofile");
542 msrs = &get_cpu_var(cpu_msrs); 526 msrs = &get_cpu_var(cpu_msrs);
543 model->shutdown(msrs); 527 model->shutdown(msrs);
544 free_msrs(); 528 free_msrs();