From patchwork Thu Aug 26 14:40:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Zickus X-Patchwork-Id: 135031 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7QEftlB023838 for ; Thu, 26 Aug 2010 14:41:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753903Ab0HZOld (ORCPT ); Thu, 26 Aug 2010 10:41:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8783 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753904Ab0HZOlc (ORCPT ); Thu, 26 Aug 2010 10:41:32 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7QEeJJ5015309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 26 Aug 2010 10:40:19 -0400 Received: from redhat.com (dhcp-100-18-242.bos.redhat.com [10.16.18.242]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o7QEeIgV028416; Thu, 26 Aug 2010 10:40:18 -0400 Date: Thu, 26 Aug 2010 10:40:18 -0400 From: Don Zickus To: Maxim Levitsky Cc: Andrew Morton , Frederic Weisbecker , Len Brown , Sergey Senozhatsky , Yong Zhang , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Andy Grover Subject: Re: [PATCH] fix BUG using smp_processor_id() in touch_nmi_watchdog and touch_softlockup_watchdog Message-ID: <20100826144018.GL4879@redhat.com> References: <20100817083945.GA12022@swordfish.minsk.epam.com> <20100817092407.GB12022@swordfish.minsk.epam.com> <20100817103948.GA5352@swordfish.minsk.epam.com> <20100817131320.GX4879@redhat.com> <20100818024802.GA24748@nowhere> <20100818130156.43a183d9.akpm@linux-foundation.org> <20100820025749.GB4879@redhat.com> <1282817671.4338.0.camel@maxim-laptop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1282817671.4338.0.camel@maxim-laptop> User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 26 Aug 2010 14:41:55 +0000 (UTC) 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)