Hello Matt,
I would like you to consider applying the following patch to the
latest tree. I could checkin these changes if you are okay with them.
What we are trying to do here is to:
- reduce #ifdef code by coding a static inline dump function
- keep all our extern function definitions in include/linux/dump.h
- remove the remaining VMDUMP from alpha/ia64
Note: you still need to remove arch/alpha/kernel/dump.c from cvs.
--
Regards,
Vamsi Krishna S.
Linux Technology Center,
IBM Software Labs, Bangalore.
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/alpha/config.in ./arch/alpha/config.in
--- /home/vamsi/lkcd_cvs/2.4/arch/alpha/config.in Fri Jul 6 05:13:04 2001
+++ ./arch/alpha/config.in Tue Sep 25 12:16:01 2001
@@ -361,7 +361,7 @@
fi
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
-bool 'Support kernel crash dump capabilities' CONFIG_VMDUMP
+bool 'Support kernel crash dump capabilities' CONFIG_DUMP
bool 'Legacy kernel start address' CONFIG_ALPHA_LEGACY_START_ADDRESS
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/alpha/kernel/dump.c
./arch/alpha/kernel/dump.c
--- /home/vamsi/lkcd_cvs/2.4/arch/alpha/kernel/dump.c Sun Sep 23 13:51:22 2001
+++ ./arch/alpha/kernel/dump.c Tue Sep 25 12:18:30 2001
@@ -16,7 +16,7 @@
*/
#include <linux/types.h>
#include <linux/fs.h>
-#include <linux/vmdump.h>
+#include <linux/dump.h>
#include <linux/mm.h>
/* static variables */
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/alpha/kernel/setup.c
./arch/alpha/kernel/setup.c
--- /home/vamsi/lkcd_cvs/2.4/arch/alpha/kernel/setup.c Fri Jul 6 05:13:04 2001
+++ ./arch/alpha/kernel/setup.c Tue Sep 25 12:15:44 2001
@@ -385,7 +385,7 @@
}
int
-#ifndef CONFIG_VMDUMP
+#ifndef CONFIG_DUMP
__init
#endif
page_is_ram(unsigned long pfn)
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/alpha/kernel/traps.c
./arch/alpha/kernel/traps.c
--- /home/vamsi/lkcd_cvs/2.4/arch/alpha/kernel/traps.c Fri Jul 6 05:13:04 2001
+++ ./arch/alpha/kernel/traps.c Tue Sep 25 12:14:26 2001
@@ -14,7 +14,7 @@
#include <linux/tty.h>
#include <linux/delay.h>
#include <linux/smp_lock.h>
-#include <linux/vmdump.h>
+#include <linux/dump.h>
#include <asm/gentrap.h>
#include <asm/uaccess.h>
@@ -23,10 +23,6 @@
#include "proto.h"
-#ifdef CONFIG_VMDUMP
-extern void (*dump_function_ptr)(char *, struct pt_regs *);
-#endif
-
void
dik_show_regs(struct pt_regs *regs, unsigned long *r9_15)
{
@@ -323,15 +319,7 @@
while (1);
}
current->thread.flags |= (1UL << 63);
-#ifdef CONFIG_VMDUMP
- dump_execute((char *)str, regs);
-#else
-#ifdef CONFIG_VMDUMP_MODULE
- if (dump_function_ptr) {
- dump_function_ptr((char *)str, regs);
- }
-#endif
-#endif
+ dump((char *)str, regs);
do_exit(SIGSEGV);
}
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/i386/kernel/traps.c
./arch/i386/kernel/traps.c
--- /home/vamsi/lkcd_cvs/2.4/arch/i386/kernel/traps.c Sun Sep 23 13:20:01 2001
+++ ./arch/i386/kernel/traps.c Tue Sep 25 12:11:35 2001
@@ -57,12 +57,6 @@
struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 } };
-#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
-extern void (*dump_function_ptr)(char *, struct pt_regs *);
-extern volatile int dump_in_progress;
-extern volatile int dumping_cpu;
-#endif
-
/*
* The IDT has to be page-aligned to simplify the Pentium
* F0 0F bug workaround.. We have a special link segment
@@ -227,11 +221,7 @@
spin_lock_irq(&die_lock);
printk("%s: %04lx\n", str, err & 0xffff);
show_registers(regs);
-#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
- if (dump_function_ptr) {
- dump_function_ptr((char *)str, regs);
- }
-#endif
+ dump(str, regs);
spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
}
@@ -469,11 +459,7 @@
printk("NMI Watchdog detected LOCKUP on CPU%d,
registers:\n", cpu);
show_registers(regs);
printk("console shuts up ...\n");
-#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
- if (dump_function_ptr) {
- dump_function_ptr("NMI Watchdog Detected",
regs);
- }
-#endif
+ dump("NMI Watchdog Detected", regs);
console_silent();
spin_unlock(&nmi_print_lock);
do_exit(SIGSEGV);
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/ia64/config.in ./arch/ia64/config.in
--- /home/vamsi/lkcd_cvs/2.4/arch/ia64/config.in Fri Jul 6 05:13:04 2001
+++ ./arch/ia64/config.in Tue Sep 25 12:18:00 2001
@@ -274,7 +274,7 @@
fi
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
-bool 'Support kernel crash dump capabilities' CONFIG_VMDUMP
+bool 'Support kernel crash dump capabilities' CONFIG_DUMP
bool 'Early printk support (requires VGA!)' CONFIG_IA64_EARLY_PRINTK
bool 'Turn on compare-and-exchange bug checking (slow!)'
CONFIG_IA64_DEBUG_CMPXCHG
bool 'Turn on irq debug checks (slow!)' CONFIG_IA64_DEBUG_IRQ
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/ia64/kernel/smp.c
./arch/ia64/kernel/smp.c
--- /home/vamsi/lkcd_cvs/2.4/arch/ia64/kernel/smp.c Fri Jul 6 05:13:04 2001
+++ ./arch/ia64/kernel/smp.c Tue Sep 25 12:16:56 2001
@@ -287,7 +287,7 @@
int i;
for (i = 0; i < smp_num_cpus; i++) {
-#ifdef CONFIG_VMDUMP
+#ifdef CONFIG_DUMP
/* avoid shutting down CPU 0 for now ... */
if ((!i) && (op == IPI_CPU_STOP)) continue;
#endif
diff -urN /home/vamsi/lkcd_cvs/2.4/arch/ia64/kernel/traps.c
./arch/ia64/kernel/traps.c
--- /home/vamsi/lkcd_cvs/2.4/arch/ia64/kernel/traps.c Fri Jul 6 05:13:04 2001
+++ ./arch/ia64/kernel/traps.c Tue Sep 25 12:17:37 2001
@@ -37,16 +37,12 @@
#include <asm/ia32.h>
#include <asm/processor.h>
#include <asm/uaccess.h>
-#include <linux/vmdump.h>
+#include <linux/dump.h>
#include <asm/fpswa.h>
static fpswa_interface_t *fpswa_interface;
-#ifdef CONFIG_VMDUMP
-extern void (*dump_function_ptr)(char *, struct pt_regs *);
-#endif
-
void __init
trap_init (void)
{
@@ -72,15 +68,7 @@
printk("%s[%d]: %s %ld\n", current->comm, current->pid, str, err);
show_regs(regs);
-#ifdef CONFIG_VMDUMP
- dump_execute((char *)str, regs);
-#else
-#ifdef CONFIG_VMDUMP_MODULE
- if (dump_function_ptr) {
- dump_function_ptr((char *)str, regs);
- }
-#endif
-#endif
+ dump((char *)str, regs);
if (current->thread.flags & IA64_KERNEL_DEATH) {
printk("die_if_kernel recursion detected.\n");
diff -urN /home/vamsi/lkcd_cvs/2.4/drivers/dump/dump_alpha.c
./drivers/dump/dump_alpha.c
--- /home/vamsi/lkcd_cvs/2.4/drivers/dump/dump_alpha.c Mon Sep 24 15:09:01 2001
+++ ./drivers/dump/dump_alpha.c Tue Sep 25 12:18:43 2001
@@ -16,7 +16,7 @@
*/
#include <linux/types.h>
#include <linux/fs.h>
-#include <linux/vmdump.h>
+#include <linux/dump.h>
#include <linux/mm.h>
/* static variables */
diff -urN /home/vamsi/lkcd_cvs/2.4/drivers/dump/dump_base.c
./drivers/dump/dump_base.c
--- /home/vamsi/lkcd_cvs/2.4/drivers/dump/dump_base.c Tue Sep 25 11:35:32 2001
+++ ./drivers/dump/dump_base.c Tue Sep 25 12:20:10 2001
@@ -273,9 +273,6 @@
extern void __dump_save_panic_regs(dump_header_asm_t *);
#endif
-/* dump function pointer used for modules (not yet supported fully) */
-extern void (*dump_function_ptr)(char *, struct pt_regs *);
-
/* external functions */
extern void si_meminfo(struct sysinfo *);
extern void *kmalloc(size_t, int);
diff -urN /home/vamsi/lkcd_cvs/2.4/include/asm-alpha/dump.h
./include/asm-alpha/dump.h
--- /home/vamsi/lkcd_cvs/2.4/include/asm-alpha/dump.h Mon Sep 24 16:23:11 2001
+++ ./include/asm-alpha/dump.h Tue Sep 25 12:16:29 2001
@@ -9,8 +9,8 @@
*/
/* This header file holds the architecture specific crash dump header */
-#ifndef _ASM_VMDUMP_H
-#define _ASM_VMDUMP_H
+#ifndef _ASM_DUMP_H
+#define _ASM_DUMP_H
/* necessary header files */
#include <asm/ptrace.h> /* for pt_regs */
@@ -56,4 +56,4 @@
})
#endif
-#endif /* _ASM_VMDUMP_H */
+#endif /* _ASM_DUMP_H */
diff -urN /home/vamsi/lkcd_cvs/2.4/include/asm-i386/dump.h
./include/asm-i386/dump.h
--- /home/vamsi/lkcd_cvs/2.4/include/asm-i386/dump.h Mon Sep 24 16:23:11 2001
+++ ./include/asm-i386/dump.h Tue Sep 25 12:19:05 2001
@@ -9,8 +9,8 @@
*/
/* This header file holds the architecture specific crash dump header */
-#ifndef _ASM_VMDUMP_H
-#define _ASM_VMDUMP_H
+#ifndef _ASM_DUMP_H
+#define _ASM_DUMP_H
/* necessary header files */
#include <asm/ptrace.h> /* for pt_regs */
@@ -47,4 +47,4 @@
} dump_header_asm_t;
-#endif /* _ASM_VMDUMP_H */
+#endif /* _ASM_DUMP_H */
diff -urN /home/vamsi/lkcd_cvs/2.4/include/asm-ia64/dump.h
./include/asm-ia64/dump.h
--- /home/vamsi/lkcd_cvs/2.4/include/asm-ia64/dump.h Mon Sep 24 16:23:11 2001
+++ ./include/asm-ia64/dump.h Tue Sep 25 12:19:20 2001
@@ -9,8 +9,8 @@
*/
/* This header file holds the architecture specific crash dump header */
-#ifndef _ASM_VMDUMP_H
-#define _ASM_VMDUMP_H
+#ifndef _ASM_DUMP_H
+#define _ASM_DUMP_H
/* necessary header files */
#include <asm/ptrace.h> /* for pt_regs */
@@ -53,4 +53,4 @@
} dump_header_asm_t;
-#endif /* _ASM_VMDUMP_H */
+#endif /* _ASM_DUMP_H */
diff -urN /home/vamsi/lkcd_cvs/2.4/include/linux/dump.h ./include/linux/dump.h
--- /home/vamsi/lkcd_cvs/2.4/include/linux/dump.h Mon Sep 24 14:41:34 2001
+++ ./include/linux/dump.h Tue Sep 25 13:00:13 2001
@@ -224,7 +224,21 @@
extern void dump_execute(char *, struct pt_regs *);
extern volatile int dump_in_progress;
extern volatile int dumping_cpu;
+extern void (*dump_function_ptr)(char *, struct pt_regs *);
+extern int page_is_ram(unsigned long);
+#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
+static inline void dump(char * str, struct pt_regs * regs)
+{
+ if (dump_function_ptr) {
+ dump_function_ptr((char *)str, regs);
+ }
+}
+#else
+static inline void dump(char * str, struct pt_regs * regs)
+{
+}
+#endif /* CONFIG_DUMP */
#endif /* __KERNEL__ */
#endif /* _DUMP_H */
diff -urN /home/vamsi/lkcd_cvs/2.4/kernel/ksyms.c ./kernel/ksyms.c
--- /home/vamsi/lkcd_cvs/2.4/kernel/ksyms.c Mon Sep 24 16:23:11 2001
+++ ./kernel/ksyms.c Tue Sep 25 13:00:20 2001
@@ -66,11 +66,6 @@
extern spinlock_t dma_spin_lock;
extern int panic_timeout;
-#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
-extern void (*dump_function_ptr)(char *, struct pt_regs *);
-extern int page_is_ram(unsigned long);
-#endif
-
#ifdef CONFIG_MODVERSIONS
const struct module_symbol __export_Using_Versions
__attribute__((section("__ksymtab"))) = {
@@ -360,11 +355,11 @@
/* dump (system crash dump) functions and needed parameters */
EXPORT_SYMBOL(get_blkfops);
-EXPORT_SYMBOL(dump_in_progress);
-EXPORT_SYMBOL(dumping_cpu);
#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
EXPORT_SYMBOL(dump_function_ptr);
EXPORT_SYMBOL(page_is_ram);
+EXPORT_SYMBOL(dump_in_progress);
+EXPORT_SYMBOL(dumping_cpu);
#endif
EXPORT_SYMBOL(panic_timeout);
diff -urN /home/vamsi/lkcd_cvs/2.4/kernel/panic.c ./kernel/panic.c
--- /home/vamsi/lkcd_cvs/2.4/kernel/panic.c Mon Sep 24 13:37:30 2001
+++ ./kernel/panic.c Tue Sep 25 12:12:47 2001
@@ -75,11 +75,7 @@
notifier_call_chain(&panic_notifier_list, 0, NULL);
-#if defined(CONFIG_DUMP) || defined(CONFIG_DUMP_MODULE)
- if (dump_function_ptr) {
- dump_function_ptr(buf, (struct pt_regs *)0);
- }
-#endif
+ dump(buf, NULL);
if (panic_timeout > 0)
{
|