0 files changed Index: linux-2.6.0-test6/drivers/Makefile =================================================================== --- linux-2.6.0-test6.orig/drivers/Makefile 2003-09-28 08:50:41.000000000 +0800 +++ linux-2.6.0-test6/drivers/Makefile 2003-10-09 20:57:41.884807280 +0800 @@ -49,3 +49,4 @@ obj-$(CONFIG_MCA) += mca/ obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_CPU_FREQ) += cpufreq/ +obj-$(CONFIG_CRASH_DUMP) += dump/ Index: linux-2.6.0-test6/include/linux/sysctl.h =================================================================== --- linux-2.6.0-test6.orig/include/linux/sysctl.h 2003-10-09 20:52:02.839350024 +0800 +++ linux-2.6.0-test6/include/linux/sysctl.h 2003-10-09 20:57:41.885807128 +0800 @@ -127,6 +127,7 @@ KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */ KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */ KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */ + KERN_DUMP=60, /* directory: dump parameters */ }; Index: linux-2.6.0-test6/include/linux/major.h =================================================================== --- linux-2.6.0-test6.orig/include/linux/major.h 2003-09-28 08:50:13.000000000 +0800 +++ linux-2.6.0-test6/include/linux/major.h 2003-10-09 20:57:41.885807128 +0800 @@ -157,6 +157,8 @@ #define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ +#define CRASH_DUMP_MAJOR 221 /* crash dump interface */ + #define IBM_TTY3270_MAJOR 227 #define IBM_FS3270_MAJOR 228 Index: linux-2.6.0-test6/include/asm-i386/mach-default/irq_vectors.h =================================================================== --- linux-2.6.0-test6.orig/include/asm-i386/mach-default/irq_vectors.h 2003-10-09 20:52:02.764361424 +0800 +++ linux-2.6.0-test6/include/asm-i386/mach-default/irq_vectors.h 2003-10-09 20:57:41.885807128 +0800 @@ -48,6 +48,7 @@ #define INVALIDATE_TLB_VECTOR 0xfd #define RESCHEDULE_VECTOR 0xfc #define CALL_FUNCTION_VECTOR 0xfb +#define DUMP_VECTOR 0xfa #define THERMAL_APIC_VECTOR 0xf0 /* Index: linux-2.6.0-test6/include/asm-i386/kmap_types.h =================================================================== --- linux-2.6.0-test6.orig/include/asm-i386/kmap_types.h 2003-10-09 20:52:02.764361424 +0800 +++ linux-2.6.0-test6/include/asm-i386/kmap_types.h 2003-10-09 20:57:41.886806976 +0800 @@ -33,6 +33,7 @@ * Add new entries in pairs: * the 4G/4G virtual stack must be 8K aligned on each cpu. */ - KM_TYPE_NR + KM_DUMP, + KM_TYPE_NR, }; #endif Index: linux-2.6.0-test6/include/asm-i386/smp.h =================================================================== --- linux-2.6.0-test6.orig/include/asm-i386/smp.h 2003-09-28 08:50:29.000000000 +0800 +++ linux-2.6.0-test6/include/asm-i386/smp.h 2003-10-09 20:57:41.886806976 +0800 @@ -37,6 +37,7 @@ extern int cpu_sibling_map[]; extern void smp_flush_tlb(void); +extern void dump_send_ipi(void); extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); extern void smp_send_reschedule(int cpu); extern void smp_invalidate_rcv(void); /* Process an NMI */ Index: linux-2.6.0-test6/arch/i386/kernel/i386_ksyms.c =================================================================== --- linux-2.6.0-test6.orig/arch/i386/kernel/i386_ksyms.c 2003-10-09 20:56:19.104391816 +0800 +++ linux-2.6.0-test6/arch/i386/kernel/i386_ksyms.c 2003-10-09 20:58:33.601945080 +0800 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -34,6 +35,7 @@ #include #include #include +#include #include extern void dump_thread(struct pt_regs *, struct user *); extern spinlock_t rtc_lock; @@ -220,3 +222,20 @@ #if defined(CONFIG_X86_SPEEDSTEP_SMI) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE) EXPORT_SYMBOL(ist_info); #endif + +#ifdef CONFIG_CRASH_DUMP_MODULE +#ifdef CONFIG_SMP +extern irq_desc_t irq_desc[NR_IRQS]; +extern unsigned long irq_affinity[NR_IRQS]; +extern void stop_this_cpu(void *); +EXPORT_SYMBOL(irq_desc); +EXPORT_SYMBOL(irq_affinity); +EXPORT_SYMBOL(stop_this_cpu); +EXPORT_SYMBOL(dump_send_ipi); +#endif +extern int pfn_is_ram(unsigned long); +EXPORT_SYMBOL(pfn_is_ram); +#ifdef ARCH_HAS_NMI_WATCHDOG +EXPORT_SYMBOL(touch_nmi_watchdog); +#endif +#endif Index: linux-2.6.0-test6/arch/i386/kernel/nmi.c =================================================================== --- linux-2.6.0-test6.orig/arch/i386/kernel/nmi.c 2003-10-09 20:52:02.026473600 +0800 +++ linux-2.6.0-test6/arch/i386/kernel/nmi.c 2003-10-09 20:57:41.887806824 +0800 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -460,6 +461,7 @@ bust_spinlocks(1); printk("NMI Watchdog detected LOCKUP on CPU%d, eip %08lx, registers:\n", cpu, regs->eip); show_registers(regs); + dump("NMI Watchdog detected LOCKUP", regs); printk("console shuts up ...\n"); console_silent(); spin_unlock(&nmi_print_lock); Index: linux-2.6.0-test6/arch/i386/kernel/setup.c =================================================================== --- linux-2.6.0-test6.orig/arch/i386/kernel/setup.c 2003-10-09 20:52:02.028473296 +0800 +++ linux-2.6.0-test6/arch/i386/kernel/setup.c 2003-10-09 20:57:41.888806672 +0800 @@ -471,6 +471,7 @@ print_memory_map(who); } /* setup_memory_region */ +unsigned long crashdump_addr = 0xdeadbeef; static void __init parse_cmdline_early (char ** cmdline_p) { @@ -588,6 +589,9 @@ if (c == ' ' && !memcmp(from, "highmem=", 8)) highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; + if (c == ' ' && !memcmp(from, "crashdump=", 10)) + crashdump_addr = memparse(from+10, &from); + c = *(from++); if (!c) break; @@ -1030,6 +1034,8 @@ __setup("noreplacement", noreplacement_setup); +extern void crashdump_reserve(void); + /* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures Index: linux-2.6.0-test6/arch/i386/kernel/smp.c =================================================================== --- linux-2.6.0-test6.orig/arch/i386/kernel/smp.c 2003-10-09 20:52:02.031472840 +0800 +++ linux-2.6.0-test6/arch/i386/kernel/smp.c 2003-10-09 20:57:41.889806520 +0800 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -144,6 +145,13 @@ */ cfg = __prepare_ICR(shortcut, vector); + if (vector == DUMP_VECTOR) { + /* + * Setup DUMP IPI to be delivered as an NMI + */ + cfg = (cfg&~APIC_VECTOR_MASK)|APIC_DM_NMI; + } + /* * Send the IPI. The write to APIC_ICR fires this off. */ @@ -477,6 +485,11 @@ send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); } +void dump_send_ipi(void) +{ + send_IPI_allbutself(DUMP_VECTOR); +} + /* * Structure and data for smp_call_function(). This is designed to minimise * static memory requirements. It also looks cleaner. @@ -545,7 +558,7 @@ return 0; } -static void stop_this_cpu (void * dummy) +void stop_this_cpu (void * dummy) { /* * Remove this CPU: @@ -606,4 +619,3 @@ atomic_inc(&call_data->finished); } } - Index: linux-2.6.0-test6/arch/i386/kernel/traps.c =================================================================== --- linux-2.6.0-test6.orig/arch/i386/kernel/traps.c 2003-10-09 20:52:02.033472536 +0800 +++ linux-2.6.0-test6/arch/i386/kernel/traps.c 2003-10-09 20:57:41.889806520 +0800 @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef CONFIG_EISA #include @@ -322,6 +323,7 @@ #endif CHK_REMOTE_DEBUG(0,SIGTRAP,err,regs,) show_registers(regs); + dump((char *)str, regs); bust_spinlocks(0); spin_unlock_irq(&die_lock); if (in_interrupt()) Index: linux-2.6.0-test6/arch/i386/mm/init.c =================================================================== --- linux-2.6.0-test6.orig/arch/i386/mm/init.c 2003-10-09 20:52:02.041471320 +0800 +++ linux-2.6.0-test6/arch/i386/mm/init.c 2003-10-09 20:57:41.890806368 +0800 @@ -115,6 +115,12 @@ SetPageReserved(page); } +/* To enable modules to check if a page is in RAM */ +int pfn_is_ram(unsigned long pfn) +{ + return (page_is_ram(pfn)); +} + #ifdef CONFIG_HIGHMEM #ifndef CONFIG_DISCONTIGMEM Index: linux-2.6.0-test6/arch/i386/boot/Makefile =================================================================== --- linux-2.6.0-test6.orig/arch/i386/boot/Makefile 2003-09-28 08:50:16.000000000 +0800 +++ linux-2.6.0-test6/arch/i386/boot/Makefile 2003-10-09 20:57:41.890806368 +0800 @@ -100,3 +100,4 @@ install: $(BOOTIMAGE) sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" + if [ -f init/kerntypes.o ]; then cp init/kerntypes.o $(INSTALL_PATH)/Kerntypes; fi Index: linux-2.6.0-test6/arch/i386/Kconfig =================================================================== --- linux-2.6.0-test6.orig/arch/i386/Kconfig 2003-10-09 20:52:01.999477704 +0800 +++ linux-2.6.0-test6/arch/i386/Kconfig 2003-10-09 20:57:41.891806216 +0800 @@ -1239,6 +1239,56 @@ menu "Kernel hacking" +config CRASH_DUMP + tristate "Crash dump support (EXPERIMENTAL)" + depends on EXPERIMENTAL + default n + ---help--- + Say Y here to enable saving an image of system memory when a panic + or other error occurs. Dumps can also be forced with the SysRq+d + key if MAGIC_SYSRQ is enabled. + +config CRASH_DUMP_BLOCKDEV + tristate "Crash dump block device driver" + depends on CRASH_DUMP + help + Say Y to allow saving crash dumps directly to a disk device. + +config CRASH_DUMP_NETDEV + tristate "Crash dump network device driver" + depends on CRASH_DUMP + help + Say Y to allow saving crash dumps over a network device. + +config CRASH_DUMP_MEMDEV + bool "Crash dump staged memory driver" + depends on CRASH_DUMP + help + Say Y to allow intermediate saving crash dumps in spare + memory pages which would then be written out to disk + later. + +config CRASH_DUMP_SOFTBOOT + bool "Save crash dump across a soft reboot" + depends on CRASH_DUMP_MEMDEV + help + Say Y to allow a crash dump to be preserved in memory + pages across a soft reboot and written out to disk + thereafter. For this to work, CRASH_DUMP must be + configured as part of the kernel (not as a module). + +config CRASH_DUMP_COMPRESS_RLE + tristate "Crash dump RLE compression" + depends on CRASH_DUMP + help + Say Y to allow saving dumps with Run Length Encoding compression. + +config CRASH_DUMP_COMPRESS_GZIP + tristate "Crash dump GZIP compression" + depends on CRASH_DUMP + help + Say Y to allow saving dumps with Gnu Zip compression. + config DEBUG_KERNEL bool "Kernel debugging" help Index: linux-2.6.0-test6/arch/s390/boot/Makefile =================================================================== --- linux-2.6.0-test6.orig/arch/s390/boot/Makefile 2003-09-28 08:51:21.000000000 +0800 +++ linux-2.6.0-test6/arch/s390/boot/Makefile 2003-10-09 20:57:41.892806064 +0800 @@ -15,4 +15,4 @@ install: $(CONFIGURE) $(obj)/image sh -x $(obj)/install.sh $(KERNELRELEASE) $(obj)/image \ - System.map Kerntypes "$(INSTALL_PATH)" + System.map init/kerntypes.o "$(INSTALL_PATH)" Index: linux-2.6.0-test6/arch/s390/boot/install.sh =================================================================== --- linux-2.6.0-test6.orig/arch/s390/boot/install.sh 2003-09-28 08:50:30.000000000 +0800 +++ linux-2.6.0-test6/arch/s390/boot/install.sh 2003-10-09 20:57:41.892806064 +0800 @@ -16,7 +16,8 @@ # $1 - kernel version # $2 - kernel image file # $3 - kernel map file -# $4 - default install path (blank if root directory) +# $4 - kernel type file +# $5 - default install path (blank if root directory) # # User may have a custom install script @@ -26,13 +27,22 @@ # Default install - same as make zlilo -if [ -f $4/vmlinuz ]; then - mv $4/vmlinuz $4/vmlinuz.old +if [ -f $5/vmlinuz ]; then + mv $5/vmlinuz $5/vmlinuz.old fi -if [ -f $4/System.map ]; then - mv $4/System.map $4/System.old +if [ -f $5/System.map ]; then + mv $5/System.map $5/System.old fi -cat $2 > $4/vmlinuz -cp $3 $4/System.map +if [ -f $5/Kerntypes ]; then + mv $5/Kerntypes $5/Kerntypes.old +fi + +cat $2 > $5/vmlinuz +cp $3 $5/System.map + +# copy the kernel type file if it exists +if [ -f $4 ]; then + cp $4 $5/Kerntypes +fi Index: linux-2.6.0-test6/scripts/mkcompile_h =================================================================== --- linux-2.6.0-test6.orig/scripts/mkcompile_h 2003-09-28 08:51:28.000000000 +0800 +++ linux-2.6.0-test6/scripts/mkcompile_h 2003-10-09 20:57:41.892806064 +0800 @@ -33,7 +33,7 @@ UTS_LEN=64 UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" - +LINUX_COMPILE_VERSION_ID="__linux_compile_version_id__`hostname | tr -c '[0-9A-Za-z\n]' '__'`_`LANG=C date | tr -c '[0-9A-Za-z\n]' '_'`" # Generate a temporary compile.h ( echo /\* This file is auto generated, version $VERSION \*/ @@ -55,6 +55,8 @@ fi echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" + echo \#define LINUX_COMPILE_VERSION_ID $LINUX_COMPILE_VERSION_ID + echo \#define LINUX_COMPILE_VERSION_ID_TYPE typedef char* "$LINUX_COMPILE_VERSION_ID""_t" ) > .tmpcompile # Only replace the real compile.h if the new one is different, Index: linux-2.6.0-test6/kernel/ksyms.c =================================================================== --- linux-2.6.0-test6.orig/kernel/ksyms.c 2003-10-09 20:52:02.855347592 +0800 +++ linux-2.6.0-test6/kernel/ksyms.c 2003-10-09 20:57:41.893805912 +0800 @@ -58,6 +58,8 @@ #include #include #include +#include +#include #if defined(CONFIG_PROC_FS) #include @@ -378,3 +380,9 @@ EXPORT_SYMBOL(console_printk); EXPORT_SYMBOL(current_kernel_time); + +#ifdef CONFIG_CRASH_DUMP_MODULE +EXPORT_SYMBOL(min_low_pfn); +EXPORT_SYMBOL(dump_oncpu); +EXPORT_SYMBOL(dump_function_ptr); +#endif Index: linux-2.6.0-test6/kernel/panic.c =================================================================== --- linux-2.6.0-test6.orig/kernel/panic.c 2003-09-28 08:51:05.000000000 +0800 +++ linux-2.6.0-test6/kernel/panic.c 2003-10-09 20:57:41.893805912 +0800 @@ -18,11 +18,16 @@ #include #include +#ifdef CONFIG_KEXEC +#include +#endif + asmlinkage void sys_sync(void); /* it's really int */ int panic_timeout; int panic_on_oops; int tainted; +void (*dump_function_ptr)(const char *, const struct pt_regs *) = 0; struct notifier_block *panic_notifier_list; @@ -55,6 +60,7 @@ va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); + printk(KERN_EMERG "Kernel panic: %s\n",buf); if (in_interrupt()) printk(KERN_EMERG "In interrupt handler - not syncing\n"); @@ -78,6 +84,19 @@ * We can't use the "normal" timers since we just panicked.. */ printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout); +#ifdef CONFIG_KEXEC + { + struct kimage *image; + image = xchg(&kexec_image, 0); + if (image) { + printk(KERN_EMERG "by starting a new kernel ..\n"); + mdelay(panic_timeout*1000); + machine_kexec(image); + } + } +#endif + + for (i = 0; i < panic_timeout; i++) { touch_nmi_watchdog(); mdelay(1000); Index: linux-2.6.0-test6/kernel/sched.c =================================================================== --- linux-2.6.0-test6.orig/kernel/sched.c 2003-10-09 20:52:02.864346224 +0800 +++ linux-2.6.0-test6/kernel/sched.c 2003-10-09 20:57:41.895805608 +0800 @@ -44,6 +44,9 @@ #define cpu_to_node_mask(cpu) (cpu_online_map) #endif +/* used to soft spin in sched while dump is in progress */ +int dump_oncpu; + /* * Convert user-nice values [ -20 ... 0 ... 19 ] * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], @@ -1463,6 +1466,15 @@ unsigned long run_time; int idx; + /* + * If crash dump is in progress, this other cpu's + * need to wait until it completes. + * NB: this code is optimized away for kernels without + * dumping enabled. + */ + if (unlikely(dump_oncpu)) + goto dump_scheduling_disabled; + /* * Test if we are atomic. Since do_exit() needs to call into * schedule() atomically, we ignore that path for now. @@ -1586,6 +1598,16 @@ preempt_enable_no_resched(); if (test_thread_flag(TIF_NEED_RESCHED)) goto need_resched; + + return; + + dump_scheduling_disabled: + /* allow scheduling only if this is the dumping cpu */ + if (dump_oncpu != smp_processor_id()+1) { + while (dump_oncpu) + cpu_relax(); + } + return; } EXPORT_SYMBOL(schedule); Index: linux-2.6.0-test6/lib/Kconfig =================================================================== --- linux-2.6.0-test6.orig/lib/Kconfig 2003-09-28 08:50:29.000000000 +0800 +++ linux-2.6.0-test6/lib/Kconfig 2003-10-09 20:57:41.895805608 +0800 @@ -16,10 +16,17 @@ # compression support is select'ed if needed # config ZLIB_INFLATE - tristate + tristate + default y if CRAMFS=y || PPP_DEFLATE=y || JFFS2_FS=y || ZISOFS_FS=y || BINFMT_ZFLAT=y || CRYPTO_DEFLATE=y || CRASH_DUMP_COMPRESS_GZIP=y + default m if CRAMFS=m || PPP_DEFLATE=m || JFFS2_FS=m || ZISOFS_FS=m || BINFMT_ZFLAT=m || CRYPTO_DEFLATE=m || CRASH_DUMP_COMPRESS_GZIP=m config ZLIB_DEFLATE tristate - + default m if PPP_DEFLATE!=y && JFFS2_FS!=y && CRYPTO_DEFLATE!=y && \ + (PPP_DEFLATE=m || JFFS2_FS=m || CRYPTO_DEFLATE=m \ + || CRASH_DUMP_COMPRESS_GZIP=m ) + default y if PPP_DEFLATE=y || JFFS2_FS=y || CRYPTO_DEFLATE=y \ + || CRASH_DUMP_COMPRESS_GZIP=y + endmenu Index: linux-2.6.0-test6/mm/page_alloc.c =================================================================== --- linux-2.6.0-test6.orig/mm/page_alloc.c 2003-10-09 20:52:02.881343640 +0800 +++ linux-2.6.0-test6/mm/page_alloc.c 2003-10-09 20:57:41.897805304 +0800 @@ -89,7 +89,8 @@ page->mapping = NULL; } -#ifndef CONFIG_HUGETLB_PAGE +#if !defined(CONFIG_HUGETLB_PAGE) && !defined(CONFIG_CRASH_DUMP) \ + && !defined(CONFIG_CRASH_DUMP_MODULE) #define prep_compound_page(page, order) do { } while (0) #define destroy_compound_page(page, order) do { } while (0) #else Index: linux-2.6.0-test6/init/Makefile =================================================================== --- linux-2.6.0-test6.orig/init/Makefile 2003-09-28 08:50:17.000000000 +0800 +++ linux-2.6.0-test6/init/Makefile 2003-10-09 20:57:41.897805304 +0800 @@ -9,6 +9,9 @@ mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o +extra-$(CONFIG_CRASH_DUMP) += kerntypes.o +CFLAGS_kerntypes.o := -gstabs + # files to be removed upon make clean clean-files := ../include/linux/compile.h @@ -24,3 +27,4 @@ include/linux/compile.h: FORCE @echo ' CHK $@' @sh $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)" + Index: linux-2.6.0-test6/init/main.c =================================================================== --- linux-2.6.0-test6.orig/init/main.c 2003-10-09 20:52:02.850348352 +0800 +++ linux-2.6.0-test6/init/main.c 2003-10-09 20:57:41.897805304 +0800 @@ -97,6 +97,16 @@ int system_running = 0; /* + * The kernel_magic value represents the address of _end, which allows + * namelist tools to "match" each other respectively. That way a tool + * that looks at /dev/mem can verify that it is using the right System.map + * file -- if kernel_magic doesn't equal the namelist value of _end, + * something's wrong. + */ +extern unsigned long _end; +unsigned long *kernel_magic = &_end; + +/* * Boot command-line arguments */ #define MAX_INIT_ARGS 8 Index: linux-2.6.0-test6/init/version.c =================================================================== --- linux-2.6.0-test6.orig/init/version.c 2003-09-28 08:50:20.000000000 +0800 +++ linux-2.6.0-test6/init/version.c 2003-10-09 20:57:41.898805152 +0800 @@ -10,6 +10,7 @@ #include #include #include +#include #define version(a) Version_ ## a #define version_string(a) version(a) @@ -28,3 +29,6 @@ const char *linux_banner = "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; + +const char *LINUX_COMPILE_VERSION_ID = __stringify(LINUX_COMPILE_VERSION_ID); +LINUX_COMPILE_VERSION_ID_TYPE;