From 20e4cab0c06c1ed64a884ef0075805273d74f28f Mon Sep 17 00:00:00 2001 From: wangdi Date: Wed, 23 Jul 2003 06:47:03 +0000 Subject: [PATCH] add sysrq and crash support in lkcd-cvs-2.6.0-test1 --- .../patches/lkcd-cvs-2.6.0-test1.patch | 81 +++++++++++++++------- 1 file changed, 57 insertions(+), 24 deletions(-) diff --git a/lustre/kernel_patches/patches/lkcd-cvs-2.6.0-test1.patch b/lustre/kernel_patches/patches/lkcd-cvs-2.6.0-test1.patch index d2b20b1..f3a52f1 100644 --- a/lustre/kernel_patches/patches/lkcd-cvs-2.6.0-test1.patch +++ b/lustre/kernel_patches/patches/lkcd-cvs-2.6.0-test1.patch @@ -1,7 +1,7 @@ 0 files changed --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/Makefile 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/Makefile 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,14 @@ +# +# Makefile for the dump device drivers. @@ -18,7 +18,7 @@ +obj-$(CONFIG_CRASH_DUMP_COMPRESS_RLE) += dump_rle.o +obj-$(CONFIG_CRASH_DUMP_COMPRESS_GZIP) += dump_gzip.o --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_blockdev.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_blockdev.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,461 @@ +/* + * Implements the dump driver interface for saving a dump to @@ -482,7 +482,7 @@ +module_init(dump_blockdev_init); +module_exit(dump_blockdev_cleanup); --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_execute.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_execute.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,126 @@ +/* + * The file has the common/generic dump execution code @@ -611,7 +611,7 @@ + return ret; +} --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_filters.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_filters.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,143 @@ +/* + * Default filters to select data to dump for various passes. @@ -757,8 +757,8 @@ +}; + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_fmt.c 2003-07-23 11:22:22.000000000 +0800 -@@ -0,0 +1,395 @@ ++++ linux-2.6.0-test1-root/drivers/dump/dump_fmt.c 2003-07-23 13:42:56.000000000 +0800 +@@ -0,0 +1,399 @@ +/* + * Implements the routines which handle the format specific + * aspects of dump for the default dump format. @@ -854,6 +854,8 @@ +static int lcrash_init_dump_header(const char *panic_str) +{ + struct timeval dh_time; ++ struct sysinfo info; ++ + /* make sure the dump header isn't TOO big */ + if ((sizeof(struct __dump_header) + + sizeof(struct __dump_header_asm)) > DUMP_BUFFER_SIZE) { @@ -872,6 +874,8 @@ + dump_header.dh_memory_start = PAGE_OFFSET; + dump_header.dh_memory_end = DUMP_MAGIC_NUMBER; + dump_header.dh_header_size = sizeof(struct __dump_header); ++ si_meminfo(&info); ++ dump_header.dh_memory_size = (u64)info.totalram; + dump_header.dh_page_size = PAGE_SIZE; + dump_header.dh_dump_level = dump_config.level; + dump_header.dh_current_task = (unsigned long) current; @@ -879,7 +883,7 @@ + compress_type; + dump_header.dh_dump_flags = dump_config.flags; + dump_header.dh_dump_device = dump_config.dumper->dev->device_id; -+ ++ +#if DUMP_DEBUG >= 6 + dump_header.dh_num_bytes = 0; +#endif @@ -1155,7 +1159,7 @@ +}; + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_gzip.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_gzip.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,118 @@ +/* + * GZIP Compression functions for kernel crash dumps. @@ -1276,7 +1280,7 @@ +MODULE_AUTHOR("LKCD Development Team "); +MODULE_DESCRIPTION("Gzip compression module for crash dump driver"); --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_i386.c 2003-07-23 11:42:15.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_i386.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,329 @@ +/* + * Architecture specific (i386) functions for Linux crash dumps. @@ -1608,7 +1612,7 @@ +} + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_memdev.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_memdev.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,640 @@ +/* + * Implements the dump driver interface for saving a dump in available @@ -2251,8 +2255,8 @@ +struct dump_memdev *dump_memdev = &default_dump_memdev; + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_netdev.c 2003-07-23 11:22:22.000000000 +0800 -@@ -0,0 +1,866 @@ ++++ linux-2.6.0-test1-root/drivers/dump/dump_netdev.c 2003-07-23 14:08:22.000000000 +0800 +@@ -0,0 +1,880 @@ +/* + * Implements the dump driver interface for saving a dump via network + * interface. @@ -2650,6 +2654,13 @@ + dump_send_skb(dev, buff + offset, 1024, &reply); + } +} ++static void dump_do_sysrq(int key) ++{ ++ struct pt_regs regs; ++ ++ get_current_regs(®s); ++ handle_sysrq(key, ®s, NULL, NULL); ++} + +/* + * This function waits for the client to acknowledge the receipt @@ -2827,7 +2838,14 @@ + dump_send_skb(dump_ndev, (char *)&dump_magic, + sizeof(dump_magic), &reply); + break; -+ ++ case COMM_SYSRQ: ++ dump_do_sysrq(req.from); ++ reply.code = REPLY_SYSRQ; ++ reply.nr = req.nr; ++ reply.info = req.from; ++ sprintf(tmp, "SYSRQ command %d \n", req.from); ++ dump_send_skb(dump_ndev, tmp, strlen(tmp), &reply); ++ break; + default: + reply.code = REPLY_ERROR; + reply.nr = req.nr; @@ -3120,7 +3138,7 @@ +module_init(dump_netdev_init); +module_exit(dump_netdev_cleanup); --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_overlay.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_overlay.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,848 @@ +/* + * Two-stage soft-boot based dump scheme methods (memory overlay @@ -3971,7 +3989,7 @@ +}; + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_rle.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_rle.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,175 @@ +/* + * RLE Compression functions for kernel crash dumps. @@ -4149,7 +4167,7 @@ +MODULE_AUTHOR("LKCD Development Team "); +MODULE_DESCRIPTION("RLE compression module for crash dump driver"); --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_scheme.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_scheme.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,357 @@ +/* + * Default single stage dump scheme methods @@ -4509,7 +4527,7 @@ +}; + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_setup.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_setup.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,803 @@ +/* + * Standard kernel function entry points for Linux crash dumps. @@ -5315,7 +5333,7 @@ +module_init(dump_init); +module_exit(dump_cleanup); --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/include/linux/dumpdev.h 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/include/linux/dumpdev.h 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,161 @@ +/* + * Generic dump device interfaces for flexible system dump @@ -5479,7 +5497,7 @@ + +#endif /* _LINUX_DUMPDEV_H */ --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/include/linux/dump.h 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/include/linux/dump.h 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,376 @@ +/* + * Kernel header file for Linux crash dumps. @@ -5858,8 +5876,8 @@ + +#endif /* _DUMP_H */ --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/include/linux/dump_netdev.h 2003-07-23 11:22:22.000000000 +0800 -@@ -0,0 +1,80 @@ ++++ linux-2.6.0-test1-root/include/linux/dump_netdev.h 2003-07-23 14:08:10.000000000 +0800 +@@ -0,0 +1,82 @@ +/* + * linux/drivers/net/netconsole.h + * @@ -5905,6 +5923,7 @@ + COMM_GET_REGS = 8, + COMM_GET_MAGIC = 9, + COMM_START_WRITE_NETDUMP_ACK = 10, ++ COMM_SYSRQ = 11, +}; + +typedef struct netdump_req_s { @@ -5929,6 +5948,7 @@ + REPLY_REGS = 10, + REPLY_MAGIC = 11, + REPLY_START_WRITE_NETDUMP = 12, ++ REPLY_SYSRQ = 13, +}; + +typedef struct netdump_reply_s { @@ -5941,7 +5961,7 @@ + + --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/include/asm-i386/dump.h 2003-07-23 11:22:40.000000000 +0800 ++++ linux-2.6.0-test1-root/include/asm-i386/dump.h 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,93 @@ +/* + * Kernel header file for Linux crash dumps. @@ -6037,7 +6057,7 @@ + +#endif /* _ASM_DUMP_H */ --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/init/kerntypes.c 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/init/kerntypes.c 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,31 @@ +/* + * kerntypes.c @@ -6071,7 +6091,7 @@ +{ +} --- /dev/null 2002-08-31 07:31:37.000000000 +0800 -+++ linux-2.6.0-test1-root/drivers/dump/dump_methods.h 2003-07-23 11:22:22.000000000 +0800 ++++ linux-2.6.0-test1-root/drivers/dump/dump_methods.h 2003-07-23 13:21:40.000000000 +0800 @@ -0,0 +1,348 @@ +/* + * Generic interfaces for flexible system dump @@ -6421,5 +6441,18 @@ + + +#endif /* _LINUX_DUMP_METHODS_H */ +--- linux-2.6.0-test1/Makefile~lkcd-cvs-2.6.0-test1 2003-07-23 13:21:34.000000000 +0800 ++++ linux-2.6.0-test1-root/Makefile 2003-07-23 13:46:05.000000000 +0800 +@@ -228,6 +228,10 @@ export AFLAGS AFLAGS_KERNEL AFLAGS_MODUL + + export MODVERDIR := .tmp_versions + ++ifeq ($(CONFIG_CRASH_DUMP),) ++ CFLAGS += -g ++endif ++ + # The temporary file to save gcc -MD generated dependencies must not + # contain a comma + comma := , _ -- 1.8.3.1