From patchwork Tue Jun 25 20:28:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa S. Bhat" X-Patchwork-Id: 254326 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BF2402C03FA for ; Wed, 26 Jun 2013 06:32:11 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752911Ab3FYUbp (ORCPT ); Tue, 25 Jun 2013 16:31:45 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:59738 "EHLO e28smtp06.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753415Ab3FYUbm (ORCPT ); Tue, 25 Jun 2013 16:31:42 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Jun 2013 01:54:11 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Jun 2013 01:54:09 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 4DDED3940057; Wed, 26 Jun 2013 02:01:37 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5PKVY7325165916; Wed, 26 Jun 2013 02:01:34 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5PKVYLn009330; Wed, 26 Jun 2013 06:31:37 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.199.80]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5PKVXgJ009232; Wed, 26 Jun 2013 06:31:33 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH v2 17/45] time/clocksource: Use get/put_online_cpus_atomic() to prevent CPU offline To: tglx@linutronix.de, peterz@infradead.org, tj@kernel.org, oleg@redhat.com, paulmck@linux.vnet.ibm.com, rusty@rustcorp.com.au, mingo@kernel.org, akpm@linux-foundation.org, namhyung@kernel.org, walken@google.com, vincent.guittot@linaro.org, laijs@cn.fujitsu.com Cc: rostedt@goodmis.org, wangyun@linux.vnet.ibm.com, xiaoguangrong@linux.vnet.ibm.com, sbw@mit.edu, fweisbec@gmail.com, zhong@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, srivatsa.bhat@linux.vnet.ibm.com, linux-pm@vger.kernel.org, linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, John Stultz , Thomas Gleixner , "Srivatsa S. Bhat" Date: Wed, 26 Jun 2013 01:58:20 +0530 Message-ID: <20130625202820.16593.17778.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130625202452.16593.22810.stgit@srivatsabhat.in.ibm.com> References: <20130625202452.16593.22810.stgit@srivatsabhat.in.ibm.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13062520-9574-0000-0000-00000875BFE7 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Once stop_machine() is gone from the CPU offline path, we won't be able to depend on disabling preemption to prevent CPUs from going offline from under us. Use the get/put_online_cpus_atomic() APIs to prevent CPUs from going offline, while invoking from atomic context. Cc: John Stultz Cc: Thomas Gleixner Signed-off-by: Srivatsa S. Bhat --- kernel/time/clocksource.c | 5 +++++ 1 file changed, 5 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index e713ef7..c4bbc25 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -30,6 +30,7 @@ #include /* for spin_unlock_irq() using preempt_count() m68k */ #include #include +#include #include "tick-internal.h" @@ -252,6 +253,7 @@ static void clocksource_watchdog(unsigned long data) int64_t wd_nsec, cs_nsec; int next_cpu, reset_pending; + get_online_cpus_atomic(); spin_lock(&watchdog_lock); if (!watchdog_running) goto out; @@ -329,6 +331,7 @@ static void clocksource_watchdog(unsigned long data) add_timer_on(&watchdog_timer, next_cpu); out: spin_unlock(&watchdog_lock); + put_online_cpus_atomic(); } static inline void clocksource_start_watchdog(void) @@ -367,6 +370,7 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs) { unsigned long flags; + get_online_cpus_atomic(); spin_lock_irqsave(&watchdog_lock, flags); if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) { /* cs is a clocksource to be watched. */ @@ -386,6 +390,7 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs) /* Check if the watchdog timer needs to be started. */ clocksource_start_watchdog(); spin_unlock_irqrestore(&watchdog_lock, flags); + put_online_cpus_atomic(); } static void clocksource_dequeue_watchdog(struct clocksource *cs)