3 Index: linux-2.6.0-test6/drivers/Makefile
4 ===================================================================
5 --- linux-2.6.0-test6.orig/drivers/Makefile 2003-09-28 08:50:41.000000000 +0800
6 +++ linux-2.6.0-test6/drivers/Makefile 2003-10-09 20:57:41.884807280 +0800
8 obj-$(CONFIG_MCA) += mca/
9 obj-$(CONFIG_EISA) += eisa/
10 obj-$(CONFIG_CPU_FREQ) += cpufreq/
11 +obj-$(CONFIG_CRASH_DUMP) += dump/
12 Index: linux-2.6.0-test6/include/linux/sysctl.h
13 ===================================================================
14 --- linux-2.6.0-test6.orig/include/linux/sysctl.h 2003-10-09 20:52:02.839350024 +0800
15 +++ linux-2.6.0-test6/include/linux/sysctl.h 2003-10-09 20:57:41.885807128 +0800
17 KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */
18 KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */
19 KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */
20 + KERN_DUMP=60, /* directory: dump parameters */
24 Index: linux-2.6.0-test6/include/linux/major.h
25 ===================================================================
26 --- linux-2.6.0-test6.orig/include/linux/major.h 2003-09-28 08:50:13.000000000 +0800
27 +++ linux-2.6.0-test6/include/linux/major.h 2003-10-09 20:57:41.885807128 +0800
30 #define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */
32 +#define CRASH_DUMP_MAJOR 221 /* crash dump interface */
34 #define IBM_TTY3270_MAJOR 227
35 #define IBM_FS3270_MAJOR 228
37 Index: linux-2.6.0-test6/include/asm-i386/mach-default/irq_vectors.h
38 ===================================================================
39 --- linux-2.6.0-test6.orig/include/asm-i386/mach-default/irq_vectors.h 2003-10-09 20:52:02.764361424 +0800
40 +++ linux-2.6.0-test6/include/asm-i386/mach-default/irq_vectors.h 2003-10-09 20:57:41.885807128 +0800
42 #define INVALIDATE_TLB_VECTOR 0xfd
43 #define RESCHEDULE_VECTOR 0xfc
44 #define CALL_FUNCTION_VECTOR 0xfb
45 +#define DUMP_VECTOR 0xfa
47 #define THERMAL_APIC_VECTOR 0xf0
49 Index: linux-2.6.0-test6/include/asm-i386/kmap_types.h
50 ===================================================================
51 --- linux-2.6.0-test6.orig/include/asm-i386/kmap_types.h 2003-10-09 20:52:02.764361424 +0800
52 +++ linux-2.6.0-test6/include/asm-i386/kmap_types.h 2003-10-09 20:57:41.886806976 +0800
54 * Add new entries in pairs:
55 * the 4G/4G virtual stack must be 8K aligned on each cpu.
62 Index: linux-2.6.0-test6/include/asm-i386/smp.h
63 ===================================================================
64 --- linux-2.6.0-test6.orig/include/asm-i386/smp.h 2003-09-28 08:50:29.000000000 +0800
65 +++ linux-2.6.0-test6/include/asm-i386/smp.h 2003-10-09 20:57:41.886806976 +0800
67 extern int cpu_sibling_map[];
69 extern void smp_flush_tlb(void);
70 +extern void dump_send_ipi(void);
71 extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
72 extern void smp_send_reschedule(int cpu);
73 extern void smp_invalidate_rcv(void); /* Process an NMI */
74 Index: linux-2.6.0-test6/arch/i386/kernel/i386_ksyms.c
75 ===================================================================
76 --- linux-2.6.0-test6.orig/arch/i386/kernel/i386_ksyms.c 2003-10-09 20:56:19.104391816 +0800
77 +++ linux-2.6.0-test6/arch/i386/kernel/i386_ksyms.c 2003-10-09 20:58:33.601945080 +0800
79 #include <linux/tty.h>
80 #include <linux/highmem.h>
81 #include <linux/time.h>
82 +#include <linux/nmi.h>
84 #include <asm/semaphore.h>
85 #include <asm/processor.h>
90 +#include <asm/e820.h>
91 #include <asm/netconsole.h>
92 extern void dump_thread(struct pt_regs *, struct user *);
93 extern spinlock_t rtc_lock;
95 #if defined(CONFIG_X86_SPEEDSTEP_SMI) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
96 EXPORT_SYMBOL(ist_info);
99 +#ifdef CONFIG_CRASH_DUMP_MODULE
101 +extern irq_desc_t irq_desc[NR_IRQS];
102 +extern unsigned long irq_affinity[NR_IRQS];
103 +extern void stop_this_cpu(void *);
104 +EXPORT_SYMBOL(irq_desc);
105 +EXPORT_SYMBOL(irq_affinity);
106 +EXPORT_SYMBOL(stop_this_cpu);
107 +EXPORT_SYMBOL(dump_send_ipi);
109 +extern int pfn_is_ram(unsigned long);
110 +EXPORT_SYMBOL(pfn_is_ram);
111 +#ifdef ARCH_HAS_NMI_WATCHDOG
112 +EXPORT_SYMBOL(touch_nmi_watchdog);
115 Index: linux-2.6.0-test6/arch/i386/kernel/nmi.c
116 ===================================================================
117 --- linux-2.6.0-test6.orig/arch/i386/kernel/nmi.c 2003-10-09 20:52:02.026473600 +0800
118 +++ linux-2.6.0-test6/arch/i386/kernel/nmi.c 2003-10-09 20:57:41.887806824 +0800
120 #include <linux/kernel_stat.h>
121 #include <linux/module.h>
122 #include <linux/nmi.h>
123 +#include <linux/dump.h>
124 #include <linux/sysdev.h>
129 printk("NMI Watchdog detected LOCKUP on CPU%d, eip %08lx, registers:\n", cpu, regs->eip);
130 show_registers(regs);
131 + dump("NMI Watchdog detected LOCKUP", regs);
132 printk("console shuts up ...\n");
134 spin_unlock(&nmi_print_lock);
135 Index: linux-2.6.0-test6/arch/i386/kernel/setup.c
136 ===================================================================
137 --- linux-2.6.0-test6.orig/arch/i386/kernel/setup.c 2003-10-09 20:52:02.028473296 +0800
138 +++ linux-2.6.0-test6/arch/i386/kernel/setup.c 2003-10-09 20:57:41.888806672 +0800
140 print_memory_map(who);
141 } /* setup_memory_region */
143 +unsigned long crashdump_addr = 0xdeadbeef;
145 static void __init parse_cmdline_early (char ** cmdline_p)
148 if (c == ' ' && !memcmp(from, "highmem=", 8))
149 highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT;
151 + if (c == ' ' && !memcmp(from, "crashdump=", 10))
152 + crashdump_addr = memparse(from+10, &from);
157 @@ -1030,6 +1034,8 @@
159 __setup("noreplacement", noreplacement_setup);
161 +extern void crashdump_reserve(void);
164 * Determine if we were loaded by an EFI loader. If so, then we have also been
165 * passed the efi memmap, systab, etc., so we should use these data structures
166 Index: linux-2.6.0-test6/arch/i386/kernel/smp.c
167 ===================================================================
168 --- linux-2.6.0-test6.orig/arch/i386/kernel/smp.c 2003-10-09 20:52:02.031472840 +0800
169 +++ linux-2.6.0-test6/arch/i386/kernel/smp.c 2003-10-09 20:57:41.889806520 +0800
171 #include <linux/mc146818rtc.h>
172 #include <linux/cache.h>
173 #include <linux/interrupt.h>
174 +#include <linux/dump.h>
176 #include <asm/mtrr.h>
177 #include <asm/pgalloc.h>
180 cfg = __prepare_ICR(shortcut, vector);
182 + if (vector == DUMP_VECTOR) {
184 + * Setup DUMP IPI to be delivered as an NMI
186 + cfg = (cfg&~APIC_VECTOR_MASK)|APIC_DM_NMI;
190 * Send the IPI. The write to APIC_ICR fires this off.
193 send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR);
196 +void dump_send_ipi(void)
198 + send_IPI_allbutself(DUMP_VECTOR);
202 * Structure and data for smp_call_function(). This is designed to minimise
203 * static memory requirements. It also looks cleaner.
208 -static void stop_this_cpu (void * dummy)
209 +void stop_this_cpu (void * dummy)
214 atomic_inc(&call_data->finished);
218 Index: linux-2.6.0-test6/arch/i386/kernel/traps.c
219 ===================================================================
220 --- linux-2.6.0-test6.orig/arch/i386/kernel/traps.c 2003-10-09 20:52:02.033472536 +0800
221 +++ linux-2.6.0-test6/arch/i386/kernel/traps.c 2003-10-09 20:57:41.889806520 +0800
223 #include <linux/highmem.h>
224 #include <linux/kallsyms.h>
225 #include <linux/ptrace.h>
226 +#include <linux/dump.h>
229 #include <linux/ioport.h>
232 CHK_REMOTE_DEBUG(0,SIGTRAP,err,regs,)
233 show_registers(regs);
234 + dump((char *)str, regs);
236 spin_unlock_irq(&die_lock);
238 Index: linux-2.6.0-test6/arch/i386/mm/init.c
239 ===================================================================
240 --- linux-2.6.0-test6.orig/arch/i386/mm/init.c 2003-10-09 20:52:02.041471320 +0800
241 +++ linux-2.6.0-test6/arch/i386/mm/init.c 2003-10-09 20:57:41.890806368 +0800
243 SetPageReserved(page);
246 +/* To enable modules to check if a page is in RAM */
247 +int pfn_is_ram(unsigned long pfn)
249 + return (page_is_ram(pfn));
252 #ifdef CONFIG_HIGHMEM
254 #ifndef CONFIG_DISCONTIGMEM
255 Index: linux-2.6.0-test6/arch/i386/boot/Makefile
256 ===================================================================
257 --- linux-2.6.0-test6.orig/arch/i386/boot/Makefile 2003-09-28 08:50:16.000000000 +0800
258 +++ linux-2.6.0-test6/arch/i386/boot/Makefile 2003-10-09 20:57:41.890806368 +0800
261 install: $(BOOTIMAGE)
262 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
263 + if [ -f init/kerntypes.o ]; then cp init/kerntypes.o $(INSTALL_PATH)/Kerntypes; fi
264 Index: linux-2.6.0-test6/arch/i386/Kconfig
265 ===================================================================
266 --- linux-2.6.0-test6.orig/arch/i386/Kconfig 2003-10-09 20:52:01.999477704 +0800
267 +++ linux-2.6.0-test6/arch/i386/Kconfig 2003-10-09 20:57:41.891806216 +0800
268 @@ -1239,6 +1239,56 @@
270 menu "Kernel hacking"
273 + tristate "Crash dump support (EXPERIMENTAL)"
274 + depends on EXPERIMENTAL
277 + Say Y here to enable saving an image of system memory when a panic
278 + or other error occurs. Dumps can also be forced with the SysRq+d
279 + key if MAGIC_SYSRQ is enabled.
281 +config CRASH_DUMP_BLOCKDEV
282 + tristate "Crash dump block device driver"
283 + depends on CRASH_DUMP
285 + Say Y to allow saving crash dumps directly to a disk device.
287 +config CRASH_DUMP_NETDEV
288 + tristate "Crash dump network device driver"
289 + depends on CRASH_DUMP
291 + Say Y to allow saving crash dumps over a network device.
293 +config CRASH_DUMP_MEMDEV
294 + bool "Crash dump staged memory driver"
295 + depends on CRASH_DUMP
297 + Say Y to allow intermediate saving crash dumps in spare
298 + memory pages which would then be written out to disk
301 +config CRASH_DUMP_SOFTBOOT
302 + bool "Save crash dump across a soft reboot"
303 + depends on CRASH_DUMP_MEMDEV
305 + Say Y to allow a crash dump to be preserved in memory
306 + pages across a soft reboot and written out to disk
307 + thereafter. For this to work, CRASH_DUMP must be
308 + configured as part of the kernel (not as a module).
310 +config CRASH_DUMP_COMPRESS_RLE
311 + tristate "Crash dump RLE compression"
312 + depends on CRASH_DUMP
314 + Say Y to allow saving dumps with Run Length Encoding compression.
316 +config CRASH_DUMP_COMPRESS_GZIP
317 + tristate "Crash dump GZIP compression"
318 + depends on CRASH_DUMP
320 + Say Y to allow saving dumps with Gnu Zip compression.
323 bool "Kernel debugging"
325 Index: linux-2.6.0-test6/arch/s390/boot/Makefile
326 ===================================================================
327 --- linux-2.6.0-test6.orig/arch/s390/boot/Makefile 2003-09-28 08:51:21.000000000 +0800
328 +++ linux-2.6.0-test6/arch/s390/boot/Makefile 2003-10-09 20:57:41.892806064 +0800
331 install: $(CONFIGURE) $(obj)/image
332 sh -x $(obj)/install.sh $(KERNELRELEASE) $(obj)/image \
333 - System.map Kerntypes "$(INSTALL_PATH)"
334 + System.map init/kerntypes.o "$(INSTALL_PATH)"
335 Index: linux-2.6.0-test6/arch/s390/boot/install.sh
336 ===================================================================
337 --- linux-2.6.0-test6.orig/arch/s390/boot/install.sh 2003-09-28 08:50:30.000000000 +0800
338 +++ linux-2.6.0-test6/arch/s390/boot/install.sh 2003-10-09 20:57:41.892806064 +0800
340 # $1 - kernel version
341 # $2 - kernel image file
342 # $3 - kernel map file
343 -# $4 - default install path (blank if root directory)
344 +# $4 - kernel type file
345 +# $5 - default install path (blank if root directory)
348 # User may have a custom install script
351 # Default install - same as make zlilo
353 -if [ -f $4/vmlinuz ]; then
354 - mv $4/vmlinuz $4/vmlinuz.old
355 +if [ -f $5/vmlinuz ]; then
356 + mv $5/vmlinuz $5/vmlinuz.old
359 -if [ -f $4/System.map ]; then
360 - mv $4/System.map $4/System.old
361 +if [ -f $5/System.map ]; then
362 + mv $5/System.map $5/System.old
367 +if [ -f $5/Kerntypes ]; then
368 + mv $5/Kerntypes $5/Kerntypes.old
374 +# copy the kernel type file if it exists
378 Index: linux-2.6.0-test6/scripts/mkcompile_h
379 ===================================================================
380 --- linux-2.6.0-test6.orig/scripts/mkcompile_h 2003-09-28 08:51:28.000000000 +0800
381 +++ linux-2.6.0-test6/scripts/mkcompile_h 2003-10-09 20:57:41.892806064 +0800
385 UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
387 +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]' '_'`"
388 # Generate a temporary compile.h
390 ( echo /\* This file is auto generated, version $VERSION \*/
394 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
395 + echo \#define LINUX_COMPILE_VERSION_ID $LINUX_COMPILE_VERSION_ID
396 + echo \#define LINUX_COMPILE_VERSION_ID_TYPE typedef char* "$LINUX_COMPILE_VERSION_ID""_t"
399 # Only replace the real compile.h if the new one is different,
400 Index: linux-2.6.0-test6/kernel/ksyms.c
401 ===================================================================
402 --- linux-2.6.0-test6.orig/kernel/ksyms.c 2003-10-09 20:52:02.855347592 +0800
403 +++ linux-2.6.0-test6/kernel/ksyms.c 2003-10-09 20:57:41.893805912 +0800
405 #include <linux/backing-dev.h>
406 #include <linux/percpu_counter.h>
407 #include <asm/checksum.h>
408 +#include <linux/dump.h>
409 +#include <linux/bootmem.h>
411 #if defined(CONFIG_PROC_FS)
412 #include <linux/proc_fs.h>
414 EXPORT_SYMBOL(console_printk);
416 EXPORT_SYMBOL(current_kernel_time);
418 +#ifdef CONFIG_CRASH_DUMP_MODULE
419 +EXPORT_SYMBOL(min_low_pfn);
420 +EXPORT_SYMBOL(dump_oncpu);
421 +EXPORT_SYMBOL(dump_function_ptr);
423 Index: linux-2.6.0-test6/kernel/panic.c
424 ===================================================================
425 --- linux-2.6.0-test6.orig/kernel/panic.c 2003-09-28 08:51:05.000000000 +0800
426 +++ linux-2.6.0-test6/kernel/panic.c 2003-10-09 20:57:41.893805912 +0800
428 #include <linux/interrupt.h>
429 #include <linux/nmi.h>
432 +#include <linux/kexec.h>
435 asmlinkage void sys_sync(void); /* it's really int */
440 +void (*dump_function_ptr)(const char *, const struct pt_regs *) = 0;
442 struct notifier_block *panic_notifier_list;
446 vsnprintf(buf, sizeof(buf), fmt, args);
449 printk(KERN_EMERG "Kernel panic: %s\n",buf);
451 printk(KERN_EMERG "In interrupt handler - not syncing\n");
453 * We can't use the "normal" timers since we just panicked..
455 printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout);
458 + struct kimage *image;
459 + image = xchg(&kexec_image, 0);
461 + printk(KERN_EMERG "by starting a new kernel ..\n");
462 + mdelay(panic_timeout*1000);
463 + machine_kexec(image);
469 for (i = 0; i < panic_timeout; i++) {
470 touch_nmi_watchdog();
472 Index: linux-2.6.0-test6/kernel/sched.c
473 ===================================================================
474 --- linux-2.6.0-test6.orig/kernel/sched.c 2003-10-09 20:52:02.864346224 +0800
475 +++ linux-2.6.0-test6/kernel/sched.c 2003-10-09 20:57:41.895805608 +0800
477 #define cpu_to_node_mask(cpu) (cpu_online_map)
480 +/* used to soft spin in sched while dump is in progress */
484 * Convert user-nice values [ -20 ... 0 ... 19 ]
485 * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
486 @@ -1463,6 +1466,15 @@
487 unsigned long run_time;
491 + * If crash dump is in progress, this other cpu's
492 + * need to wait until it completes.
493 + * NB: this code is optimized away for kernels without
496 + if (unlikely(dump_oncpu))
497 + goto dump_scheduling_disabled;
500 * Test if we are atomic. Since do_exit() needs to call into
501 * schedule() atomically, we ignore that path for now.
502 @@ -1586,6 +1598,16 @@
503 preempt_enable_no_resched();
504 if (test_thread_flag(TIF_NEED_RESCHED))
509 + dump_scheduling_disabled:
510 + /* allow scheduling only if this is the dumping cpu */
511 + if (dump_oncpu != smp_processor_id()+1) {
518 EXPORT_SYMBOL(schedule);
519 Index: linux-2.6.0-test6/lib/Kconfig
520 ===================================================================
521 --- linux-2.6.0-test6.orig/lib/Kconfig 2003-09-28 08:50:29.000000000 +0800
522 +++ linux-2.6.0-test6/lib/Kconfig 2003-10-09 20:57:41.895805608 +0800
524 # compression support is select'ed if needed
529 + 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
530 + 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
535 + default m if PPP_DEFLATE!=y && JFFS2_FS!=y && CRYPTO_DEFLATE!=y && \
536 + (PPP_DEFLATE=m || JFFS2_FS=m || CRYPTO_DEFLATE=m \
537 + || CRASH_DUMP_COMPRESS_GZIP=m )
538 + default y if PPP_DEFLATE=y || JFFS2_FS=y || CRYPTO_DEFLATE=y \
539 + || CRASH_DUMP_COMPRESS_GZIP=y
543 Index: linux-2.6.0-test6/mm/page_alloc.c
544 ===================================================================
545 --- linux-2.6.0-test6.orig/mm/page_alloc.c 2003-10-09 20:52:02.881343640 +0800
546 +++ linux-2.6.0-test6/mm/page_alloc.c 2003-10-09 20:57:41.897805304 +0800
548 page->mapping = NULL;
551 -#ifndef CONFIG_HUGETLB_PAGE
552 +#if !defined(CONFIG_HUGETLB_PAGE) && !defined(CONFIG_CRASH_DUMP) \
553 + && !defined(CONFIG_CRASH_DUMP_MODULE)
554 #define prep_compound_page(page, order) do { } while (0)
555 #define destroy_compound_page(page, order) do { } while (0)
557 Index: linux-2.6.0-test6/init/Makefile
558 ===================================================================
559 --- linux-2.6.0-test6.orig/init/Makefile 2003-09-28 08:50:17.000000000 +0800
560 +++ linux-2.6.0-test6/init/Makefile 2003-10-09 20:57:41.897805304 +0800
562 mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
563 mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o
565 +extra-$(CONFIG_CRASH_DUMP) += kerntypes.o
566 +CFLAGS_kerntypes.o := -gstabs
568 # files to be removed upon make clean
569 clean-files := ../include/linux/compile.h
572 include/linux/compile.h: FORCE
574 @sh $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
576 Index: linux-2.6.0-test6/init/main.c
577 ===================================================================
578 --- linux-2.6.0-test6.orig/init/main.c 2003-10-09 20:52:02.850348352 +0800
579 +++ linux-2.6.0-test6/init/main.c 2003-10-09 20:57:41.897805304 +0800
581 int system_running = 0;
584 + * The kernel_magic value represents the address of _end, which allows
585 + * namelist tools to "match" each other respectively. That way a tool
586 + * that looks at /dev/mem can verify that it is using the right System.map
587 + * file -- if kernel_magic doesn't equal the namelist value of _end,
588 + * something's wrong.
590 +extern unsigned long _end;
591 +unsigned long *kernel_magic = &_end;
594 * Boot command-line arguments
596 #define MAX_INIT_ARGS 8
597 Index: linux-2.6.0-test6/init/version.c
598 ===================================================================
599 --- linux-2.6.0-test6.orig/init/version.c 2003-09-28 08:50:20.000000000 +0800
600 +++ linux-2.6.0-test6/init/version.c 2003-10-09 20:57:41.898805152 +0800
602 #include <linux/uts.h>
603 #include <linux/utsname.h>
604 #include <linux/version.h>
605 +#include <linux/stringify.h>
607 #define version(a) Version_ ## a
608 #define version_string(a) version(a)
610 const char *linux_banner =
611 "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
612 LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
614 +const char *LINUX_COMPILE_VERSION_ID = __stringify(LINUX_COMPILE_VERSION_ID);
615 +LINUX_COMPILE_VERSION_ID_TYPE;