From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbbFXK1u (ORCPT ); Wed, 24 Jun 2015 06:27:50 -0400 Received: from casper.infradead.org ([85.118.1.10]:36362 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbbFXK1m (ORCPT ); Wed, 24 Jun 2015 06:27:42 -0400 Date: Wed, 24 Jun 2015 12:27:33 +0200 From: Peter Zijlstra To: Vitaly Kuznetsov Cc: KY Srinivasan , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" , "mingo@kernel.org" , "rafael.j.wysocki@intel.com" , "tglx@linutronix.de" Subject: Re: [PATCH 1/1] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable Message-ID: <20150624102733.GK3644@twins.programming.kicks-ass.net> References: <1434941760-16858-1-git-send-email-kys@microsoft.com> <20150623181310.GG3644@twins.programming.kicks-ass.net> <87twtx786y.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87twtx786y.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2015 at 11:43:33AM +0200, Vitaly Kuznetsov wrote: > Peter Zijlstra writes: > > On Tue, Jun 23, 2015 at 04:57:05PM +0000, KY Srinivasan wrote: > > > >> > diff --git a/kernel/cpu.c b/kernel/cpu.c > >> > index 94bbe46..8f35ee6 100644 > >> > --- a/kernel/cpu.c > >> > +++ b/kernel/cpu.c > >> > @@ -190,17 +190,19 @@ void cpu_hotplug_done(void) > >> > void cpu_hotplug_disable(void) > >> > { > >> > cpu_maps_update_begin(); > >> > - cpu_hotplug_disabled = 1; > >> > + cpu_hotplug_disabled++; > >> > cpu_maps_update_done(); > >> > } > >> > +EXPORT_SYMBOL_GPL(cpu_hotplug_disable); > >> > > >> > void cpu_hotplug_enable(void) > >> > { > >> > cpu_maps_update_begin(); > >> > - cpu_hotplug_disabled = 0; > >> > + if (cpu_hotplug_disabled) > >> > + cpu_hotplug_disabled--; > > > > No that just papers over bugs. > > Yes, but these bugs are not in Linux. I don't see any other way for a > platform to enable/disable cpu hotplug in runtime. Any code using this had better be open source, if not I really don't care anyway. That really ought to be: WARN_ON(--cpu_hotplug_disabled < 0); You do not make underflows go away.