public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Stephen Warren <swarren@nvidia.com>,
	Will Deacon <will.deacon@arm.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: call disable_nonboot_cpus() from machine_shutdown()
Date: Tue, 29 Jan 2013 15:01:34 -0700	[thread overview]
Message-ID: <510846BE.5090704@wwwdotorg.org> (raw)
In-Reply-To: <87d2xcfeew.fsf@xmission.com>

On 01/10/2013 10:59 PM, Eric W. Biederman wrote:
...
> disable_nonboot_cpus() should really be called
> sometimes_dangerously_hotunplug_all_but_one_cpu().
> 
> If that code is going to be something other than power management
> specific it is not cool that disable_nonboot_cpus() is not always
> enabled when SMP is enabled.  It means that architectures need to
> implement two different ways of shutting down cpus.
> 
> One of the truly nasty things about cpu_hotplug is that it requires that
> irqs be migrated away from a cpu with interrupts disabled, which at
> least on x86 in some interrupt delivery modes is impossible to do
> safely.  The only way to losslessly (and without wedging irq
> controllers) in those interrupt delivery modes (needed for more than 8
> cpus) is to migrate an irq in it's irq handler.  Which is fine for
> setting /proc/irq/$N/smp_affinity but is useless for cpu hot-unplug,
> where we need to guarantee that all irqs are going to stop hitting a
> cpu.

I'm a little confused about this; disable_nonboot_cpus() calls
_cpu_down() to hot-unplug the CPU, and the regular CPU hotplug path is
drivers/base/cpu.c:store_online() -> cpu_down() -> _cpu_down(), i.e. the
same basic code.

Given that, why is CPU hot unplug safe on x86 via sysfs (well, I'm just
assuming it must be, since it's enabled in my regular distro kernel and
appears to work fine), but not safe when it's done from
disable_nonboot_cpus()?

> Now sometimes_dangerously_hotunplug_all_but_one_cpu() on the reboot path 
> was added just a few months ago in Oct 2012, and it appears to due to
> weird ARM maintainership.  At least the x86 reboot_cpu_id option is
> broken due to that addition.

I guess this is true because reboot_cpu_id() isn't honored unless that
CPU is already offline, and disable_nonboot_cpus() probably took it
offline on average.

Perhaps x86's native_machine_shutdown() should explicitly bring that CPU
online if it's in cpu_possible_mask? Or perhaps disable_nonboot_cpus()
should be enhanced with x86's reboot_cpu_id logic, so it simply works
the same way across all architectures; that way some chunk of x86's
native_machine_shutdown() could be made common.

...
> We should remove disable_nonboot_cpus() from the reboot path.   It is
> still a crazy unmaintained cpu hotplug mess.

Even if we updated it to standardize the reboot_cpu_id logic across all
architectures, and hence made it still suitable for x86?

       reply	other threads:[~2013-01-29 22:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1357160861-26282-1-git-send-email-swarren@wwwdotorg.org>
     [not found] ` <50E4C9C6.20609@codeaurora.org>
     [not found]   ` <20130103120259.GB5193@mudshark.cambridge.arm.com>
     [not found]     ` <20130103122100.GN2631@n2100.arm.linux.org.uk>
     [not found]       ` <50E5E967.3020805@wwwdotorg.org>
     [not found]         ` <20130106162200.GC11025@mudshark.cambridge.arm.com>
     [not found]           ` <20130106164033.GA3222@n2100.arm.linux.org.uk>
     [not found]             ` <87ehhxahd1.fsf@xmission.com>
     [not found]               ` <20130107144812.GD3222@n2100.arm.linux.org.uk>
     [not found]                 ` <87d2xcfeew.fsf@xmission.com>
2013-01-29 22:01                   ` Stephen Warren [this message]
     [not found]               ` <50ECB49C.7010609@wwwdotorg.org>
     [not found]                 ` <87obgwb5d1.fsf@xmission.com>
2013-01-29 22:10                   ` [PATCH] ARM: call disable_nonboot_cpus() from machine_shutdown() Stephen Warren

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=510846BE.5090704@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=sboyd@codeaurora.org \
    --cc=swarren@nvidia.com \
    --cc=will.deacon@arm.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