Commit 039fc91e authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

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: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Orig-LKML-Reference: <1236959027.22447.149.camel@twins>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 592903cd
...@@ -1571,9 +1571,9 @@ static int cpu_clock_perf_counter_enable(struct perf_counter *counter) ...@@ -1571,9 +1571,9 @@ static int cpu_clock_perf_counter_enable(struct perf_counter *counter)
int cpu = raw_smp_processor_id(); int cpu = raw_smp_processor_id();
atomic64_set(&hwc->prev_count, cpu_clock(cpu)); atomic64_set(&hwc->prev_count, cpu_clock(cpu));
if (hwc->irq_period) {
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swcounter_hrtimer; hwc->hrtimer.function = perf_swcounter_hrtimer;
if (hwc->irq_period) {
__hrtimer_start_range_ns(&hwc->hrtimer, __hrtimer_start_range_ns(&hwc->hrtimer,
ns_to_ktime(hwc->irq_period), 0, ns_to_ktime(hwc->irq_period), 0,
HRTIMER_MODE_REL, 0); HRTIMER_MODE_REL, 0);
...@@ -1635,9 +1635,9 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter) ...@@ -1635,9 +1635,9 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter)
struct hw_perf_counter *hwc = &counter->hw; struct hw_perf_counter *hwc = &counter->hw;
atomic64_set(&hwc->prev_count, task_clock_perf_counter_val(counter, 0)); atomic64_set(&hwc->prev_count, task_clock_perf_counter_val(counter, 0));
if (hwc->irq_period) {
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swcounter_hrtimer; hwc->hrtimer.function = perf_swcounter_hrtimer;
if (hwc->irq_period) {
__hrtimer_start_range_ns(&hwc->hrtimer, __hrtimer_start_range_ns(&hwc->hrtimer,
ns_to_ktime(hwc->irq_period), 0, ns_to_ktime(hwc->irq_period), 0,
HRTIMER_MODE_REL, 0); HRTIMER_MODE_REL, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment