2012-06-14 21:27:32

by Per Förlin

[permalink] [raw]
Subject: [PATCH] reboot: disable nonboot CPUs

Disable the nonboot CPUs to safely migrate tasks and interrupts
to the boot CPU. This will prevent the nonboot CPUs to
interfer or block the boot CPU from being able to reboot
the system successfully.

Signed-off-by: Per Forlin <[email protected]>
---
Is there a reason for disable nonboot CPUs only for power_off but not reboot?

I have run into an issue on an ARM platform that prevents reboot unless
the nonboot CPUs are brought down safetly. I could make this patch ARM
specific but I thought that other ARCHs may benefit from this patch too.

kernel/sys.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index f0ec44d..0eaa8e0 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -323,6 +323,7 @@ void kernel_restart_prepare(char *cmd)
system_state = SYSTEM_RESTART;
usermodehelper_disable();
device_shutdown();
+ disable_nonboot_cpus();
syscore_shutdown();
}

--
1.7.8


2012-06-14 21:41:51

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH] reboot: disable nonboot CPUs

On Thu, Jun 14, 2012 at 2:25 PM, Per Forlin <[email protected]> wrote:
> Disable the nonboot CPUs to safely migrate tasks and interrupts
> to the boot CPU. This will prevent the nonboot CPUs to
> interfer or block the boot CPU from being able to reboot
> the system successfully.

Reviewed-by: Kees Cook <[email protected]>

This seems reasonable to me, though I haven't looked too deeply at the
reboot path.

-Kees

--
Kees Cook
Chrome OS Security

2012-06-14 21:48:41

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH] reboot: disable nonboot CPUs

On Thu, Jun 14, 2012 at 02:41:48PM -0700, Kees Cook wrote:
> On Thu, Jun 14, 2012 at 2:25 PM, Per Forlin <[email protected]> wrote:
> > Disable the nonboot CPUs to safely migrate tasks and interrupts
> > to the boot CPU. This will prevent the nonboot CPUs to
> > interfer or block the boot CPU from being able to reboot
> > the system successfully.
>
> Reviewed-by: Kees Cook <[email protected]>
>
> This seems reasonable to me, though I haven't looked too deeply at the
> reboot path.

Looks reasonable to me as well, but better to add some more CC,
since syscore_shutdown seems to call for generic irqs to shutdown
when cpu get turned off already, not sure if this have any side
effect and/or I've missed something (Thomas CC'ed).

Cyrill

2012-06-22 20:57:07

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] reboot: disable nonboot CPUs

On Fri, 15 Jun 2012 01:48:34 +0400
Cyrill Gorcunov <[email protected]> wrote:

> On Thu, Jun 14, 2012 at 02:41:48PM -0700, Kees Cook wrote:
> > On Thu, Jun 14, 2012 at 2:25 PM, Per Forlin <[email protected]> wrote:
> > > Disable the nonboot CPUs to safely migrate tasks and interrupts
> > > to the boot CPU. This will prevent the nonboot CPUs to
> > > interfer or block the boot CPU from being able to reboot
> > > the system successfully.
> >
> > Reviewed-by: Kees Cook <[email protected]>
> >
> > This seems reasonable to me, though I haven't looked too deeply at the
> > reboot path.
>
> Looks reasonable to me as well, but better to add some more CC,

That worked well :(

> since syscore_shutdown seems to call for generic irqs to shutdown
> when cpu get turned off already, not sure if this have any side
> effect and/or I've missed something (Thomas CC'ed).

Let's use the scientific method: stick it in the tree and see what
happens. If it breaks, we fix or revert it.

2012-06-22 21:13:26

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [PATCH] reboot: disable nonboot CPUs

On Fri, Jun 22, 2012 at 01:57:04PM -0700, Andrew Morton wrote:
> > since syscore_shutdown seems to call for generic irqs to shutdown
> > when cpu get turned off already, not sure if this have any side
> > effect and/or I've missed something (Thomas CC'ed).
>
> Let's use the scientific method: stick it in the tree and see what
> happens. If it breaks, we fix or revert it.

yeah, i'll try to find some time on weekend for deeper review.

Cyrill