From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751670AbbFXLOK (ORCPT ); Wed, 24 Jun 2015 07:14:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60350 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055AbbFXLOG (ORCPT ); Wed, 24 Jun 2015 07:14:06 -0400 From: Vitaly Kuznetsov To: Peter Zijlstra 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 References: <1434941760-16858-1-git-send-email-kys@microsoft.com> <20150623181310.GG3644@twins.programming.kicks-ass.net> <87twtx786y.fsf@vitty.brq.redhat.com> <20150624102733.GK3644@twins.programming.kicks-ass.net> Date: Wed, 24 Jun 2015 13:14:02 +0200 In-Reply-To: <20150624102733.GK3644@twins.programming.kicks-ass.net> (Peter Zijlstra's message of "Wed, 24 Jun 2015 12:27:33 +0200") Message-ID: <87lhf97405.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > 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. Sorry, I was under an impression you were referring to the patch as a whole :-) Yes, I agree, let's add this WARN_ON(). -- Vitaly