Pārlūkot izejas kodu

lockup_detector: Sync touch_*_watchdog back to old semantics

During my rewrite, the semantics of touch_nmi_watchdog and
touch_softlockup_watchdog changed enough to break some drivers
(mostly over preemptable regions).

These are cases where long delays on one CPU (due to
print_delay for example) can cause long delays on other
CPUs - so we must 'touch' the nmi_watchdog flag of those
other CPUs as well.

This change brings those touch_*_watchdog() functions back in line
with to how they used to work.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: peterz@infradead.org
Cc: fweisbec@gmail.com
LKML-Reference: <1283310009-22168-2-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Don Zickus 14 gadi atpakaļ
vecāks
revīzija
68d3f1d810
1 mainītis faili ar 12 papildinājumiem un 5 dzēšanām
  1. 12 5
      kernel/watchdog.c

+ 12 - 5
kernel/watchdog.c

@@ -122,7 +122,7 @@ static void __touch_watchdog(void)
 
 
 void touch_softlockup_watchdog(void)
 void touch_softlockup_watchdog(void)
 {
 {
-	__get_cpu_var(watchdog_touch_ts) = 0;
+	__raw_get_cpu_var(watchdog_touch_ts) = 0;
 }
 }
 EXPORT_SYMBOL(touch_softlockup_watchdog);
 EXPORT_SYMBOL(touch_softlockup_watchdog);
 
 
@@ -142,7 +142,14 @@ void touch_all_softlockup_watchdogs(void)
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
 void touch_nmi_watchdog(void)
 void touch_nmi_watchdog(void)
 {
 {
-	__get_cpu_var(watchdog_nmi_touch) = true;
+	if (watchdog_enabled) {
+		unsigned cpu;
+
+		for_each_present_cpu(cpu) {
+			if (per_cpu(watchdog_nmi_touch, cpu) != true)
+				per_cpu(watchdog_nmi_touch, cpu) = true;
+		}
+	}
 	touch_softlockup_watchdog();
 	touch_softlockup_watchdog();
 }
 }
 EXPORT_SYMBOL(touch_nmi_watchdog);
 EXPORT_SYMBOL(touch_nmi_watchdog);
@@ -433,6 +440,9 @@ static int watchdog_enable(int cpu)
 		wake_up_process(p);
 		wake_up_process(p);
 	}
 	}
 
 
+	/* if any cpu succeeds, watchdog is considered enabled for the system */
+	watchdog_enabled = 1;
+
 	return 0;
 	return 0;
 }
 }
 
 
@@ -455,9 +465,6 @@ static void watchdog_disable(int cpu)
 		per_cpu(softlockup_watchdog, cpu) = NULL;
 		per_cpu(softlockup_watchdog, cpu) = NULL;
 		kthread_stop(p);
 		kthread_stop(p);
 	}
 	}
-
-	/* if any cpu succeeds, watchdog is considered enabled for the system */
-	watchdog_enabled = 1;
 }
 }
 
 
 static void watchdog_enable_all_cpus(void)
 static void watchdog_enable_all_cpus(void)