fadump: Firmware-assisted dump support for Powerpc.
Subsystems (6)
v7 cover fadump: Firmware-assisted dump support for Powerpc.
Hi All,
Please find the version 7 of the patchset that implements firmware-assisted dump mechanism to capture kernel crash dump for Powerpc architecture. Firmware-assisted dump is a robust mechanism to get reliable kernel crash dump with the assistance of firmware. This approach does not use kexec, instead firmware assists in booting the kdump kernel while preserving memory contents.
- Firmware assisted dump (fadump) infrastructure is intended to replace the existing phyp assisted dump.
- Fadump uses the same firmware interfaces and memory reservation model as phyp assisted dump.
- Unlike phyp dump, fadump exports the memory dump through /proc/vmcore in the ELF format in the same way as kdump. This helps us reuse the kdump infrastructure for dump capture and filtering.
- Unlike phyp dump, userspace tool does not need to refer any sysfs interface while reading /proc/vmcore.
- Unlike phyp dump, fadump allows user to release all the memory reserved for dump, with a single operation of echo 1 > /sys/kernel/fadump_release_mem.
- Once enabled through kernel boot parameter, fadump can be started/stopped through /sys/kernel/fadump_registered interface and can be easily integrated with kdump service start/stop init scripts.
- Once the dump is copied out, the memory that held the dump is immediately available to the running kernel. And therefore, unlike kdump, fadump doesn't need a 2nd reboot to get back the system to the production configuration.
Fadump reuses much of the code written by Manish Ahuja and Linas Vepstas for the phyp assisted dump.
I have tested the patches on following system configuration:
1. LPAR on Power6 with 4GB RAM and 8 CPUs
2. LPAR on Power7 with 2GB RAM and 20 CPUs
3. LPAR on Power7 with 1TB RAM and 896 CPUs
Please review the patchset and let me know your comments.
ChangeLog:
Change in v7:
-------------
- Updated the documentation explaining the enhancement in fadump over old phyp dump.
- Re-based patches to commit d65b4e98d7 (v3.3-rc3)
Change in v6:
-------------
- Use of_read_number and of_read_ulong while reading the dump sizes from rtas node ibm,configure-kernel-kdump-sizes and few minor changes.
- Kernel command line option 'fadump' now uses on/off values to enable/disable fadump.
- Added the last patch in this series 10/10 to remove phyp dump code.
Change in v5:
-------------
- Added 'fadump_' prefix to all static functions defined.
patch 02/10:
- Merged patch 10/10 which introduces a config option CONFIG_FA_DUMP for firmware assisted dump feature on Powerpc (ppc64) architecture.
- Increased MIN_BOOT_MEM by 64M to avoid OOM issue during network dump capture. When kdump infrastructure is configured to save vmcore over network, we run into OOM issue while loading modules related to network setup.
Changes in v4:
--------------
patch 04/10:
- Move the init_elfcore_header() function and 'memblock_num_regions' macro from generic code to power specific code as these are used only by firmware assisted dump implementation which is power specific feature.
patch 05/10:
- Fixes a issue where memblock_free() is invoked from build_cpu_notes() function during error_out path. Invoke cpu_notes_buf_free() in error_out path instead of memblock_free().
Changes in v3:
-------------
- Re-factored the implementation to work with kdump service start/stop. Introduce fadump_registered sysfs control file which will be used by kdump init scripts to start/stop firmware assisted dump. echo 1 to /sys/kernel/fadump_registered file for fadump registration and echo 0 to /sys/kernel/fadump_registered file for fadump un-registration.
- Introduced the locking mechanism to handle simultaneous writes to sysfs control files fadump_registered and fadump_release_mem
Affected patches are: 01/10, 03/10, 08/10.
Changes in v2:
-------------
patch 01/10:
- Modified the documentation to reflect the change of fadump_region file under debugfs filesystem.
patch 02/10:
- Modified to use standard pr_debug() macro.
- Modified early_init_dt_scan_fw_dump() to get the size of "ibm,configure-kernel-dump-sizes" property and use it to iterate through an array of dump sections.
- Introduced boot option 'fadump_reserve_mem=' to let user specify the fadump boot memory to be reserved.
patch 03/10:
- Removed few debug print statements.
- Moved the setup_fadump() call from setup_system() and now calling it subsys_initcall.
- Moved fadump_region attribute under debugfs.
- Clear the TCE entries if firmware assisted dump is active.
patch 05/10:
- Moved the crash_fadump() invocation from generic code to panic notifier.
- Introduced cpu_notes_buf_alloc() function to allocate cpu notes buffer using get_free_pages().
patch 08/10:
- Introduced cpu_notes_buf_free() function to free memory allocated for cpu notes buffer.
Thanks,
-Mahesh.
---
Mahesh Salgaonkar (10):
fadump: Add documentation for firmware-assisted dump.
fadump: Reserve the memory for firmware assisted dump.
fadump: Register for firmware assisted dump.
fadump: Initialize elfcore header and add PT_LOAD program headers.
fadump: Convert firmware-assisted cpu state dump data into elf notes.
fadump: Add PT_NOTE program header for vmcoreinfo
fadump: Introduce cleanup routine to invalidate /proc/vmcore.
fadump: Invalidate registration and release reserved memory for general use.
fadump: Invalidate the fadump registration during machine shutdown.
fadump: Remove the phyp assisted dump code.
Documentation/powerpc/firmware-assisted-dump.txt | 270 +++++ Documentation/powerpc/phyp-assisted-dump.txt | 127 -- arch/powerpc/Kconfig | 17 arch/powerpc/include/asm/fadump.h | 218 ++++ arch/powerpc/include/asm/phyp_dump.h | 47 - arch/powerpc/kernel/Makefile | 1 arch/powerpc/kernel/fadump.c | 1312 ++++++++++++++++++++++ arch/powerpc/kernel/iommu.c | 8 arch/powerpc/kernel/prom.c | 98 -- arch/powerpc/kernel/setup-common.c | 14 arch/powerpc/kernel/traps.c | 3 arch/powerpc/mm/hash_utils_64.c | 11 arch/powerpc/platforms/pseries/Makefile | 1 arch/powerpc/platforms/pseries/phyp_dump.c | 513 --------- fs/proc/vmcore.c | 23 15 files changed, 1881 insertions(+), 782 deletions(-) create mode 100644 Documentation/powerpc/firmware-assisted-dump.txt delete mode 100644 Documentation/powerpc/phyp-assisted-dump.txt create mode 100644 arch/powerpc/include/asm/fadump.h delete mode 100644 arch/powerpc/include/asm/phyp_dump.h create mode 100644 arch/powerpc/kernel/fadump.c delete mode 100644 arch/powerpc/platforms/pseries/phyp_dump.c
Signature · 1 line
-Mahesh
RFC PATCH v7 1/10 fadump: Add documentation for firmware-assisted dump.
From: Mahesh Salgaonkar <[email protected]>
Documentation for firmware-assisted dump. This document is based on the original documentation written for phyp assisted dump by Linas Vepstas and Manish Ahuja, with few changes to reflect the current implementation.
--- Documentation/powerpc/firmware-assisted-dump.txt | 270 ++++++++++++++++++++++ 1 files changed, 270 insertions(+), 0 deletions(-) create mode 100644 Documentation/powerpc/firmware-assisted-dump.txt
Documentation/powerpc/firmware-assisted-dump.txt new file +270 -0
@@ -0,0 +1,270 @@ + + Firmware-Assisted Dump + ------------------------ + July 2011 + +The goal of firmware-assisted dump is to enable the dump of +a crashed system, and to do so from a fully-reset system, and +to minimize the total elapsed time until the system is back +in production use. + +- Firmware assisted dump (fadump) infrastructure is intended to replace + the existing phyp assisted dump. +- Fadump uses the same firmware interfaces and memory reservation model + as phyp assisted dump. +- Unlike phyp dump, fadump exports the memory dump through /proc/vmcore + in the ELF format in the same way as kdump. This helps us reuse the + kdump infrastructure for dump capture and filtering. +- Unlike phyp dump, userspace tool does not need to refer any sysfs + interface while reading /proc/vmcore. +- Unlike phyp dump, fadump allows user to release all the memory reserved + for dump, with a single operation of echo 1 > /sys/kernel/fadump_release_mem. +- Once enabled through kernel boot parameter, fadump can be + started/stopped through /sys/kernel/fadump_registered interface (see + sysfs files section below) and can be easily integrated with kdump + service start/stop init scripts. + +Comparing with kdump or other strategies, firmware-assisted +dump offers several strong, practical advantages: + +-- Unlike kdump, the system has been reset, and loaded + with a fresh copy of the kernel. In particular, + PCI and I/O devices have been reinitialized and are + in a clean, consistent state. +-- Once the dump is copied out, the memory that held the dump + is immediately available to the running kernel. And therefore, + unlike kdump, fadump doesn't need a 2nd reboot to get back + the system to the production configuration. + +The above can only be accomplished by coordination with, +and assistance from the Power firmware. The procedure is +as follows: + +-- The first kernel registers the sections of memory with the + Power firmware for dump preservation during OS initialization. + These registered sections of memory are reserved by the first + kernel during early boot. + +-- When a system crashes, the Power firmware will save + the low memory (boot memory of size larger of 5% of system RAM + or 256MB) of RAM to the previous registered region. It will + also save system registers, and hardware PTE's. + + NOTE: The term 'boot memory' means size of the low memory chunk + that is required for a kernel to boot successfully when + booted with restricted memory. By default, the boot memory + size will be the larger of 5% of system RAM or 256MB. + Alternatively, user can also specify boot memory size + through boot parameter 'fadump_reserve_mem=' which will + override the default calculated size. Use this option + if default boot memory size is not sufficient for second + kernel to boot successfully. + +-- After the low memory (boot memory) area has been saved, the + firmware will reset PCI and other hardware state. It will + *not* clear the RAM. It will then launch the bootloader, as + normal. + +-- The freshly booted kernel will notice that there is a new + node (ibm,dump-kernel) in the device tree, indicating that + there is crash data available from a previous boot. During + the early boot OS will reserve rest of the memory above + boot memory size effectively booting with restricted memory + size. This will make sure that the second kernel will not + touch any of the dump memory area. + +-- User-space tools will read /proc/vmcore to obtain the contents + of memory, which holds the previous crashed kernel dump in ELF + format. The userspace tools may copy this info to disk, or + network, nas, san, iscsi, etc. as desired. + +-- Once the userspace tool is done saving dump, it will echo + '1' to /sys/kernel/fadump_release_mem to release the reserved + memory back to general use, except the memory required for + next firmware-assisted dump registration. + + e.g. + # echo 1 > /sys/kernel/fadump_release_mem + +Please note that the firmware-assisted dump feature +is only available on Power6 and above systems with recent +firmware versions. + +Implementation details: +---------------------- + +During boot, a check is made to see if firmware supports +this feature on that particular machine. If it does, then +we check to see if an active dump is waiting for us. If yes +then everything but boot memory size of RAM is reserved during +early boot (See Fig. 2). This area is released once we finish +collecting the dump from user land scripts (e.g. kdump scripts) +that are run. If there is dump data, then the +/sys/kernel/fadump_release_mem file is created, and the reserved +memory is held. + +If there is no waiting dump data, then only the memory required +to hold CPU state, HPTE region, boot memory dump and elfcore +header, is reserved at the top of memory (see Fig. 1). This area +is *not* released: this region will be kept permanently reserved, +so that it can act as a receptacle for a copy of the boot memory +content in addition to CPU state and HPTE region, in the case a +crash does occur. + + o Memory Reservation during first kernel + + Low memory Top of memory + 0 boot memory size | + | | |<--Reserved dump area -->| + V V | Permanent Reservation V + +-----------+----------/ /----------+---+----+-----------+----+ + | | |CPU|HPTE| DUMP |ELF | + +-----------+----------/ /----------+---+----+-----------+----+ + | ^ + | | + \ / + ------------------------------------------- + Boot memory content gets transferred to + reserved area by firmware at the time of + crash + Fig. 1 + + o Memory Reservation during second kernel after crash + + Low memory Top of memory + 0 boot memory size | + | |<------------- Reserved dump area ----------- -->| + V V V + +-----------+----------/ /----------+---+----+-----------+----+ + | | |CPU|HPTE| DUMP |ELF | + +-----------+----------/ /----------+---+----+-----------+----+ + | | + V V + Used by second /proc/vmcore + kernel to boot + Fig. 2 + +Currently the dump will be copied from /proc/vmcore to a +a new file upon user intervention. The dump data available through +/proc/vmcore will be in ELF format. Hence the existing kdump +infrastructure (kdump scripts) to save the dump works fine with +minor modifications. + +The tools to examine the dump will be same as the ones +used for kdump. + +How to enable firmware-assisted dump (fadump): +------------------------------------- + +1. Set config option CONFIG_FA_DUMP=y and build kernel. +2. Boot into linux kernel with 'fadump=on' kernel cmdline option. +3. Optionally, user can also set 'fadump_reserve_mem=' kernel cmdline + to specify size of the memory to reserve for boot memory dump + preservation. + +NOTE: If firmware-assisted dump fails to reserve memory then it will + fallback to existing kdump mechanism if 'crashkernel=' option + is set at kernel cmdline. + +Sysfs/debugfs files: +------------ + +Firmware-assisted dump feature uses sysfs file system to hold +the control files and debugfs file to display memory reserved region. + +Here is the list of files under kernel sysfs: + + /sys/kernel/fadump_enabled + + This is used to display the fadump status. + 0 = fadump is disabled + 1 = fadump is enabled + + This interface can be used by kdump init scripts to identify if + fadump is enabled in the kernel and act accordingly. + + /sys/kernel/fadump_registered + + This is used to display the fadump registration status as well + as to control (start/stop) the fadump registration. + 0 = fadump is not registered. + 1 = fadump is registered and ready to handle system crash. + + To register fadump echo 1 > /sys/kernel/fadump_registered and + echo 0 > /sys/kernel/fadump_registered for un-register and stop the + fadump. Once the fadump is un-registered, the system crash will not + be handled and vmcore will not be captured. This interface can be + easily integrated with kdump service start/stop. + + /sys/kernel/fadump_release_mem + + This file is available only when fadump is active during + second kernel. This is used to release the reserved memory + region that are held for saving crash dump. To release the + reserved memory echo 1 to it: + + echo 1 > /sys/kernel/fadump_release_mem + + After echo 1, the content of the /sys/kernel/debug/powerpc/fadump_region + file will change to reflect the new memory reservations. + + The existing userspace tools (kdump infrastructure) can be easily + enhanced to use this interface to release the memory reserved for + dump and continue without 2nd reboot. + +Here is the list of files under powerpc debugfs: +(Assuming debugfs is mounted on /sys/kernel/debug directory.) + + /sys/kernel/debug/powerpc/fadump_region + + This file shows the reserved memory regions if fadump is + enabled otherwise this file is empty. The output format + is: + <region>: [<start>-<end>] <reserved-size> bytes, Dumped: <dump-size> + + e.g. + Contents when fadump is registered during first kernel + + # cat /sys/kernel/debug/powerpc/fadump_region + CPU : [0x0000006ffb0000-0x0000006fff001f] 0x40020 bytes, Dumped: 0x0 + HPTE: [0x0000006fff0020-0x0000006fff101f] 0x1000 bytes, Dumped: 0x0 + DUMP: [0x0000006fff1020-0x0000007fff101f] 0x10000000 bytes, Dumped: 0x0 + + Contents when fadump is active during second kernel + + # cat /sys/kernel/debug/powerpc/fadump_region + CPU : [0x0000006ffb0000-0x0000006fff001f] 0x40020 bytes, Dumped: 0x40020 + HPTE: [0x0000006fff0020-0x0000006fff101f] 0x1000 bytes, Dumped: 0x1000 + DUMP: [0x0000006fff1020-0x0000007fff101f] 0x10000000 bytes, Dumped: 0x10000000 + : [0x00000010000000-0x0000006ffaffff] 0x5ffb0000 bytes, Dumped: 0x5ffb0000 + +NOTE: Please refer to Documentation/filesystems/debugfs.txt on + how to mount the debugfs filesystem. + + +TODO: +----- + o Need to come up with the better approach to find out more + accurate boot memory size that is required for a kernel to + boot successfully when booted with restricted memory. + o The fadump implementation introduces a fadump crash info structure + in the scratch area before the ELF core header. The idea of introducing + this structure is to pass some important crash info data to the second + kernel which will help second kernel to populate ELF core header with + correct data before it gets exported through /proc/vmcore. The current + design implementation does not address a possibility of introducing + additional fields (in future) to this structure without affecting + compatibility. Need to come up with the better approach to address this. + The possible approaches are: + 1. Introduce version field for version tracking, bump up the version + whenever a new field is added to the structure in future. The version + field can be used to find out what fields are valid for the current + version of the structure. + 2. Reserve the area of predefined size (say PAGE_SIZE) for this + structure and have unused area as reserved (initialized to zero) + for future field additions. + The advantage of approach 1 over 2 is we don't need to reserve extra space. +--- +Author: Mahesh Salgaonkar <[email protected]> +This document is based on the original documentation written for phyp +assisted dump by Linas Vepstas and Manish Ahuja.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
RFC PATCH v7 2/10 fadump: Reserve the memory for firmware assisted dump.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
Reserve the memory during early boot to preserve CPU state data, HPTE region and RMA (real mode area) region data in case of kernel crash. At the time of crash, powerpc firmware will store CPU state data, HPTE region data and move RMA region data to the reserved memory area.
If the firmware-assisted dump fails to reserve the memory, then fallback to existing kexec-based kdump.
Most of the code implementation to reserve memory has been adapted from phyp assisted dump implementation written by Linas Vepstas and Manish Ahuja
This patch also introduces a config option CONFIG_FA_DUMP for firmware assisted dump feature on Powerpc (ppc64) architecture.
--- arch/powerpc/Kconfig | 13 ++ arch/powerpc/include/asm/fadump.h | 71 +++++++++++ arch/powerpc/kernel/Makefile | 1 arch/powerpc/kernel/fadump.c | 246 +++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/prom.c | 15 ++ 5 files changed, 345 insertions(+), 1 deletions(-) create mode 100644 arch/powerpc/include/asm/fadump.h create mode 100644 arch/powerpc/kernel/fadump.c
arch/powerpc/Kconfig +13 -0
@@ -386,6 +386,19 @@ config PHYP_DUMP If unsure, say "N" +config FA_DUMP + bool "Firmware-assisted dump" + depends on PPC64 && PPC_RTAS && CRASH_DUMP + help + A robust mechanism to get reliable kernel crash dump with + assistance from firmware. This approach does not use kexec, + instead firmware assists in booting the kdump kernel + while preserving memory contents. Firmware-assisted dump + is meant to be a kdump replacement offering robustness and + speed not possible without system firmware assistance. + + If unsure, say "N" + config IRQ_ALL_CPUS bool "Distribute interrupts on all CPUs by default" depends on SMP && !MV64360
arch/powerpc/include/asm/fadump.h new file +71 -0
71 lines not on this page · raw message
arch/powerpc/kernel/Makefile +1 -0
@@ -60,6 +60,7 @@ obj-$(CONFIG_IBMVIO) += vio.o obj-$(CONFIG_IBMEBUS) += ibmebus.o obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o +obj-$(CONFIG_FA_DUMP) += fadump.o ifeq ($(CONFIG_PPC32),y) obj-$(CONFIG_E500) += idle_e500.o endif
arch/powerpc/kernel/fadump.c new file +246 -0
246 lines not on this page · raw message
arch/powerpc/kernel/prom.c +14 -1
@@ -55,6 +55,7 @@#include <asm/phyp_dump.h> #include <asm/kexec.h> #include <asm/opal.h> +#include <asm/fadump.h> #include <mm/mmu_decl.h>
@@ -719,6 +720,11 @@ void __init early_init_devtree(void *params)of_scan_flat_dt (early_init_dt_scan_phyp_dump,NULL );#endif +#ifdef CONFIG_FA_DUMP +/* scan tree to see if dump is active during last boot */ +of_scan_flat_dt (early_init_dt_scan_fw_dump,NULL ); +#endif +/* Pre-initialize the cmd_line with the content of boot_commmand_line, * which will be empty except when the content of the variable has * been overriden by a bootloading mechanism. This happens typically
@@ -750,7 +756,14 @@ void __init early_init_devtree(void *params)if (PHYSICAL_START >MEMORY_START )memblock_reserve (MEMORY_START ,0x8000 );reserve_kdump_trampoline (); -reserve_crashkernel (); +#ifdef CONFIG_FA_DUMP +/* +* If we fail to reserve memory for firmware-assisted dump then +* fallback to kexec based kdump. +*/ + if (fadump_reserve_mem() == 0) +#endif +reserve_crashkernel ();early_reserve_mem ();phyp_dump_reserve_mem ();
RFC PATCH v7 3/10 fadump: Register for firmware assisted dump.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
This patch registers for firmware-assisted dump using rtas token ibm,configure-kernel-dump. During registration firmware is informed about the reserved area where it saves the CPU state data, HPTE table and contents of RMR region at the time of kernel crash. Apart from this, firmware also preserves the contents of entire partition memory even if it is not specified during registration.
This patch also populates sysfs files under /sys/kernel to display fadump status and reserved memory regions.
This patch introduces fadump_registered sysfs control file which will be used by kdump init scripts to start/stop firmware assisted dump. echo 1 to /sys/kernel/fadump_registered file for fadump registration and echo 0 to /sys/kernel/fadump_registered file for fadump un-registration.
--- arch/powerpc/include/asm/fadump.h | 57 ++++++ arch/powerpc/kernel/fadump.c | 352 +++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/iommu.c | 8 + arch/powerpc/mm/hash_utils_64.c | 11 + 4 files changed, 424 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fadump.h +57 -0
@@ -48,6 +48,58 @@#define FADUMP_HPTE_REGION 0x0002#define FADUMP_REAL_MODE_REGION 0x0011 +/* Dump request flag */ +#define FADUMP_REQUEST_FLAG 0x00000001 + +/* FAD commands */ +#define FADUMP_REGISTER 1 +#define FADUMP_UNREGISTER 2 +#define FADUMP_INVALIDATE 3 + +/* Kernel Dump section info */ +struct fadump_section { +u32 request_flag; +u16 source_data_type; +u16 error_flags; +u64 source_address; +u64 source_len; +u64 bytes_dumped; +u64 destination_address; +}; + +/* ibm,configure-kernel-dump header. */ +struct fadump_section_header { +u32 dump_format_version; +u16 dump_num_sections; +u16 dump_status_flag; +u32 offset_first_dump_section; + +/* Fields for disk dump option. */ +u32 dd_block_size; +u64 dd_block_offset; +u64 dd_num_blocks; +u32 dd_offset_disk_path; + +/* Maximum time allowed to prevent an automatic dump-reboot. */ +u32 max_time_auto; +}; + +/* +* Firmware Assisted dump memory structure. This structure is required for +* registering future kernel dump with power firmware through rtas call. +* +* No disk dump option. Hence disk dump path string section is not included. +*/ +struct fadump_mem_struct { +struct fadump_section_header header; + +/* Kernel dump sections */ +struct fadump_section cpu_state_data; +struct fadump_section hpte_region; +struct fadump_section rmr_region; +}; + +/* Firmware-assisted dump configuration details. */ struct fw_dump {unsigned long cpu_state_data_size;unsigned long hpte_region_size;
@@ -62,10 +114,15 @@ struct fw_dump { unsigned long fadump_enabled:1; unsigned long fadump_supported:1; unsigned long dump_active:1; + unsigned long dump_registered:1; };extern int early_init_dt_scan_fw_dump (unsigned long node,const char *uname,int depth,void *data);extern int fadump_reserve_mem (void ); +extern int setup_fadump (void ); +extern int is_fadump_active (void ); +#else /* CONFIG_FA_DUMP */ +static inline int is_fadump_active (void ) {return 0 ; }#endif #endif
arch/powerpc/kernel/fadump.c +349 -3
385 lines not on this page · raw message
arch/powerpc/kernel/iommu.c +7 -1
@@ -39,6 +39,7 @@#include <asm/pci-bridge.h> #include <asm/machdep.h> #include <asm/kdump.h> +#include <asm/fadump.h> #define DBG (...)
@@ -445,7 +446,12 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,static void iommu_table_clear (struct iommu_table *tbl) { -if (!is_kdump_kernel ()) { +/* +* In case of firmware assisted dump system goes through clean +* reboot process at the time of system crash. Hence it's safe to +* clear the TCE entries if firmware assisted dump is active. +*/ +if (!is_kdump_kernel () ||is_fadump_active ()) {/* Clear the table in case firmware left allocations in it */ ppc_md.tce_free (tbl, tbl->it_offset, tbl->it_size);return ;
arch/powerpc/mm/hash_utils_64.c +11 -0
@@ -55,6 +55,7 @@#include <asm/spu.h> #include <asm/udbg.h> #include <asm/code-patching.h> +#include <asm/fadump.h> #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)
@@ -625,6 +626,16 @@ static void __init htab_initialize(void)/* Using a hypervisor which owns the htab */ htab_address =NULL ; _SDR1 =0 ; +#ifdef CONFIG_FA_DUMP +/* +* If firmware assisted dump is active firmware preserves +* the contents of htab along with entire partition memory. +* Clear the htab if firmware assisted dump is active so +* that we dont end up using old mappings. +*/ +if (is_fadump_active () && ppc_md.hpte_clear_all) + ppc_md.hpte_clear_all (); +#endif }else {/* Find storage for the HPT. Must be contiguous in * the absolute address space. On cell we want it to be
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [RFC PATCH v7 03/10] fadump: Register for firmware assisted dump.
Quoted 10 lines · Mahesh J Salgaonkar
arch/powerpc/kernel/fadump.c +10
-0+/* +* Prepare for firmware-assisted dump. +*/ +int __init setup_fadump (void ) +{ +if (!fw_dump.fadump_supported) { +printk (KERN_ERR "Firmware-assisted dump is not supported on" +" this hardware\n" ); +return 0 ; + }
arch/powerpc/kernel/fadump.c static int __init early_fadump_reserve_mem(char *p) · line 592
Quoted 10 lines
arch/powerpc/kernel/fadump.c +10
-0+ +fadump_show_config (); +/* Initialize the kernel dump memory structure for FAD registration. */ +if (fw_dump.reserve_dump_area_size) +init_fadump_mem_struct (&fdm, fw_dump.reserve_dump_area_start); +fadump_init_files (); + +return 1 ; +} +subsys_initcall (setup_fadump);
If I have read the code correctly, we are going to get this printk on non-pSeries machines or on older pSeries machines, even if the user has not put the fadump=on option on the kernel command line. The printk will be annoying since there is no actual error condition. It seems to me that the condition for the printk should include fw_dump.fadump_enabled. In other words you should probably add
if (!fw_dump.fadump_enabled) return 0;
at the beginning of the function.
Paul.
Re: [UPDATED] [RFC PATCH v7 03/10] fadump: Register for firmware assisted dump.
Quoted 9 lines · Paul Mackerras
On Thu, Feb 16, 2012 at 04:44:30PM +0530, Mahesh J Salgaonkar wrote:
If I have read the code correctly, we are going to get this printk on non-pSeries machines or on older pSeries machines, even if the user has not put the fadump=on option on the kernel command line. The printk will be annoying since there is no actual error condition. It seems to me that the condition for the printk should include fw_dump.fadump_enabled. In other words you should probably add
Quoted 4 lines
if (!fw_dump.fadump_enabled) return 0;at the beginning of the function.
Hi Paul,
Thanks for pointing it out. Please find the updated patch below.
The existing patches above this (4/10 through 10/10) cleanly applies on this update.
Thanks,
-Mahesh.
---
From: Mahesh Salgaonkar <[email protected]>
This patch registers for firmware-assisted dump using rtas token ibm,configure-kernel-dump. During registration firmware is informed about the reserved area where it saves the CPU state data, HPTE table and contents of RMR region at the time of kernel crash. Apart from this, firmware also preserves the contents of entire partition memory even if it is not specified during registration.
This patch also populates sysfs files under /sys/kernel to display fadump status and reserved memory regions.
This patch introduces fadump_registered sysfs control file which will be used by kdump init scripts to start/stop firmware assisted dump. echo 1 to /sys/kernel/fadump_registered file for fadump registration and echo 0 to /sys/kernel/fadump_registered file for fadump un-registration.
--- arch/powerpc/include/asm/fadump.h | 57 ++++++ arch/powerpc/kernel/fadump.c | 355 +++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/iommu.c | 8 + arch/powerpc/mm/hash_utils_64.c | 11 + 4 files changed, 427 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fadump.h +57 -0
@@ -48,6 +48,58 @@#define FADUMP_HPTE_REGION 0x0002#define FADUMP_REAL_MODE_REGION 0x0011 +/* Dump request flag */ +#define FADUMP_REQUEST_FLAG 0x00000001 + +/* FAD commands */ +#define FADUMP_REGISTER 1 +#define FADUMP_UNREGISTER 2 +#define FADUMP_INVALIDATE 3 + +/* Kernel Dump section info */ +struct fadump_section { +u32 request_flag; +u16 source_data_type; +u16 error_flags; +u64 source_address; +u64 source_len; +u64 bytes_dumped; +u64 destination_address; +}; + +/* ibm,configure-kernel-dump header. */ +struct fadump_section_header { +u32 dump_format_version; +u16 dump_num_sections; +u16 dump_status_flag; +u32 offset_first_dump_section; + +/* Fields for disk dump option. */ +u32 dd_block_size; +u64 dd_block_offset; +u64 dd_num_blocks; +u32 dd_offset_disk_path; + +/* Maximum time allowed to prevent an automatic dump-reboot. */ +u32 max_time_auto; +}; + +/* +* Firmware Assisted dump memory structure. This structure is required for +* registering future kernel dump with power firmware through rtas call. +* +* No disk dump option. Hence disk dump path string section is not included. +*/ +struct fadump_mem_struct { +struct fadump_section_header header; + +/* Kernel dump sections */ +struct fadump_section cpu_state_data; +struct fadump_section hpte_region; +struct fadump_section rmr_region; +}; + +/* Firmware-assisted dump configuration details. */ struct fw_dump {unsigned long cpu_state_data_size;unsigned long hpte_region_size;
@@ -62,10 +114,15 @@ struct fw_dump { unsigned long fadump_enabled:1; unsigned long fadump_supported:1; unsigned long dump_active:1; + unsigned long dump_registered:1; };extern int early_init_dt_scan_fw_dump (unsigned long node,const char *uname,int depth,void *data);extern int fadump_reserve_mem (void ); +extern int setup_fadump (void ); +extern int is_fadump_active (void ); +#else /* CONFIG_FA_DUMP */ +static inline int is_fadump_active (void ) {return 0 ; }#endif #endif
arch/powerpc/kernel/fadump.c +352 -3
388 lines not on this page · raw message
arch/powerpc/kernel/iommu.c +7 -1
@@ -39,6 +39,7 @@#include <asm/pci-bridge.h> #include <asm/machdep.h> #include <asm/kdump.h> +#include <asm/fadump.h> #define DBG (...)
@@ -445,7 +446,12 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,static void iommu_table_clear (struct iommu_table *tbl) { -if (!is_kdump_kernel ()) { +/* +* In case of firmware assisted dump system goes through clean +* reboot process at the time of system crash. Hence it's safe to +* clear the TCE entries if firmware assisted dump is active. +*/ +if (!is_kdump_kernel () ||is_fadump_active ()) {/* Clear the table in case firmware left allocations in it */ ppc_md.tce_free (tbl, tbl->it_offset, tbl->it_size);return ;
arch/powerpc/mm/hash_utils_64.c +11 -0
@@ -55,6 +55,7 @@#include <asm/spu.h> #include <asm/udbg.h> #include <asm/code-patching.h> +#include <asm/fadump.h> #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)
@@ -625,6 +626,16 @@ static void __init htab_initialize(void)/* Using a hypervisor which owns the htab */ htab_address =NULL ; _SDR1 =0 ; +#ifdef CONFIG_FA_DUMP +/* +* If firmware assisted dump is active firmware preserves +* the contents of htab along with entire partition memory. +* Clear the htab if firmware assisted dump is active so +* that we dont end up using old mappings. +*/ +if (is_fadump_active () && ppc_md.hpte_clear_all) + ppc_md.hpte_clear_all (); +#endif }else {/* Find storage for the HPT. Must be contiguous in * the absolute address space. On cell we want it to be
Signature · 1 line
Mahesh J Salgaonkar
RFC PATCH v7 4/10 fadump: Initialize elfcore header and add PT_LOAD program headers.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
Build the crash memory range list by traversing through system memory during the first kernel before we register for firmware-assisted dump. After the successful dump registration, initialize the elfcore header and populate PT_LOAD program headers with crash memory ranges. The elfcore header is saved in the scratch area within the reserved memory. The scratch area starts at the end of the memory reserved for saving RMR region contents. The scratch area contains fadump crash info structure that contains magic number for fadump validation and physical address where the eflcore header can be found. This structure will also be used to pass some important crash info data to the second kernel which will help second kernel to populate ELF core header with correct data before it gets exported through /proc/vmcore. Since the firmware preserves the entire partition memory at the time of crash the contents of the scratch area will be preserved till second kernel boot.
Since the memory dump exported through /proc/vmcore is in ELF format similar to kdump, it will help us to reuse the kdump infrastructure for dump capture and filtering. Unlike phyp dump, userspace tool does not need to refer any sysfs interface while reading /proc/vmcore.
NOTE: The current design implementation does not address a possibility of introducing additional fields (in future) to this structure without affecting compatibility. It's on TODO list to come up with better approach to address this.
Reserved dump area start => +-------------------------------------+
| CPU state dump data |
+-------------------------------------+
| HPTE region data |
+-------------------------------------+
| RMR region data |
Scratch area start => +-------------------------------------+
| fadump crash info structure { |
| magic nummber |
+------|---- elfcorehdr_addr |
| | } |
+----> +-------------------------------------+
| ELF core header |
Reserved dump area end => +-------------------------------------+--- arch/powerpc/include/asm/fadump.h | 43 +++++++ arch/powerpc/kernel/fadump.c | 233 +++++++++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/fadump.h +43 -0
@@ -43,6 +43,12 @@#define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \ + (0x1UL << 26)) +#define memblock_num_regions (memblock_type) (memblock.memblock_type.cnt) + +#ifndef ELF_CORE_EFLAGS +#define ELF_CORE_EFLAGS 0 +#endif +/* Firmware provided dump sections */ #define FADUMP_CPU_STATE_DATA 0x0001#define FADUMP_HPTE_REGION 0x0002
@@ -56,6 +62,9 @@#define FADUMP_UNREGISTER 2#define FADUMP_INVALIDATE 3 +/* Dump status flag */ +#define FADUMP_ERROR_FLAG 0x2000 +/* Kernel Dump section info */ struct fadump_section {u32 request_flag;
@@ -109,6 +118,7 @@ struct fw_dump {/* cmd line option during boot */ unsigned long reserve_bootvar; +unsigned long fadumphdr_addr;int ibm_configure_kernel_dump; unsigned long fadump_enabled:1;
@@ -117,6 +127,39 @@ struct fw_dump { unsigned long dump_registered:1; }; +/* +* Copy the ascii values for first 8 characters from a string into u64 +* variable at their respective indexes. +* e.g. +* The string "FADMPINF" will be converted into 0x4641444d50494e46 +*/ +static inline u64 str_to_u64 (const char *str) +{ +u64 val =0 ; +int i; + +for (i =0 ; i <sizeof (val); i++) + val = (*str) ? (val <<8 ) | *str++ : val <<8 ; +return val; +} +#define STR_TO_HEX (x) str_to_u64(x) + +#define FADUMP_CRASH_INFO_MAGIC STR_TO_HEX("FADMPINF") + +/* fadump crash info structure */ +struct fadump_crash_info_header { +u64 magic_number; +u64 elfcorehdr_addr; +}; + +/* Crash memory ranges */ +#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2) + +struct fad_crash_memory_ranges { +unsigned long long base; +unsigned long long size; +}; +extern int early_init_dt_scan_fw_dump (unsigned long node,const char *uname,int depth,void *data);extern int fadump_reserve_mem (void );
arch/powerpc/kernel/fadump.c +232 -1
278 lines not on this page · raw message
RFC PATCH v7 5/10 fadump: Convert firmware-assisted cpu state dump data into elf notes.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
When registered for firmware assisted dump on powerpc, firmware preserves the registers for the active CPUs during a system crash. This patch reads the cpu register data stored in Firmware-assisted dump format (except for crashing cpu) and converts it into elf notes and updates the PT_NOTE program header accordingly. The exact register state for crashing cpu is saved to fadump crash info structure in scratch area during crash_fadump() and read during second kernel boot.
--- arch/powerpc/include/asm/fadump.h | 44 +++++ arch/powerpc/kernel/fadump.c | 314 ++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/setup-common.c | 6 + arch/powerpc/kernel/traps.c | 3 4 files changed, 365 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/fadump.h +44 -0
@@ -65,6 +65,18 @@/* Dump status flag */ #define FADUMP_ERROR_FLAG 0x2000 +#define FADUMP_CPU_ID_MASK ((1UL << 32) - 1) + +#define CPU_UNKNOWN (~((u32)0)) + +/* Utility macros */ +#define SKIP_TO_NEXT_CPU (reg_entry) \ +({ \ + while (reg_entry->reg_id != REG_ID("CPUEND")) \ + reg_entry++; \ + reg_entry++; \ +}) +/* Kernel Dump section info */ struct fadump_section {u32 request_flag;
@@ -119,6 +131,9 @@ struct fw_dump {unsigned long reserve_bootvar;unsigned long fadumphdr_addr; +unsigned long cpu_notes_buf; +unsigned long cpu_notes_buf_size; +int ibm_configure_kernel_dump; unsigned long fadump_enabled:1;
@@ -143,13 +158,40 @@ static inline u64 str_to_u64(const char *str)return val; }#define STR_TO_HEX (x) str_to_u64(x) +#define REG_ID (x) str_to_u64(x)#define FADUMP_CRASH_INFO_MAGIC STR_TO_HEX("FADMPINF") +#define REGSAVE_AREA_MAGIC STR_TO_HEX("REGSAVE") + +/* The firmware-assisted dump format. +* +* The register save area is an area in the partition's memory used to preserve +* the register contents (CPU state data) for the active CPUs during a firmware +* assisted dump. The dump format contains register save area header followed +* by register entries. Each list of registers for a CPU starts with +* "CPUSTRT" and ends with "CPUEND". +*/ + +/* Register save area header. */ +struct fadump_reg_save_area_header { +u64 magic_number; +u32 version; +u32 num_cpu_offset; +}; + +/* Register entry. */ +struct fadump_reg_entry { +u64 reg_id; +u64 reg_value; +};/* fadump crash info structure */ struct fadump_crash_info_header {u64 magic_number;u64 elfcorehdr_addr; +u32 crashing_cpu; +struct pt_regs regs; +struct cpumask cpu_online_mask; };/* Crash memory ranges */
@@ -165,7 +207,9 @@ extern int early_init_dt_scan_fw_dump(unsigned long node,extern int fadump_reserve_mem (void );extern int setup_fadump (void );extern int is_fadump_active (void ); +extern void crash_fadump (struct pt_regs *,const char *);#else /* CONFIG_FA_DUMP */ static inline int is_fadump_active (void ) {return 0 ; } +static inline void crash_fadump (struct pt_regs *regs,const char *str) { }#endif #endif
arch/powerpc/kernel/fadump.c +312 -2
360 lines not on this page · raw message
arch/powerpc/kernel/setup-common.c +6 -0
@@ -61,6 +61,7 @@#include <asm/xmon.h> #include <asm/cputhreads.h> #include <mm/mmu_decl.h> +#include <asm/fadump.h> #include "setup.h"
@@ -639,6 +640,11 @@ EXPORT_SYMBOL(check_legacy_ioport);static int ppc_panic_event (struct notifier_block *this,unsigned long event,void *ptr) { +/* +* If firmware-assisted dump has been registered then trigger +* firmware-assisted dump and let firmware handle everything else. +*/ +crash_fadump (NULL , ptr); ppc_md.panic (ptr);/* May not return */ return NOTIFY_DONE ; }
arch/powerpc/kernel/traps.c +3 -0
@@ -57,6 +57,7 @@#include <asm/kexec.h> #include <asm/ppc-opcode.h> #include <asm/rio.h> +#include <asm/fadump.h> #if defined(CONFIG_DEBUGGER ) || defined(CONFIG_KEXEC )int (*__debugger)(struct pt_regs *regs)__read_mostly ;
@@ -145,6 +146,8 @@ static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,arch_spin_unlock (&die_lock);raw_local_irq_restore (flags); +crash_fadump (regs,"die oops" ); +/* * A system reset (0x100) is a request to dump, so we always send * it through the crashdump code.
RFC PATCH v7 6/10 fadump: Add PT_NOTE program header for vmcoreinfo
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
Introduce a PT_NOTE program header that points to physical address of vmcoreinfo_note buffer declared in kernel/kexec.c. The vmcoreinfo note buffer is populated during crash_fadump() at the time of system crash.
--- arch/powerpc/kernel/fadump.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-)
arch/powerpc/kernel/fadump.c +29 -0
@@ -814,6 +814,19 @@ static void fadump_setup_crash_memory_ranges(void) } } +/* +* If the given physical address falls within the boot memory region then +* return the relocated address that points to the dump region reserved +* for saving initial boot memory contents. +*/ +static inline unsigned long fadump_relocate (unsigned long paddr) +{ +if (paddr >RMA_START && paddr < fw_dump.boot_memory_size) +return fdm.rmr_region.destination_address + paddr; +else +return paddr; +} +static int fadump_create_elfcore_headers (char *bufp) {struct elfhdr *elf;
@@ -845,6 +858,22 @@ static int fadump_create_elfcore_headers(char *bufp) (elf->e_phnum)++; +/* setup ELF PT_NOTE for vmcoreinfo */ + phdr = (struct elf_phdr *)bufp; + bufp +=sizeof (struct elf_phdr ); + phdr->p_type =PT_NOTE ; + phdr->p_flags =0 ; + phdr->p_vaddr =0 ; + phdr->p_align =0 ; + + phdr->p_paddr =fadump_relocate (paddr_vmcoreinfo_note ()); + phdr->p_offset = phdr->p_paddr; + phdr->p_memsz = vmcoreinfo_max_size; + phdr->p_filesz = vmcoreinfo_max_size; + +/* Increment number of program headers. */ + (elf->e_phnum)++; +/* setup PT_LOAD sections. */ for (i =0 ; i < crash_mem_ranges; i++) {
RFC PATCH v7 7/10 fadump: Introduce cleanup routine to invalidate /proc/vmcore.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
With the firmware-assisted dump support we don't require a reboot when we are in second kernel after crash. The second kernel after crash is a normal kernel boot and has knowledge about entire system RAM with the page tables initialized for entire system RAM. Hence once the dump is saved to disk, we can just release the reserved memory area for general use and continue with second kernel as production kernel.
Hence when we release the reserved memory that contains dump data, the '/proc/vmcore' will not be valid anymore. Hence this patch introduces a cleanup routine that invalidates and removes the /proc/vmcore file. This routine will be invoked before we release the reserved dump memory area.
--- fs/proc/vmcore.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
fs/proc/vmcore.c +23 -0
@@ -700,3 +700,26 @@ static int __init vmcore_init(void)return 0 ; }module_init (vmcore_init) + +/* Cleanup function for vmcore module. */ +void vmcore_cleanup(void) +{ +struct list_head *pos, *next; + +if (proc_vmcore) { +remove_proc_entry (proc_vmcore->name, proc_vmcore->parent); + proc_vmcore =NULL ; + } + +/* clear the vmcore list. */ +list_for_each_safe (pos, next, &vmcore_list) { +struct vmcore *m; + + m = list_entry(pos, struct vmcore, list); +list_del (&m->list); +kfree (m); + } +kfree (elfcorebuf); + elfcorebuf =NULL ; +} +EXPORT_SYMBOL_GPL (vmcore_cleanup);
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
RFC PATCH v7 8/10 fadump: Invalidate registration and release reserved memory for general use.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
This patch introduces an sysfs interface '/sys/kernel/fadump_release_mem' to invalidate the last fadump registration, invalidate '/proc/vmcore', release the reserved memory for general use and re-register for future kernel dump. Once the dump is copied to the disk, unlike phyp dump, the userspace tool can release all the memory reserved for dump with one single operation of echo 1 to '/sys/kernel/fadump_release_mem'.
Release the reserved memory region excluding the size of the memory required for future kernel dump registration. And therefore, unlike kdump, Fadump doesn't need a 2nd reboot to get back the system to the production configuration.
--- arch/powerpc/include/asm/fadump.h | 3 + arch/powerpc/kernel/fadump.c | 158 ++++++++++++++++++++++++++++++++++++- 2 files changed, 157 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/fadump.h +3 -0
@@ -208,6 +208,9 @@ extern int fadump_reserve_mem(void);extern int setup_fadump (void );extern int is_fadump_active (void );extern void crash_fadump (struct pt_regs *,const char *); +extern void fadump_cleanup (void ); + +extern void vmcore_cleanup (void );#else /* CONFIG_FA_DUMP */ static inline int is_fadump_active (void ) {return 0 ; }static inline void crash_fadump (struct pt_regs *regs,const char *str) { }
arch/powerpc/kernel/fadump.c +154 -4
206 lines not on this page · raw message
RFC PATCH v7 9/10 fadump: Invalidate the fadump registration during machine shutdown.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
If dump is active during system reboot, shutdown or halt then invalidate the fadump registration as it does not get invalidated automatically.
--- arch/powerpc/kernel/setup-common.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/powerpc/kernel/setup-common.c +8 -0
@@ -110,6 +110,14 @@ EXPORT_SYMBOL(ppc_do_canonicalize_irqs);/* also used by kexec */ void machine_shutdown (void ) { +#ifdef CONFIG_FA_DUMP +/* +* if fadump is active, cleanup the fadump registration before we +* shutdown. +*/ +fadump_cleanup (); +#endif +if (ppc_md.machine_shutdown) ppc_md.machine_shutdown (); }
RFC PATCH v7 10/10 fadump: Remove the phyp assisted dump code.
In reply to Mahesh J SalgaonkarFrom: Mahesh Salgaonkar <[email protected]>
Remove the phyp assisted dump implementation which is not is use.
--- Documentation/powerpc/phyp-assisted-dump.txt | 127 ------ arch/powerpc/Kconfig | 10 - arch/powerpc/include/asm/phyp_dump.h | 47 -- arch/powerpc/kernel/prom.c | 87 ---- arch/powerpc/platforms/pseries/Makefile | 1 arch/powerpc/platforms/pseries/phyp_dump.c | 513 -------------------------- 6 files changed, 0 insertions(+), 785 deletions(-) delete mode 100644 Documentation/powerpc/phyp-assisted-dump.txt delete mode 100644 arch/powerpc/include/asm/phyp_dump.h delete mode 100644 arch/powerpc/platforms/pseries/phyp_dump.c
Documentation/powerpc/phyp-assisted-dump.txt deleted +0 -127
@@ -1,127 +0,0 @@ - - Hypervisor-Assisted Dump - ------------------------ - November 2007 - -The goal of hypervisor-assisted dump is to enable the dump of -a crashed system, and to do so from a fully-reset system, and -to minimize the total elapsed time until the system is back -in production use. - -As compared to kdump or other strategies, hypervisor-assisted -dump offers several strong, practical advantages: - --- Unlike kdump, the system has been reset, and loaded - with a fresh copy of the kernel. In particular, - PCI and I/O devices have been reinitialized and are - in a clean, consistent state. --- As the dump is performed, the dumped memory becomes - immediately available to the system for normal use. --- After the dump is completed, no further reboots are - required; the system will be fully usable, and running - in its normal, production mode on its normal kernel. - -The above can only be accomplished by coordination with, -and assistance from the hypervisor. The procedure is -as follows: - --- When a system crashes, the hypervisor will save - the low 256MB of RAM to a previously registered - save region. It will also save system state, system - registers, and hardware PTE's. - --- After the low 256MB area has been saved, the - hypervisor will reset PCI and other hardware state. - It will *not* clear RAM. It will then launch the - bootloader, as normal. - --- The freshly booted kernel will notice that there - is a new node (ibm,dump-kernel) in the device tree, - indicating that there is crash data available from - a previous boot. It will boot into only 256MB of RAM, - reserving the rest of system memory. - --- Userspace tools will parse /sys/kernel/release_region - and read /proc/vmcore to obtain the contents of memory, - which holds the previous crashed kernel. The userspace - tools may copy this info to disk, or network, nas, san, - iscsi, etc. as desired. - - For Example: the values in /sys/kernel/release-region - would look something like this (address-range pairs). - CPU:0x177fee000-0x10000: HPTE:0x177ffe020-0x1000: / - DUMP:0x177fff020-0x10000000, 0x10000000-0x16F1D370A - --- As the userspace tools complete saving a portion of - dump, they echo an offset and size to - /sys/kernel/release_region to release the reserved - memory back to general use. - - An example of this is: - "echo 0x40000000 0x10000000 > /sys/kernel/release_region" - which will release 256MB at the 1GB boundary. - -Please note that the hypervisor-assisted dump feature -is only available on Power6-based systems with recent -firmware versions. - -Implementation details: ----------------------- - -During boot, a check is made to see if firmware supports -this feature on this particular machine. If it does, then -we check to see if a active dump is waiting for us. If yes -then everything but 256 MB of RAM is reserved during early -boot. This area is released once we collect a dump from user -land scripts that are run. If there is dump data, then -the /sys/kernel/release_region file is created, and -the reserved memory is held. - -If there is no waiting dump data, then only the highest -256MB of the ram is reserved as a scratch area. This area -is *not* released: this region will be kept permanently -reserved, so that it can act as a receptacle for a copy -of the low 256MB in the case a crash does occur. See, -however, "open issues" below, as to whether -such a reserved region is really needed. - -Currently the dump will be copied from /proc/vmcore to a -a new file upon user intervention. The starting address -to be read and the range for each data point in provided -in /sys/kernel/release_region. - -The tools to examine the dump will be same as the ones -used for kdump. - -General notes: --------------- -Security: please note that there are potential security issues -with any sort of dump mechanism. In particular, plaintext -(unencrypted) data, and possibly passwords, may be present in -the dump data. Userspace tools must take adequate precautions to -preserve security. - -Open issues/ToDo: ------------- - o The various code paths that tell the hypervisor that a crash - occurred, vs. it simply being a normal reboot, should be - reviewed, and possibly clarified/fixed. - - o Instead of using /sys/kernel, should there be a /sys/dump - instead? There is a dump_subsys being created by the s390 code, - perhaps the pseries code should use a similar layout as well. - - o Is reserving a 256MB region really required? The goal of - reserving a 256MB scratch area is to make sure that no - important crash data is clobbered when the hypervisor - save low mem to the scratch area. But, if one could assure - that nothing important is located in some 256MB area, then - it would not need to be reserved. Something that can be - improved in subsequent versions. - - o Still working the kdump team to integrate this with kdump, - some work remains but this would not affect the current - patches. - - o Still need to write a shell script, to copy the dump away. - Currently I am parsing it manually.
arch/powerpc/Kconfig +0 -10
@@ -376,16 +376,6 @@ config CRASH_DUMP The same kernel binary can be used as production kernel and dump capture kernel. -config PHYP_DUMP - bool "Hypervisor-assisted dump (EXPERIMENTAL)" - depends on PPC_PSERIES && EXPERIMENTAL - help - Hypervisor-assisted dump is meant to be a kdump replacement - offering robustness and speed not possible without system - hypervisor assistance. - - If unsure, say "N" - config FA_DUMP bool "Firmware-assisted dump" depends on PPC64 && PPC_RTAS && CRASH_DUMP
arch/powerpc/include/asm/phyp_dump.h deleted +0 -47
47 lines not on this page · raw message
arch/powerpc/kernel/prom.c +0 -87
111 lines not on this page · raw message
arch/powerpc/platforms/pseries/Makefile +0 -1
@@ -18,7 +18,6 @@ obj-$(CONFIG_MEMORY_HOTPLUG) += hotplug-memory.o obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o obj-$(CONFIG_HVCS) += hvcserver.o obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o -obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o obj-$(CONFIG_CMM) += cmm.o obj-$(CONFIG_DTL) += dtl.o obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
arch/powerpc/platforms/pseries/phyp_dump.c deleted +0 -513
513 lines not on this page · raw message
Quoted 6 lines · Mahesh J Salgaonkar
Please find the version 7 of the patchset that implements firmware-assisted dump mechanism to capture kernel crash dump for Powerpc architecture. Firmware-assisted dump is a robust mechanism to get reliable kernel crash dump with the assistance of firmware. This approach does not use kexec, instead firmware assists in booting the kdump kernel while preserving memory contents.
For the series:
I think it's pretty much good enough to go in now. I have one relatively minor comment about a printk which could be addressed if you decide to do another version of the series.
Paul.