mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Since V!=R kernel introduction, HSA memory can be contained in/spread over more than one ELF LOAD segment of /proc/vmcore simultaneously. Therefore, the old HSA release logic is no longer valid because it assumes that HSA memory is fully contained in exactly one ELF LOAD segment of /proc/vmcore. This resulted in zfcpdump releasing HSA memory too soon and by that making parts of /proc/vmcore which cover HSA memory unreadable by user space. To correct this problem on V!=R kernel, we need first to find all ELF LOAD segments containing HSA memory, write those /proc/vmcore parts first and only then release HSA memory. The new HSA release logic must be able to handle both V!=R and V==R kernels to be backwards compatible. ==================== Tests of V!=R kernel ==================== Output of test run (KASLR on) ============================= Writing dump: TRACE: Read: /sys/kernel/debug/zcore/hsa: TRACE: '2ffff000' TRACE: ELF LOAD segment: p_offset=0x0000000000009000 p_filesz=0x0000000001cb0000 p_paddr=0x00000002f1e30000 p_vaddr=0x000002c609044000 TRACE: ELF LOAD segment: p_offset=0x0000000001cb9000 p_filesz=0x0000000040000000 p_paddr=0x0000000000000000 p_vaddr=0x000001bd00000000 TRACE: ELF LOAD segment: p_offset=0x0000000041cb9000 p_filesz=0x0000000300000000 p_paddr=0x0000000100000000 p_vaddr=0x000001be00000000 TRACE: Write copy table entry 0: off=0x0000000001cb9000 size=0x000000002ffff000 hsa=1 TRACE: Write copy table entry 1: off=0x0000000000001000 size=0x0000000001cb8000 hsa=0 TRACE: Release HSA memory TRACE: Write copy table entry 2: off=0x0000000031cb8000 size=0x0000000310001000 hsa=0 TRACE: Write copy table entry 3: off=0x0000000000000000 size=0x0000000000001000 hsa=0 Dump successful Output of test run (KASLR off) ============================== Writing dump: TRACE: Read: /sys/kernel/debug/zcore/hsa: TRACE: '2ffff000' TRACE: ELF LOAD segment: p_offset=0x0000000000009000 p_filesz=0x0000000001cb0000 p_paddr=0x0000000000c21000 p_vaddr=0x000003ffe0000000 TRACE: ELF LOAD segment: p_offset=0x0000000001cb9000 p_filesz=0x0000000040000000 p_paddr=0x0000000000000000 p_vaddr=0x000002f200000000 TRACE: ELF LOAD segment: p_offset=0x0000000041cb9000 p_filesz=0x0000000300000000 p_paddr=0x0000000100000000 p_vaddr=0x000002f300000000 TRACE: Write copy table entry 0: off=0x0000000000009000 size=0x0000000001cb0000 hsa=1 TRACE: Write copy table entry 1: off=0x0000000001cb9000 size=0x000000002ffff000 hsa=1 TRACE: Write copy table entry 2: off=0x0000000000001000 size=0x0000000000008000 hsa=0 TRACE: Release HSA memory TRACE: Write copy table entry 3: off=0x0000000031cb8000 size=0x0000000310001000 hsa=0 TRACE: Write copy table entry 4: off=0x0000000000000000 size=0x0000000000001000 hsa=0 Dump successful ==================== Tests of V==R kernel ==================== Output of test run (KASLR on) ============================= Writing dump: TRACE: Read: /sys/kernel/debug/zcore/hsa: TRACE: '2ffff000' TRACE: ELF LOAD segment: p_offset=0x0000000000009000 p_filesz=0x0000000000000000 p_paddr=0x0000000000000000 p_vaddr=0x0000000000000000 TRACE: ELF LOAD segment: p_offset=0x0000000000009000 p_filesz=0x0000000040000000 p_paddr=0x0000000000000000 p_vaddr=0x0000000000000000 TRACE: ELF LOAD segment: p_offset=0x0000000040009000 p_filesz=0x0000000300000000 p_paddr=0x0000000100000000 p_vaddr=0x0000000100000000 TRACE: Write copy table entry 0: off=0x0000000000009000 size=0x000000002ffff000 hsa=1 TRACE: Write copy table entry 1: off=0x0000000000001000 size=0x0000000000008000 hsa=0 TRACE: Release HSA memory TRACE: Write copy table entry 2: off=0x0000000030008000 size=0x0000000310001000 hsa=0 TRACE: Write copy table entry 3: off=0x0000000000000000 size=0x0000000000001000 hsa=0 Dump successful Output of test run (KASLR off) ============================== Writing dump: TRACE: Read: /sys/kernel/debug/zcore/hsa: TRACE: '2ffff000' TRACE: ELF LOAD segment: p_offset=0x0000000000009000 p_filesz=0x0000000000000000 p_paddr=0x0000000000000000 p_vaddr=0x0000000000000000 TRACE: ELF LOAD segment: p_offset=0x0000000000009000 p_filesz=0x0000000040000000 p_paddr=0x0000000000000000 p_vaddr=0x0000000000000000 TRACE: ELF LOAD segment: p_offset=0x0000000040009000 p_filesz=0x0000000300000000 p_paddr=0x0000000100000000 p_vaddr=0x0000000100000000 TRACE: Write copy table entry 0: off=0x0000000000009000 size=0x000000002ffff000 hsa=1 TRACE: Write copy table entry 1: off=0x0000000000001000 size=0x0000000000008000 hsa=0 TRACE: Release HSA memory TRACE: Write copy table entry 2: off=0x0000000030008000 size=0x0000000310001000 hsa=0 TRACE: Write copy table entry 3: off=0x0000000000000000 size=0x0000000000001000 hsa=0 Dump successful Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
zfcpdump: S390 SCSI dump tool (Version 3) ========================================= zfcpdump is used for creating System dumps for Linux on System z. It has two parts: a zfcpdump enabled Linux kernel and a user space application. This is the 3rd version of zfcpdump which uses the upstream kernel version 3.12 or above. This version writes the dump to a partition in contrast to the previous versions where the dump was written to a file system. The user space application of zfcpdump can reside either in an intitramfs or an initrd. It reads from /proc/vmcore, provided by the kernel part, and writes the system dump to a SCSI disk partition. To build a zfcpdump enabled kernel use the following settings in your kernel configuration: * CONFIG_ZFCPDUMP=y * CONFIG_BLK_DEV_INITRD=y * CONFIG_EFI_PARTITION=y for using GPT disk layout * CONFIG_MSDOS_PARTITION=y for using MSDOS disk layout * BLK_DEV_SD=y * Enable ZFCP driver * Enable SCSI driver * Disable as many features as possible to keep the kernel small. E.g. network and file system support is not needed at all. You can use "make zfcpdump_defconfig" as a starting point for your kernel configuration. * Issue "make bzImage" to build the zfcpdump kernel image. In a Linux distribution the zfcpdump enabled kernel image must be copied to /lib/s390-tools/zfcpdump/zfcpdump-image, where the s390 zipl tool is looking for the dump kernel when preparing a SCSI dump disk. Create and install initrd ========================= * make Builds "cpioinit" and statically linked "zfcpdump" application. Then cpioinit is used to integrate the zfcpdump application into the cpio archive zfcpdump_part.rd. * make install The initrd zfcpdump_part.rd is installed to "/lib/s390-tools/zfcpdump/". Additional information ====================== For more information on how to use zfcpdump and zipl refer to the s390 'Using the Dump Tools' book, which is available from: http://www.ibm.com/developerworks/linux/linux390.