aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2009-07-09 12:33:02 -0400
committerRobert Richter <robert.richter@amd.com>2009-07-14 10:44:51 -0400
commit44ab9a6b0e909145d42615493952fe986b1ce5c2 (patch)
tree401df1bc15b9d7cb65dc3b9f8ced433caecaf683 /arch
parent8045a4c293d36c61656a20d581b11f7f0cd7acd5 (diff)
x86/oprofile: Rework and simplify nmi_cpu_setup()
This patch removes the function nmi_save_registers(). Per-cpu code is now executed only in the function nmi_cpu_setup(). Also, it renames the per-cpu function nmi_restore_registers() to nmi_cpu_restore_registers(). Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/oprofile/nmi_int.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 93df76dd60f4..25da1e17815d 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -87,13 +87,6 @@ static void nmi_cpu_save_registers(struct op_msrs *msrs)
87 } 87 }
88} 88}
89 89
90static void nmi_save_registers(void *dummy)
91{
92 int cpu = smp_processor_id();
93 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
94 nmi_cpu_save_registers(msrs);
95}
96
97static void free_msrs(void) 90static void free_msrs(void)
98{ 91{
99 int i; 92 int i;
@@ -137,6 +130,7 @@ static void nmi_cpu_setup(void *dummy)
137{ 130{
138 int cpu = smp_processor_id(); 131 int cpu = smp_processor_id();
139 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu); 132 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
133 nmi_cpu_save_registers(msrs);
140 spin_lock(&oprofilefs_lock); 134 spin_lock(&oprofilefs_lock);
141 model->setup_ctrs(model, msrs); 135 model->setup_ctrs(model, msrs);
142 spin_unlock(&oprofilefs_lock); 136 spin_unlock(&oprofilefs_lock);
@@ -182,13 +176,12 @@ static int nmi_setup(void)
182 } 176 }
183 177
184 } 178 }
185 on_each_cpu(nmi_save_registers, NULL, 1);
186 on_each_cpu(nmi_cpu_setup, NULL, 1); 179 on_each_cpu(nmi_cpu_setup, NULL, 1);
187 nmi_enabled = 1; 180 nmi_enabled = 1;
188 return 0; 181 return 0;
189} 182}
190 183
191static void nmi_restore_registers(struct op_msrs *msrs) 184static void nmi_cpu_restore_registers(struct op_msrs *msrs)
192{ 185{
193 struct op_msr *counters = msrs->counters; 186 struct op_msr *counters = msrs->counters;
194 struct op_msr *controls = msrs->controls; 187 struct op_msr *controls = msrs->controls;
@@ -220,7 +213,7 @@ static void nmi_cpu_shutdown(void *dummy)
220 apic_write(APIC_LVTERR, v | APIC_LVT_MASKED); 213 apic_write(APIC_LVTERR, v | APIC_LVT_MASKED);
221 apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu)); 214 apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu));
222 apic_write(APIC_LVTERR, v); 215 apic_write(APIC_LVTERR, v);
223 nmi_restore_registers(msrs); 216 nmi_cpu_restore_registers(msrs);
224} 217}
225 218
226static void nmi_shutdown(void) 219static void nmi_shutdown(void)