From patchwork Thu Jun 27 19:59:07 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: 2795461 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 80B0C9F245 for ; Thu, 27 Jun 2013 20:06:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1FF52024E for ; Thu, 27 Jun 2013 20:06:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C40A02023E for ; Thu, 27 Jun 2013 20:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755123Ab3F0UCj (ORCPT ); Thu, 27 Jun 2013 16:02:39 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:49881 "EHLO e23smtp07.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755110Ab3F0UCg (ORCPT ); Thu, 27 Jun 2013 16:02:36 -0400 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Jun 2013 05:50:57 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 28 Jun 2013 05:50:55 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id C5A8B2CE8054; Fri, 28 Jun 2013 06:02:31 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5RK2Msv6357496; Fri, 28 Jun 2013 06:02:22 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5RK2TYN020328; Fri, 28 Jun 2013 06:02:31 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.209.72]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5RK2LOk020085; Fri, 28 Jun 2013 06:02:22 +1000 From: "Srivatsa S. Bhat" Subject: [PATCH v3 36/45] ia64: smp, tlb: 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, David.Laight@aculab.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, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, "Srivatsa S. Bhat" Date: Fri, 28 Jun 2013 01:29:07 +0530 Message-ID: <20130627195907.29830.12505.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130627195136.29830.10445.stgit@srivatsabhat.in.ibm.com> References: <20130627195136.29830.10445.stgit@srivatsabhat.in.ibm.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13062719-0260-0000-0000-0000033B3059 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: Tony Luck Cc: Fenghua Yu Cc: linux-ia64@vger.kernel.org Signed-off-by: Srivatsa S. Bhat --- arch/ia64/kernel/smp.c | 12 ++++++------ arch/ia64/mm/tlb.c | 4 ++-- 2 files changed, 8 insertions(+), 8 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/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c index 9fcd4e6..25991ba 100644 --- a/arch/ia64/kernel/smp.c +++ b/arch/ia64/kernel/smp.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -259,8 +260,7 @@ smp_flush_tlb_cpumask(cpumask_t xcpumask) cpumask_t cpumask = xcpumask; int mycpu, cpu, flush_mycpu = 0; - preempt_disable(); - mycpu = smp_processor_id(); + mycpu = get_online_cpus_atomic(); for_each_cpu_mask(cpu, cpumask) counts[cpu] = local_tlb_flush_counts[cpu].count & 0xffff; @@ -280,7 +280,7 @@ smp_flush_tlb_cpumask(cpumask_t xcpumask) while(counts[cpu] == (local_tlb_flush_counts[cpu].count & 0xffff)) udelay(FLUSH_DELAY); - preempt_enable(); + put_online_cpus_atomic(); } void @@ -293,12 +293,12 @@ void smp_flush_tlb_mm (struct mm_struct *mm) { cpumask_var_t cpus; - preempt_disable(); + get_online_cpus_atomic(); /* this happens for the common case of a single-threaded fork(): */ if (likely(mm == current->active_mm && atomic_read(&mm->mm_users) == 1)) { local_finish_flush_tlb_mm(mm); - preempt_enable(); + put_online_cpus_atomic(); return; } if (!alloc_cpumask_var(&cpus, GFP_ATOMIC)) { @@ -313,7 +313,7 @@ smp_flush_tlb_mm (struct mm_struct *mm) local_irq_disable(); local_finish_flush_tlb_mm(mm); local_irq_enable(); - preempt_enable(); + put_online_cpus_atomic(); } void arch_send_call_function_single_ipi(int cpu) diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c index ed61297..8c55ef5 100644 --- a/arch/ia64/mm/tlb.c +++ b/arch/ia64/mm/tlb.c @@ -87,11 +87,11 @@ wrap_mmu_context (struct mm_struct *mm) * can't call flush_tlb_all() here because of race condition * with O(1) scheduler [EF] */ - cpu = get_cpu(); /* prevent preemption/migration */ + cpu = get_online_cpus_atomic(); /* prevent preemption/migration */ for_each_online_cpu(i) if (i != cpu) per_cpu(ia64_need_tlb_flush, i) = 1; - put_cpu(); + put_online_cpus_atomic(); local_flush_tlb_all(); }