diff mbox

[2/3] powerpc: Make default kexec/crash_kernel ops implicit

Message ID 20081216162305.GB21749@oksana.dev.rtsoft.ru (mailing list archive)
State Accepted, archived
Commit 77733f8a33488307e7d4b9077d174647ecea92e1
Delegated to: Paul Mackerras
Headers show

Commit Message

Anton Vorontsov Dec. 16, 2008, 4:23 p.m. UTC
This patch removes need for each platform to specify default kexec and
crash kernel ops, thus effectively adds a working kexec support for most
boards.

Platforms that can't cope with default ops will explode in some weird
way (a hang or reboot is most likely), which means that the board's
kexec support should be fixed or blacklisted via dummy _prepare callback
returning -ENOSYS.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 arch/powerpc/kernel/machine_kexec.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

Comments

Michael Ellerman Dec. 21, 2008, 11:08 p.m. UTC | #1
On Tue, 2008-12-16 at 19:23 +0300, Anton Vorontsov wrote:
> This patch removes need for each platform to specify default kexec and
> crash kernel ops, thus effectively adds a working kexec support for most
> boards.
> 
> Platforms that can't cope with default ops will explode in some weird
> way (a hang or reboot is most likely), which means that the board's
> kexec support should be fixed or blacklisted via dummy _prepare callback
> returning -ENOSYS.

But where is the patch to do this?

The chance of kexec working on some random machine that's never been
tested is pretty slim, every driver needs to be aware its hardware might
be in a weird state, so enabling it by default is not a good idea IMHO.

cheers
Anton Vorontsov Dec. 22, 2008, 12:11 a.m. UTC | #2
On Mon, Dec 22, 2008 at 10:08:42AM +1100, Michael Ellerman wrote:
> On Tue, 2008-12-16 at 19:23 +0300, Anton Vorontsov wrote:
> > This patch removes need for each platform to specify default kexec and
> > crash kernel ops, thus effectively adds a working kexec support for most
> > boards.
> > 
> > Platforms that can't cope with default ops will explode in some weird
> > way (a hang or reboot is most likely), which means that the board's
> > kexec support should be fixed or blacklisted via dummy _prepare callback
> > returning -ENOSYS.
> 
> But where is the patch to do this?

The -ENOSYS dummy callback is a last resort thing to do when nobody
cares or it's impossible to fix the Kexec on some board. We don't
have any such boards (yet).

> The chance of kexec working on some random machine that's never been
> tested is pretty slim, every driver needs to be aware its hardware might
> be in a weird state,

The boards setup isn't always static. The Kexec might work perfectly
well on a standalone board, but might hang with some weird PCI device
attached to it (think that it might need some PCI fixup on shutdown).

I think that a "Kexec tested to work on a particular board" term
just doesn't exist. It might work, but it might hang with other setup
on the *same* board.

But in practice the Kexec work on every 6xx board I have. And I have
pretty much of Freescale boards (almost all from the 83xx series),
and I don't think it's practical to add #ifdef CONFIG_KEXEC into the
every board file...

Thus I don't think that disabling Kexec by default is a good idea.

Plus, note that PowerPC port is the only one that disables Kexec
by default (all other arches permit Kexec by default).

> so enabling it by default is not a good idea IMHO.

Why? A hang or plain/watchdog reboot is OK since kexec is as
dangerous as trying to boot another kernel using "reboot ->
u-boot -> new kernel" sequence -- it might not work, the new
kernel might not boot for some reason.
Michael Ellerman Dec. 23, 2008, 12:15 a.m. UTC | #3
On Mon, 2008-12-22 at 03:11 +0300, Anton Vorontsov wrote:
> On Mon, Dec 22, 2008 at 10:08:42AM +1100, Michael Ellerman wrote:
> > On Tue, 2008-12-16 at 19:23 +0300, Anton Vorontsov wrote:
> > > This patch removes need for each platform to specify default kexec and
> > > crash kernel ops, thus effectively adds a working kexec support for most
> > > boards.
> > > 
> > > Platforms that can't cope with default ops will explode in some weird
> > > way (a hang or reboot is most likely), which means that the board's
> > > kexec support should be fixed or blacklisted via dummy _prepare callback
> > > returning -ENOSYS.
> > 
> > But where is the patch to do this?
> 
> The -ENOSYS dummy callback is a last resort thing to do when nobody
> cares or it's impossible to fix the Kexec on some board. We don't
> have any such boards (yet).

Yes we do, iseries, so at the very least we need a patch for that.

> > The chance of kexec working on some random machine that's never been
> > tested is pretty slim, every driver needs to be aware its hardware might
> > be in a weird state,
> 
> The boards setup isn't always static. The Kexec might work perfectly
> well on a standalone board, but might hang with some weird PCI device
> attached to it (think that it might need some PCI fixup on shutdown).
> 
> I think that a "Kexec tested to work on a particular board" term
> just doesn't exist. It might work, but it might hang with other setup
> on the *same* board.

Sure, nothing is 100%, I'd just rather that someone has at least tried a
kexec on the basic config and had it work.

> But in practice the Kexec work on every 6xx board I have. And I have
> pretty much of Freescale boards (almost all from the 83xx series),
> and I don't think it's practical to add #ifdef CONFIG_KEXEC into the
> every board file...

OK in that case I'm OK with it. The Kconfig restricts it to only PPC64
or 6xx, so it's not enabled on _every_ platform.

cheers
diff mbox

Patch

diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 037ade7..4f797c0 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -22,6 +22,8 @@  void machine_crash_shutdown(struct pt_regs *regs)
 {
 	if (ppc_md.machine_crash_shutdown)
 		ppc_md.machine_crash_shutdown(regs);
+	else
+		default_machine_crash_shutdown(regs);
 }
 
 /*
@@ -33,11 +35,8 @@  int machine_kexec_prepare(struct kimage *image)
 {
 	if (ppc_md.machine_kexec_prepare)
 		return ppc_md.machine_kexec_prepare(image);
-	/*
-	 * Fail if platform doesn't provide its own machine_kexec_prepare
-	 * implementation.
-	 */
-	return -ENOSYS;
+	else
+		return default_machine_kexec_prepare(image);
 }
 
 void machine_kexec_cleanup(struct kimage *image)
@@ -54,13 +53,11 @@  void machine_kexec(struct kimage *image)
 {
 	if (ppc_md.machine_kexec)
 		ppc_md.machine_kexec(image);
-	else {
-		/*
-		 * Fall back to normal restart if platform doesn't provide
-		 * its own kexec function, and user insist to kexec...
-		 */
-		machine_restart(NULL);
-	}
+	else
+		default_machine_kexec(image);
+
+	/* Fall back to normal restart if we're still alive. */
+	machine_restart(NULL);
 	for(;;);
 }