Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_watchdog and touch_softlockup_watchdog

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Don Zickus
Date: Thursday, August 26, 2010 - 7:40 am

On Thu, Aug 26, 2010 at 01:14:31PM +0300, Maxim Levitsky wrote:

Hm, apparently it was separated out by the mail server.  Here it is again
with some of the headers removed I guess.

Cheers,
Don


From: Don Zickus <dzickus@redhat.com>
Date: Thu, 19 Aug 2010 22:48:26 -0400
Subject: [PATCH] [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).

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

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 kernel/watchdog.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 613bc1f..99e35a2 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -122,7 +122,7 @@ static void __touch_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);
 
@@ -142,7 +142,14 @@ void touch_all_softlockup_watchdogs(void)
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
 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();
 }
 EXPORT_SYMBOL(touch_nmi_watchdog);
@@ -430,6 +437,9 @@ static int watchdog_enable(int cpu)
 		wake_up_process(p);
 	}
 
+	/* if any cpu succeeds, watchdog is considered enabled for the system */
+	watchdog_enabled = 1;
+
 	return 0;
 }
 
@@ -452,9 +462,6 @@ static void watchdog_disable(int cpu)
 		per_cpu(softlockup_watchdog, cpu) = NULL;
 		kthread_stop(p);
 	}
-
-	/* if any cpu succeeds, watchdog is considered enabled for the system */
-	watchdog_enabled = 1;
 }
 
 static void watchdog_enable_all_cpus(void)
-- 
1.7.2.1
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
fix BUG: using smp_processor_id() in touch_nmi_watchdog an ..., Sergey Senozhatsky, (Fri Aug 13, 3:21 am)
[PATCH] fix BUG using smp_processor_id() in touch_nmi_watc ..., Sergey Senozhatsky, (Mon Aug 16, 7:08 am)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Frederic Weisbecker, (Mon Aug 16, 7:59 pm)
[PATCH] fix BUG using smp_processor_id() in touch_nmi_watc ..., Sergey Senozhatsky, (Tue Aug 17, 12:56 am)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Sergey Senozhatsky, (Tue Aug 17, 1:39 am)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Sergey Senozhatsky, (Tue Aug 17, 2:24 am)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Sergey Senozhatsky, (Tue Aug 17, 3:28 am)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Sergey Senozhatsky, (Tue Aug 17, 3:39 am)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Frederic Weisbecker, (Tue Aug 17, 7:48 pm)
Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_ ..., Don Zickus, (Thu Aug 26, 7:40 am)
[PATCH] avoid second smp_processor_id() call in __touch_wa ..., Sergey Senozhatsky, (Wed Sep 22, 2:00 am)
Re: [PATCH] avoid second smp_processor_id() call in __touc ..., Frederic Weisbecker, (Wed Sep 22, 9:27 am)
Re: [PATCH] avoid second smp_processor_id() call in __touc ..., Frederic Weisbecker, (Wed Sep 22, 9:47 am)
Re: [PATCH] avoid second smp_processor_id() call in __touc ..., Sergey Senozhatsky, (Sat Sep 25, 10:43 am)