watchdog/harclockup/perf: Revert a33d44843d45 ("watchdog/hardlockup/perf: Simplify...
[linux-2.6-microblaze.git] / kernel / watchdog_hld.c
index 71a62ce..a7f137c 100644 (file)
@@ -21,6 +21,7 @@
 static DEFINE_PER_CPU(bool, hard_watchdog_warn);
 static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
+static DEFINE_PER_CPU(struct perf_event *, dead_event);
 static struct cpumask dead_events_mask;
 
 static unsigned long hardlockup_allcpu_dumped;
@@ -203,6 +204,8 @@ void hardlockup_detector_perf_disable(void)
 
        if (event) {
                perf_event_disable(event);
+               this_cpu_write(watchdog_ev, NULL);
+               this_cpu_write(dead_event, event);
                cpumask_set_cpu(smp_processor_id(), &dead_events_mask);
                watchdog_cpus--;
        }
@@ -218,7 +221,7 @@ void hardlockup_detector_perf_cleanup(void)
        int cpu;
 
        for_each_cpu(cpu, &dead_events_mask) {
-               struct perf_event *event = per_cpu(watchdog_ev, cpu);
+               struct perf_event *event = per_cpu(dead_event, cpu);
 
                /*
                 * Required because for_each_cpu() reports  unconditionally
@@ -226,7 +229,7 @@ void hardlockup_detector_perf_cleanup(void)
                 */
                if (event)
                        perf_event_release_kernel(event);
-               per_cpu(watchdog_ev, cpu) = NULL;
+               per_cpu(dead_event, cpu) = NULL;
        }
        cpumask_clear(&dead_events_mask);
 }