public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: KY Srinivasan <kys@microsoft.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [PATCH  1/1] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable
Date: Wed, 24 Jun 2015 12:27:33 +0200	[thread overview]
Message-ID: <20150624102733.GK3644@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <87twtx786y.fsf@vitty.brq.redhat.com>

On Wed, Jun 24, 2015 at 11:43:33AM +0200, Vitaly Kuznetsov wrote:
> Peter Zijlstra <peterz@infradead.org> 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.

  parent reply	other threads:[~2015-06-24 10:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22  2:56 [PATCH 1/1] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable K. Y. Srinivasan
2015-06-23 16:57 ` KY Srinivasan
2015-06-23 18:13   ` Peter Zijlstra
2015-06-24  9:43     ` Vitaly Kuznetsov
2015-06-24  9:54       ` Thomas Gleixner
2015-06-24 11:11         ` Vitaly Kuznetsov
2015-06-24 10:27       ` Peter Zijlstra [this message]
2015-06-24 11:14         ` Vitaly Kuznetsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150624102733.GK3644@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox