From patchwork Sun Jun 23 13:40:56 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: 253504 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 448EF2C132A for ; Sun, 23 Jun 2013 23:51:15 +1000 (EST) Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [122.248.162.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e28smtp03.in.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 4E5FC2C0782 for ; Sun, 23 Jun 2013 23:44:18 +1000 (EST) Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 23 Jun 2013 19:08:18 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 23 Jun 2013 19:08:16 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id C6882125804E for ; Sun, 23 Jun 2013 19:13:13 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5NDiOoF25493642 for ; Sun, 23 Jun 2013 19:14:24 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5NDiAAB029361 for ; Sun, 23 Jun 2013 23:44:11 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.195.141]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5NDi8On029309; Sun, 23 Jun 2013 23:44:08 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH 13/45] timer: 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 Date: Sun, 23 Jun 2013 19:10:56 +0530 Message-ID: <20130623134053.19094.23654.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130623133642.19094.16038.stgit@srivatsabhat.in.ibm.com> References: <20130623133642.19094.16038.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: 13062313-3864-0000-0000-000008C2B90F Cc: linux-arch@vger.kernel.org, nikunj@linux.vnet.ibm.com, zhong@linux.vnet.ibm.com, linux-pm@vger.kernel.org, fweisbec@gmail.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, xiaoguangrong@linux.vnet.ibm.com, sbw@mit.edu, wangyun@linux.vnet.ibm.com, srivatsa.bhat@linux.vnet.ibm.com, netdev@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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: Thomas Gleixner Signed-off-by: Srivatsa S. Bhat --- kernel/timer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/timer.c b/kernel/timer.c index 15ffdb3..5db594c 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -729,6 +729,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, timer_stats_timer_set_start_info(timer); BUG_ON(!timer->function); + get_online_cpus_atomic(); base = lock_timer_base(timer, &flags); ret = detach_if_pending(timer, base, false); @@ -768,6 +769,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, out_unlock: spin_unlock_irqrestore(&base->lock, flags); + put_online_cpus_atomic(); return ret; } @@ -926,6 +928,7 @@ void add_timer_on(struct timer_list *timer, int cpu) timer_stats_timer_set_start_info(timer); BUG_ON(timer_pending(timer) || !timer->function); + get_online_cpus_atomic(); spin_lock_irqsave(&base->lock, flags); timer_set_base(timer, base); debug_activate(timer, timer->expires); @@ -940,6 +943,7 @@ void add_timer_on(struct timer_list *timer, int cpu) */ wake_up_nohz_cpu(cpu); spin_unlock_irqrestore(&base->lock, flags); + put_online_cpus_atomic(); } EXPORT_SYMBOL_GPL(add_timer_on);