aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-05-18 00:02:12 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-18 01:38:42 -0400
commitc0daaf3f1f672defa3a45ca449b76d0e86c55892 (patch)
tree640c68ca92430ef5edc4b161f306cd2840e63e1c /arch
parentdc3f81b129b5439ba7bac265bbc6a51a39275dae (diff)
perf_counter: powerpc: initialize cpuhw pointer before use
Commit 9e35ad38 ("perf_counter: Rework the perf counter disable/enable") added code to the powerpc hw_perf_enable (renamed from hw_perf_restore) to test cpuhw->disabled and return immediately if it is not set (i.e. if the PMU is already enabled). Unfortunately the test got added before cpuhw was initialized, resulting in an oops the first time hw_perf_enable got called. This fixes it by moving the initialization of cpuhw to before cpuhw->disabled is tested. [ Impact: fix oops-causing bug on powerpc ] Signed-off-by: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> LKML-Reference: <18960.56772.869734.304631@drongo.ozlabs.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/perf_counter.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index 6baae5a5c331..fe21b2440f28 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -450,12 +450,11 @@ void hw_perf_enable(void)
450 int idx; 450 int idx;
451 451
452 local_irq_save(flags); 452 local_irq_save(flags);
453 cpuhw = &__get_cpu_var(cpu_hw_counters);
453 if (!cpuhw->disabled) { 454 if (!cpuhw->disabled) {
454 local_irq_restore(flags); 455 local_irq_restore(flags);
455 return; 456 return;
456 } 457 }
457
458 cpuhw = &__get_cpu_var(cpu_hw_counters);
459 cpuhw->disabled = 0; 458 cpuhw->disabled = 0;
460 459
461 /* 460 /*