From patchwork Tue Jun 25 20:33:53 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: 2780651 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 149BA9F3A0 for ; Tue, 25 Jun 2013 20:38:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DFA8204C4 for ; Tue, 25 Jun 2013 20:38:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20C68204AE for ; Tue, 25 Jun 2013 20:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751469Ab3FYUhV (ORCPT ); Tue, 25 Jun 2013 16:37:21 -0400 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:47282 "EHLO e28smtp04.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754187Ab3FYUhQ (ORCPT ); Tue, 25 Jun 2013 16:37:16 -0400 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Jun 2013 02:00:59 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Jun 2013 02:00:57 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id D1C3E1258052; Wed, 26 Jun 2013 02:06:14 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5PKbRiZ6225920; Wed, 26 Jun 2013 02:07:27 +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 r5PKb8V6026313; Wed, 26 Jun 2013 06:37:11 +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 r5PKb6D6026248; Wed, 26 Jun 2013 06:37:07 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH v2 44/45] sparc: 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, "David S. Miller" , Sam Ravnborg , Thomas Gleixner , Dave Kleikamp , sparclinux@vger.kernel.org, "Srivatsa S. Bhat" Date: Wed, 26 Jun 2013 02:03:53 +0530 Message-ID: <20130625203353.16593.20506.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-5564-0000-0000-0000088564D2 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: "David S. Miller" Cc: Sam Ravnborg Cc: Thomas Gleixner Cc: Dave Kleikamp Cc: sparclinux@vger.kernel.org Signed-off-by: Srivatsa S. Bhat --- arch/sparc/kernel/smp_64.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" 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/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 77539ed..4f71a95 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -792,7 +792,9 @@ static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 d /* Send cross call to all processors except self. */ static void smp_cross_call(unsigned long *func, u32 ctx, u64 data1, u64 data2) { + get_online_cpus_atomic(); smp_cross_call_masked(func, ctx, data1, data2, cpu_online_mask); + put_online_cpus_atomic(); } extern unsigned long xcall_sync_tick; @@ -896,7 +898,7 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu) atomic_inc(&dcpage_flushes); #endif - this_cpu = get_cpu(); + this_cpu = get_online_cpus_atomic(); if (cpu == this_cpu) { __local_flush_dcache_page(page); @@ -922,7 +924,7 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu) } } - put_cpu(); + put_online_cpus_atomic(); } void flush_dcache_page_all(struct mm_struct *mm, struct page *page) @@ -933,7 +935,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page) if (tlb_type == hypervisor) return; - preempt_disable(); + get_online_cpus_atomic(); #ifdef CONFIG_DEBUG_DCFLUSH atomic_inc(&dcpage_flushes); @@ -958,7 +960,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page) } __local_flush_dcache_page(page); - preempt_enable(); + put_online_cpus_atomic(); } void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs) @@ -1150,6 +1152,7 @@ void smp_capture(void) { int result = atomic_add_ret(1, &smp_capture_depth); + get_online_cpus_atomic(); if (result == 1) { int ncpus = num_online_cpus(); @@ -1166,6 +1169,7 @@ void smp_capture(void) printk("done\n"); #endif } + put_online_cpus_atomic(); } void smp_release(void)