diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-03-13 16:43:47 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-06 09:29:46 +0200 |
commit | 039fc91e064b81c2820ff16c304be5aba35fd126 (patch) | |
tree | 2167c0dfeac53bb52dfb078f23de4896249b4118 /kernel/perf_counter.c | |
parent | 592903cdcbf606a838056bae6d03fc557806c914 (diff) | |
download | lwn-039fc91e064b81c2820ff16c304be5aba35fd126.tar.gz lwn-039fc91e064b81c2820ff16c304be5aba35fd126.zip |
perf_counter: fix hrtimer sampling
Impact: fix deadlock with perfstat
Fix for the perfstat fubar..
We cannot unconditionally call hrtimer_cancel() without ever having done
hrtimer_init() on the thing.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Orig-LKML-Reference: <1236959027.22447.149.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r-- | kernel/perf_counter.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 8d6ecfa64c0e..d6cc22271ef4 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c @@ -1571,9 +1571,9 @@ static int cpu_clock_perf_counter_enable(struct perf_counter *counter) int cpu = raw_smp_processor_id(); atomic64_set(&hwc->prev_count, cpu_clock(cpu)); + hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + hwc->hrtimer.function = perf_swcounter_hrtimer; if (hwc->irq_period) { - hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hwc->hrtimer.function = perf_swcounter_hrtimer; __hrtimer_start_range_ns(&hwc->hrtimer, ns_to_ktime(hwc->irq_period), 0, HRTIMER_MODE_REL, 0); @@ -1635,9 +1635,9 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter) struct hw_perf_counter *hwc = &counter->hw; atomic64_set(&hwc->prev_count, task_clock_perf_counter_val(counter, 0)); + hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + hwc->hrtimer.function = perf_swcounter_hrtimer; if (hwc->irq_period) { - hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hwc->hrtimer.function = perf_swcounter_hrtimer; __hrtimer_start_range_ns(&hwc->hrtimer, ns_to_ktime(hwc->irq_period), 0, HRTIMER_MODE_REL, 0); |