From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from git.linux-mips.org (marvin.linux-mips.org [78.24.191.183]) by ozlabs.org (Postfix) with ESMTP id BDD942C0090 for ; Wed, 26 Jun 2013 23:47:19 +1000 (EST) Received: from localhost.localdomain ([127.0.0.1]:48105 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S6834871Ab3FZNjoND0qI (ORCPT ); Wed, 26 Jun 2013 15:39:44 +0200 Date: Wed, 26 Jun 2013 15:39:12 +0200 From: Ralf Baechle To: "Srivatsa S. Bhat" Subject: Re: [PATCH v2 38/45] MIPS: Use get/put_online_cpus_atomic() to prevent CPU offline Message-ID: <20130626133912.GA4559@linux-mips.org> References: <20130625202452.16593.22810.stgit@srivatsabhat.in.ibm.com> <20130625203257.16593.15358.stgit@srivatsabhat.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20130625203257.16593.15358.stgit@srivatsabhat.in.ibm.com> Cc: linux-mips@linux-mips.org, David Daney , peterz@infradead.org, fweisbec@gmail.com, linux-kernel@vger.kernel.org, walken@google.com, mingo@kernel.org, linux-arch@vger.kernel.org, vincent.guittot@linaro.org, xiaoguangrong@linux.vnet.ibm.com, "Steven J. Hill" , wangyun@linux.vnet.ibm.com, paulmck@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, linux-pm@vger.kernel.org, rusty@rustcorp.com.au, rostedt@goodmis.org, Yong Zhang , namhyung@kernel.org, tglx@linutronix.de, Florian Fainelli , John Crispin , laijs@cn.fujitsu.com, zhong@linux.vnet.ibm.com, Sanjay Lal , netdev@vger.kernel.org, oleg@redhat.com, sbw@mit.edu, tj@kernel.org, akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, Jun 26, 2013 at 02:02:57AM +0530, Srivatsa S. Bhat wrote: > 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. I think the same change also needs to be applied to r4k_on_each_cpu() in arch/mips/mm/c-r4k.c which currently looks like: static inline void r4k_on_each_cpu(void (*func) (void *info), void *info) { preempt_disable(); #if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC) smp_call_function(func, info, 1); #endif func(info); preempt_enable(); } This is a slightly specialized version of on_each_cpu() which only calls out to other CPUs in actual multi-core environments and also - unlike on_each_cpu() doesn't disable interrupts for the sake of better interrupt latencies. Which reminds me ... Andrew, I was wondering why did 78eef01b0fae087c5fadbd85dd4fe2918c3a015f [[PATCH] on_each_cpu(): disable local interrupts] disable interrupts? The log is: ----- snip ----- When on_each_cpu() runs the callback on other CPUs, it runs with local interrupts disabled. So we should run the function with local interrupts disabled on this CPU, too. And do the same for UP, so the callback is run in the same environment on bo UP and SMP. (strictly it should do preempt_disable() too, but I think local_irq_disable is sufficiently equivalent). [...] ----- snip ----- I'm not entirely convinced the symmetry between UP and SMP environments is really worth it. Would anybody mind removing the local_irq_disable() ... local_irq_enable() from on_each_cpu()? Ralf