linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Chenhui <chenhui.zhao@freescale.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/sysfs: disable hotplug for the boot cpu
Date: Mon, 3 Jun 2013 18:43:15 +0800	[thread overview]
Message-ID: <20130603104315.GA1365@localhost.localdomain> (raw)
In-Reply-To: <1370036984.3928.144.camel@pasglop>

On Sat, Jun 01, 2013 at 07:49:44AM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2013-05-28 at 15:59 +0800, Zhao Chenhui wrote:
> > Some features depend on the boot cpu, for instance, hibernate/suspend.
> > So disable hotplug for the boot cpu.
> 
> Don't we have code to "move" the boot CPU around when that happens ?
> 
> Ben.
> 

Currently, the code in generic_cpu_disable() likes this:

        if (cpu == boot_cpuid)                                                 
	                return -EBUSY;

If the dying cpu is the boot cpu, it will return -EBUSY. In the subsequent error handling,
cpu_notify_nofail(CPU_DOWN_FAILED) in _cpu_down() will be called. Unfortunately, some
cpu notifier callbacks handled CPU_DOWN_PREPARE, but not CPU_DOWN_FAILED, such as sched_cpu_inactive().
So it will cause issues.

If we set the hotpluggable for the boot cpu, we can prevent user applications from disabling the boot cpu.

-Chenhui

> > Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
> > ---
> >  arch/powerpc/kernel/sysfs.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> > index e68a845..294b1c4e 100644
> > --- a/arch/powerpc/kernel/sysfs.c
> > +++ b/arch/powerpc/kernel/sysfs.c
> > @@ -655,8 +655,10 @@ static int __init topology_init(void)
> >  		 * CPU.  For instance, the boot cpu might never be valid
> >  		 * for hotplugging.
> >  		 */
> > -		if (ppc_md.cpu_die)
> > +		if (ppc_md.cpu_die && cpu != boot_cpuid)
> >  			c->hotpluggable = 1;
> > +		else
> > +			c->hotpluggable = 0;
> >  
> >  		if (cpu_online(cpu) || c->hotpluggable) {
> >  			register_cpu(c, cpu);
> 
> 
> 

  reply	other threads:[~2013-06-03 10:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28  7:59 [PATCH] powerpc/mpic: fix irq distribution problem when MPIC_SINGLE_DEST_CPU Zhao Chenhui
2013-05-28  7:59 ` [PATCH] powerpc/sysfs: disable hotplug for the boot cpu Zhao Chenhui
2013-05-31 21:49   ` Benjamin Herrenschmidt
2013-06-03 10:43     ` Zhao Chenhui [this message]
2013-06-12  3:25       ` Benjamin Herrenschmidt
2013-06-13 11:25         ` Zhao Chenhui
2013-06-14 22:53           ` Benjamin Herrenschmidt

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=20130603104315.GA1365@localhost.localdomain \
    --to=chenhui.zhao@freescale.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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;
as well as URLs for NNTP newsgroup(s).