From patchwork Fri Aug 20 02:57:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Zickus X-Patchwork-Id: 120455 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7K2vcIX014191 for ; Fri, 20 Aug 2010 02:58:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751259Ab0HTC6n (ORCPT ); Thu, 19 Aug 2010 22:58:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18709 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242Ab0HTC6n (ORCPT ); Thu, 19 Aug 2010 22:58:43 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7K2voIh030977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 19 Aug 2010 22:57:51 -0400 Received: from redhat.com (dhcp-100-18-242.bos.redhat.com [10.16.18.242]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o7K2vnoP006217; Thu, 19 Aug 2010 22:57:49 -0400 Date: Thu, 19 Aug 2010 22:57:49 -0400 From: Don Zickus To: Andrew Morton Cc: 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: <20100820025749.GB4879@redhat.com> References: <20100817025954.GA12366@nowhere> <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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100818130156.43a183d9.akpm@linux-foundation.org> User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 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 (demeter.kernel.org [140.211.167.41]); Fri, 20 Aug 2010 02:58:44 +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)