Skip to contentSkip to conversation

disable ptcal in case of kdump reboot, v2

PATCH In review Arnd Bergmann 2 participants 6 messages Jun 12, 2008 – Jun 16, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover disable ptcal in case of kdump reboot, v2

Ok, second try, this time using Mikey's crash_shutdown_register.

#1 lore raw

PATCH 1/3 powerpc: provide dummy crash_shutdown_register

When kexec is disabled, the crash_shutdown_{un,}register functions are not available in the kernel.
This provides dummy inline functions for those so that the callers don't have to worry about it.

---
 include/asm-powerpc/kexec.h |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
include/asm-powerpc/kexec.h +12 -1
index 701857b..acdcdc6 100644
@@ -34,6 +34,8 @@
 #ifndef __ASSEMBLY__
 #include <linux/cpumask.h>
 
+typedef void (*crash_shutdown_t)(void);
+
 #ifdef CONFIG_KEXEC
 
 #ifdef __powerpc64__
@@ -123,7 +125,6 @@ struct pt_regs;
 extern void default_machine_kexec(struct kimage *image);
 extern int default_machine_kexec_prepare(struct kimage *image);
 extern void default_machine_crash_shutdown(struct pt_regs *regs);
-typedef void (*crash_shutdown_t)(void);
 extern int crash_shutdown_register(crash_shutdown_t handler);
 extern int crash_shutdown_unregister(crash_shutdown_t handler);
 
@@ -143,6 +144,16 @@ static inline int overlaps_crashkernel(unsigned long start, unsigned long size)
 
 static inline void reserve_crashkernel(void) { ; }
 
+static inline int crash_shutdown_register(crash_shutdown_t handler)
+{
+	return 0;
+}
+
+static inline int crash_shutdown_unregister(crash_shutdown_t handler)
+{
+	return 0;
+}
+
 #endif /* CONFIG_KEXEC */
 #endif /* ! __ASSEMBLY__ */
 #endif /* __KERNEL__ */
Signature · 3 lines
1.5.4.3

-- 
#2 lore raw

PATCH 2/3 powerpc/pseries: call pseries_kexec_setup only on pseries

In reply to Arnd Bergmann

The pseries_kexec_setup function overwrites some ppc_md pointers, so make sure it only gets called when running on the right architecture.

---
 arch/powerpc/platforms/pseries/kexec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/platforms/pseries/kexec.c +1 -1
index e9dd5fe..53cbd53 100644
@@ -70,4 +70,4 @@ static int __init pseries_kexec_setup(void)
 
 	return 0;
 }
-__initcall(pseries_kexec_setup);
+machine_device_initcall(pseries, pseries_kexec_setup);
Signature · 3 lines
1.5.4.3

-- 
#3 lore raw

PATCH 3/3 powerpc/cell: disable ptcal in case of crash kdump

In reply to Arnd Bergmann

We need to disable ptcal before starting a new kernel after a crash, in order to avoid overwriting data in the kdump kernel.

---
 arch/powerpc/platforms/cell/ras.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
arch/powerpc/platforms/cell/ras.c +18 -4
index 655704a..505f9b9 100644
@@ -17,6 +17,7 @@
 #include <asm/reg.h>
 #include <asm/io.h>
 #include <asm/prom.h>
+#include <asm/kexec.h>
 #include <asm/machdep.h>
 #include <asm/rtas.h>
 #include <asm/cell-regs.h>
@@ -226,6 +227,11 @@ static int cbe_ptcal_notify_reboot(struct notifier_block *nb,
 	return cbe_ptcal_disable();
 }
 
+static void cbe_ptcal_crash_shutdown(void)
+{
+	cbe_ptcal_disable();
+}
+
 static struct notifier_block cbe_ptcal_reboot_notifier = {
 	.notifier_call = cbe_ptcal_notify_reboot
 };
@@ -241,12 +247,20 @@ int __init cbe_ptcal_init(void)
 		return -ENODEV;
 
 	ret = register_reboot_notifier(&cbe_ptcal_reboot_notifier);
-	if (ret) {
-		printk(KERN_ERR "Can't disable PTCAL, so not enabling\n");
-		return ret;
-	}
+	if (ret)
+		goto out1;
+
+	ret = crash_shutdown_register(&cbe_ptcal_crash_shutdown);
+	if (ret)
+		goto out2;
 
 	return cbe_ptcal_enable();
+
+out2:
+	unregister_reboot_notifier(&cbe_ptcal_reboot_notifier);
+out1:
+	printk(KERN_ERR "Can't disable PTCAL, so not enabling\n");
+	return ret;
 }
 
 arch_initcall(cbe_ptcal_init);
Signature · 3 lines
1.5.4.3

-- 
Acked-by on v1 3/3
#4 lore raw

Re: [patch 3/3] powerpc/cell: disable ptcal in case of crash kdump

Quoted 1 line

[patch 3/3] powerpc/cell: disable ptcal in case of crash kdump

Cheers,

Jeremy

#5 lore raw

[PATCH 4/3] powerpc: increase CRASH_HANDLER_MAX

In reply to Arnd Bergmann

There are now two potential callers of machine_crash_shutdown, so increase the limit accordingly.

---
 arch/powerpc/kernel/crash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/crash.c +1 -1
index eae401d..0a8439a 100644
@@ -48,7 +48,7 @@ int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 cpumask_t cpus_in_sr = CPU_MASK_NONE;
 
-#define CRASH_HANDLER_MAX 1
+#define CRASH_HANDLER_MAX 2
 /* NULL terminated list of shutdown handles */
 static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
 static DEFINE_SPINLOCK(crash_handlers_lock);
Signature · 1 line
1.5.4.3