public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Youquan Song <youquan.song@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Hansen <dave@sr71.net>, Toshi Kani <toshi.kani@hp.com>,
	Youquan Song <youquan.song@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: cpu hotplug: possible_cpus broken (again?) next-20130607
Date: Wed, 12 Jun 2013 13:02:32 +0200	[thread overview]
Message-ID: <4005805.V3phb1agMs@vostro.rjw.lan> (raw)
In-Reply-To: <CAE9FiQXWi7mn6AM=A2qrHO=3S_oLT7wBRLm19rP987hGzwdqKA@mail.gmail.com>

On Tuesday, June 11, 2013 09:07:37 PM Yinghai Lu wrote:
> On Wed, Jun 12, 2013 at 5:32 AM, Youquan Song
> <youquan.song@linux.intel.com> wrote:
> >> On 06/12/2013 05:03 AM, Youquan Song wrote:
> >> > +#ifdef CONFIG_SMP
> >> > +              /* return when cpu number greater than maximum number of
> >> > CPUs */
> >> > +               if (setup_max_cpus <= num_online_cpus() + 1) {
> >> > +                       cpu_hotplug_driver_unlock();
> >> > +                       return -EINVAL;
> >> > +               }
> >> > +#endif
> >> >                 from_nid = cpu_to_node(cpuid);
> >> >                 ret = cpu_up(cpuid);
> >>
> >> Your patch is line-wrapped.
> >>
> >> Also, the #ifdef is unnecessary.  If CONFIG_SMP is off:
> >>
> >>       static const unsigned int setup_max_cpus = NR_CPUS;
> >>       #define num_online_cpus() 1U
> >>
> >> The compiler will take care of optimizing out the the if() without the
> >> explicit #ifdef.
> >>
> >> Also, the +1 looks goofy to me.  Doesn't this do the same thing (and
> >> isn't it much easier to read)?
> >>
> >>       if (num_online_cpus() >= setup_max_cpus)
> >>
> >
> > Thanks. Here is a formal patch for it. please review and try.
> >
> > Subject: [PATCH] core: Fix maxcpus boot option broken
> >
> > maxcpus boot option to limit maximum number of CPUs on system, but this option
> > is broken at recent kernel. Though we use maxcpus to limit CPUs number, but
> > current kernel will register all of present CPUs in sysfs.
> > udev will enumerate all registered cpu at sysfs, and it will bring up the CPU
> > if the CPU is offline. So the maxcpus option is broken.
> >
> > This patch will limit the online cpus number not over limitation of maxcpus
> > option. So it will keep the maxcpus limitation when udev enumeration
> > or other intention of bring up CPUs over the limitation by method like
> > echo 1 > /sys/devices/system/cpu/online
> 
> Interesting, you are changing long standing meaning of maxcpus=
> 
> We always use maxcpus=1 to have one cpu up, and later in user space
> to online other cpus like
> echo 1 > /sys/devices/system/cpuX/online.
> 
> aka maxcpus= is a soft limit or initial online nr.
> 
> we already have nr_cpus= for hard limit.
> 
> So need to drop
>  commit 3e275a5ba367ab74b3a4e49114307baed989fcac
>  Author: Youquan Song <youquan.song@intel.com>
>  Date:   Fri Jun 7 10:07:08 2013 +1000
> 
>      drivers/base/cpu.c: fix maxcpus boot option

Agreed.

Thanks,
Rafael


> Greg,
> Can you drop that 3e275a5ba36 from your drivers/core tree ?
> 
> Thanks
> 
> Yinghai
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-06-12 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 21:51 cpu hotplug: possible_cpus broken (again?) next-20130607 Dave Hansen
2013-06-11 22:05 ` Rafael J. Wysocki
2013-06-11 22:17   ` Dave Hansen
2013-06-11 22:34     ` Rafael J. Wysocki
2013-06-11 22:32       ` Toshi Kani
2013-06-12 12:03         ` Youquan Song
2013-06-12  0:24           ` Dave Hansen
2013-06-12 12:32             ` Youquan Song
2013-06-12  4:07               ` Yinghai Lu
2013-06-12 11:02                 ` Rafael J. Wysocki [this message]
2013-06-13  1:36                   ` Youquan Song
2013-06-13 15:36                     ` Toshi Kani

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=4005805.V3phb1agMs@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=akpm@linux-foundation.org \
    --cc=dave@sr71.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@kernel.org \
    --cc=youquan.song@intel.com \
    --cc=youquan.song@linux.intel.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