s390: SCSI dump kernel and userspace application
Subsystems (3)
RFC PATCH 1/2 s390: SCSI dump kernel and userspace application
Kernel part of the s390 SCSI dumper: zcore character device driver.
Signed-off-by Michael Holzheu <[email protected]>
--- Documentation/s390/zfcpdump.txt | 41 + arch/s390/Kconfig | 7 arch/s390/kernel/early.c | 3 arch/s390/kernel/head64.S | 43 + arch/s390/kernel/ipl.c | 24 - arch/s390/kernel/setup.c | 3 arch/s390/kernel/smp.c | 1 drivers/s390/char/Makefile | 2 drivers/s390/char/sclp.h | 2 drivers/s390/char/sclp_sdias.c | 248 +++++++++++ drivers/s390/char/zcore.c | 885 ++++++++++++++++++++++++++++++++++++++++ drivers/s390/cio/cio.c | 1 include/asm-s390/ipl.h | 116 +++++ include/asm-s390/processor.h | 5 include/asm-s390/sclp.h | 2 include/asm-s390/setup.h | 75 --- 16 files changed, 1360 insertions(+), 98 deletions(-)
Documentation/s390/zfcpdump.txt new file +41 -0
@@ -0,0 +1,41 @@ +s390 SCSI dump tool (zfcpdump) + +System z machines (z900 or higher) provide hardware support for creating system +dumps on SCSI disks. The dump process is initiated by booting a dump tool, which +has to create a dump of the current (probably crashed) Linux image. In order to +not overwrite memory of the crashed Linux with data of the dump tool, the +hardware saves some memory plus the register sets of the boot cpu before the +dump tool is loaded. There exists an SCLP hardware interface to obtain the saved +memory afterwards. Currently 32 MB are saved. + +This zfcpdump implementation consists of a small Linux dump kernel together with +a userspace dump tool, which are loaded together into the saved memory region +below 32 MB. zfcpdump is installed on a SCSI disk using zipl (as contained in the +s390-tools package) to make the device bootable. The operator of a Linux system +can then trigger a scsi dump by booting the SCSI disk, where zfcpdump resides on. + +The kernel part of zfcpdump is implemented as a character device driver named +"zcore", which exports memory and registers of the crashed Linux in an s390 +standalone dump format. It can be used in the same way as e.g. /dev/mem. The +dump format defines a 4K header followed by plain uncompressed memory. The +register sets are stored in the prefix pages of the different cpus. To build an +dump enabled kernel with the zcore driver, the kernel config option +"S390_ZFCPDUMP" has to be set. When reading from /dev/zcore, the first part of +memory, which has been saved by the hardware is read by the driver via the SCLP +hardware interface. The second part is just copied from the non overwritten real +memory. + +The userspace application of zfcpdump resides in an intitramfs. It reads from +/dev/zcore and writes the system dump to a file on a SCSI disk. + +To build zfcpdump you have to do the following: +- Use /arch/s390/zfcpdump/defconfig.zfcpdump as kernel configuration file, which + enables the S390_ZFCPDUMP option and sets all other required kernel options. +- Issue "make zfcpdump" from the toplevel directory of the linux tree to + build the userspace application. Note, that the zfcpdump application has a + dependency on glibc and libz. +- Issue "make image" to build the zfcpdump image with initramfs. + +The zfcpdump enabled kernel image must be copied to +/usr/share/zfcpdump/zfcpdump.image, where the zipl tool is looking for the dump +kernel, when preparing a SCSI dump disk.
arch/s390/Kconfig +7 -0
@@ -512,6 +512,13 @@ config KEXEC current kernel, and to start another kernel. It is like a reboot but is independent of hardware/microcode support. +config S390_ZFCPDUMP + bool "zfcp dump kernel" + default n + help + Select this option if you want to build an zfcp dump enabled kernel. + Do NOT select this option for normal kernels! + endmenu source "net/Kconfig"
arch/s390/kernel/early.c +2 -1
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/pfn.h> #include <linux/uaccess.h> +#include <asm/ipl.h> #include <asm/lowcore.h> #include <asm/processor.h> #include <asm/sections.h>
@@ -129,7 +130,7 @@ static noinline __init void detect_machi {struct cpuinfo_S390 *cpuinfo = &S390_lowcore.cpu_data; - asmvolatile ("stidp %0" :"=m" (S390_lowcore.cpu_data.cpu_id)); +get_cpu_id (&S390_lowcore.cpu_data.cpu_id);/* Running under z/VM ? */ if (cpuinfo->cpu_id.version ==0xff )
arch/s390/kernel/head64.S +43 -0
56 lines not on this page · raw message
arch/s390/kernel/ipl.c +2 -22
@@ -14,6 +14,7 @@#include <linux/delay.h> #include <linux/reboot.h> #include <linux/ctype.h> +#include <asm/ipl.h> #include <asm/smp.h> #include <asm/setup.h> #include <asm/cpcmd.h>
@@ -94,27 +95,6 @@ static char *shutdown_action_str(enum sh } } -enum diag308_subcode { -DIAG308_IPL =3 , -DIAG308_DUMP =4 , -DIAG308_SET =5 , -DIAG308_STORE =6 , -}; - -enum diag308_ipl_type { -DIAG308_IPL_TYPE_FCP =0 , -DIAG308_IPL_TYPE_CCW =2 , -}; - -enum diag308_opt { -DIAG308_IPL_OPT_IPL =0x10 , -DIAG308_IPL_OPT_DUMP =0x20 , -}; - -enum diag308_rc { -DIAG308_RC_OK =1 , -}; -static int diag308_set_works =0 ;static int reipl_capabilities =IPL_TYPE_UNKNOWN ;
@@ -134,7 +114,7 @@ static struct ipl_parameter_block *dump_static enum shutdown_action on_panic_action =SHUTDOWN_STOP ; -static int diag308 (unsigned long subcode,void *addr) +int diag308 (unsigned long subcode,void *addr) { register unsigned long _addr asm("0") = (unsigned long) addr; register unsigned long _rc asm("1") = 0;
arch/s390/kernel/setup.c +2 -1
@@ -41,6 +41,7 @@#include <linux/ctype.h> #include <linux/reboot.h> +#include <asm/ipl.h> #include <asm/uaccess.h> #include <asm/system.h> #include <asm/smp.h>
@@ -106,7 +107,7 @@ void __devinit cpu_init (void)/* * Store processor id in lowcore (used e.g. in timer_interrupt) */ - asmvolatile ("stidp %0" :"=m" (S390_lowcore.cpu_data.cpu_id)); +get_cpu_id (&S390_lowcore.cpu_data.cpu_id); S390_lowcore.cpu_data.cpu_addr = addr;/*
arch/s390/kernel/smp.c +1 -0
@@ -31,6 +31,7 @@#include <linux/interrupt.h> #include <linux/cpu.h> #include <linux/timex.h> +#include <asm/ipl.h> #include <asm/setup.h> #include <asm/sigp.h> #include <asm/pgalloc.h>
drivers/s390/char/Makefile +2 -0
@@ -29,3 +29,5 @@ obj-$(CONFIG_S390_TAPE_34XX) += tape_34x obj-$(CONFIG_S390_TAPE_3590) += tape_3590.o obj-$(CONFIG_MONREADER) += monreader.o obj-$(CONFIG_MONWRITER) += monwriter.o + +obj-$(CONFIG_S390_ZFCPDUMP) += zcore.o sclp_sdias.o
drivers/s390/char/sclp.h +2 -0
@@ -27,6 +27,7 @@#define EvTyp_CntlProgIdent 0x0B#define EvTyp_SigQuiesce 0x1D#define EvTyp_VT220Msg 0x1A +#define EvTyp_SDIAS 0x1C#define EvTyp_OpCmd_Mask 0x80000000#define EvTyp_Msg_Mask 0x40000000
@@ -36,6 +37,7 @@#define EvTyp_CtlProgIdent_Mask 0x00200000#define EvTyp_SigQuiesce_Mask 0x00000008#define EvTyp_VT220Msg_Mask 0x00000040 +#define EvTyp_SDIAS_Mask 0x00000010#define GnrlMsgFlgs_DOM 0x8000#define GnrlMsgFlgs_SndAlrm 0x4000
drivers/s390/char/sclp_sdias.c new file +248 -0
248 lines not on this page · raw message
drivers/s390/char/zcore.c new file +885 -0
885 lines not on this page · raw message
drivers/s390/cio/cio.c +1 -0
@@ -21,6 +21,7 @@#include <asm/irq_regs.h> #include <asm/setup.h> #include <asm/reset.h> +#include <asm/ipl.h> #include "airq.h" #include "cio.h" #include "css.h"
include/asm-s390/ipl.h new file +116 -0
116 lines not on this page · raw message
include/asm-s390/processor.h +5 -0
@@ -36,6 +36,11 @@ typedef struct unsigned int unused : 16; } __attribute__ ((packed)) cpuid_t; +static inline void get_cpu_id (cpuid_t *ptr) +{ + asmvolatile ("stidp 0(%1)" :"=m" (*ptr) :"a" (ptr)); +} +struct cpuinfo_S390 {cpuid_t cpu_id;
include/asm-s390/sclp.h +2 -0
@@ -35,5 +35,7 @@ struct sclp_readinfo_sccb {extern struct sclp_readinfo_sccb s390_readinfo_sccb;extern void sclp_readinfo_early (void ); +extern int sclp_sdias_blk_count (void ); +extern int sclp_sdias_copy (void *dest,int blk_num,int nr_blks);#endif /* _ASM_S390_SCLP_H */
include/asm-s390/setup.h +1 -74
96 lines not on this page · raw message