Remove legacy kdump kernel build support
Subsystems (4)
PATCH 1/1 Remove legacy kdump kernel build support
Remove legacy kdump kernel build support
This patch removes legacy kdump kernel build support(i.e compiling a kdump kernel at a fixed hardcoded address 32MB). With the relocatable kernel support its now possible to use the regular kernel binary for capturing the dump also. Relocatable kdump kernel does not require trampoline code for exception handlers. It removes kdump.h as most of the macros defined in kdump.h are not used any more. Also the relocatable kdump kernel allows us to load kdump kernel any where as specified by crashkernel parameter instead of hardcoded address 32MB.
--- arch/powerpc/Kconfig | 2 - arch/powerpc/include/asm/iommu.h | 5 ++++ arch/powerpc/include/asm/kdump.h | 35 ------------------------------ arch/powerpc/include/asm/page.h | 1 - arch/powerpc/kernel/crash.c | 1 - arch/powerpc/kernel/crash_dump.c | 40 ----------------------------------- arch/powerpc/kernel/iommu.c | 1 - arch/powerpc/kernel/machine_kexec.c | 5 ---- arch/powerpc/kernel/prom.c | 2 - arch/powerpc/kernel/setup_64.c | 3 -- 10 files changed, 5 insertions(+), 90 deletions(-) delete mode 100644 arch/powerpc/include/asm/kdump.h
arch/powerpc/Kconfig +0 -2
@@ -824,11 +824,9 @@ config PAGE_OFFSET default "0xc000000000000000" config KERNEL_START hex - default "0xc000000002000000" if CRASH_DUMP default "0xc000000000000000" config PHYSICAL_START hex - default "0x02000000" if CRASH_DUMP default "0x00000000" endif
arch/powerpc/include/asm/iommu.h +5 -0
@@ -35,6 +35,11 @@#define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1))#define IOMMU_PAGE_ALIGN (addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE) +#ifdef CONFIG_CRASH_DUMP +#define KDUMP_MIN_TCE_ENTRIES 2048 +extern unsigned long long __kdump_flag; +#endif +/* Boot time flags */ extern int iommu_is_off;extern int iommu_force_on;
arch/powerpc/include/asm/kdump.h deleted +0 -35
@@ -1,35 +0,0 @@ -#ifndef _PPC64_KDUMP_H -#define _PPC64_KDUMP_H - -/* Kdump kernel runs at 32 MB, change at your peril. */ -#define KDUMP_KERNELBASE 0x2000000 - -/* How many bytes to reserve at zero for kdump. The reserve limit should -* be greater or equal to the trampoline's end address. -* Reserve to the end of the FWNMI area, see head_64.S */ -#define KDUMP_RESERVE_LIMIT 0x10000/* 64K */ - -#ifdef CONFIG_CRASH_DUMP - -#define KDUMP_TRAMPOLINE_START 0x0100 -#define KDUMP_TRAMPOLINE_END 0x3000 - -#define KDUMP_MIN_TCE_ENTRIES 2048 - -#endif /* CONFIG_CRASH_DUMP */ - -#ifndef __ASSEMBLY__ -#ifdef CONFIG_CRASH_DUMP - -extern void reserve_kdump_trampoline (void ); -extern void setup_kdump_trampoline (void ); - -#else /* !CONFIG_CRASH_DUMP */ - -static inline void reserve_kdump_trampoline (void ) { ; } -static inline void setup_kdump_trampoline (void ) { ; } - -#endif /* CONFIG_CRASH_DUMP */ -#endif /* __ASSEMBLY__ */ - -#endif /* __PPC64_KDUMP_H */
arch/powerpc/include/asm/page.h +0 -1
@@ -11,7 +11,6 @@*/ #include <asm/asm-compat.h> -#include <asm/kdump.h> #include <asm/types.h> /*
arch/powerpc/kernel/crash.c +0 -1
@@ -29,7 +29,6 @@#include <asm/processor.h> #include <asm/machdep.h> #include <asm/kexec.h> -#include <asm/kdump.h> #include <asm/prom.h> #include <asm/firmware.h> #include <asm/smp.h>
arch/powerpc/kernel/crash_dump.c +0 -40
@@ -15,7 +15,6 @@#include <linux/bootmem.h> #include <linux/lmb.h> #include <asm/code-patching.h> -#include <asm/kdump.h> #include <asm/prom.h> #include <asm/firmware.h> #include <asm/uaccess.h>
@@ -27,45 +26,6 @@ #define DBG(fmt...)#endif -void __init reserve_kdump_trampoline (void ) -{ -lmb_reserve (0 ,KDUMP_RESERVE_LIMIT ); -} - -static void __init create_trampoline (unsigned long addr) -{ -unsigned int *p = (unsigned int *)addr; - -/* The maximum range of a single instruction branch, is the current -* instruction's address + (32 MB - 4) bytes. For the trampoline we -* need to branch to current address + 32 MB. So we insert a nop at -* the trampoline address, then the next instruction (+ 4 bytes) -* does a branch to (32 MB - 4). The net effect is that when we -* branch to "addr" we jump to ("addr" + 32 MB). Although it requires -* two instructions it doesn't require any registers. -*/ -patch_instruction (p,PPC_NOP_INSTR ); -patch_branch (++p, addr +PHYSICAL_START ,0 ); -} - -void __init setup_kdump_trampoline (void ) -{ -unsigned long i; - -DBG (" -> setup_kdump_trampoline()\n" ); - -for (i =KDUMP_TRAMPOLINE_START ; i <KDUMP_TRAMPOLINE_END ; i +=8 ) { -create_trampoline (i); - } - -#ifdef CONFIG_PPC_PSERIES -create_trampoline (__pa (system_reset_fwnmi) -PHYSICAL_START ); -create_trampoline (__pa (machine_check_fwnmi) -PHYSICAL_START ); -#endif /* CONFIG_PPC_PSERIES */ - -DBG (" <- setup_kdump_trampoline()\n" ); -} -#ifdef CONFIG_PROC_VMCORE static int __init parse_elfcorehdr (char *p) {
arch/powerpc/kernel/iommu.c +0 -1
@@ -37,7 +37,6 @@#include <asm/iommu.h> #include <asm/pci-bridge.h> #include <asm/machdep.h> -#include <asm/kdump.h> #define DBG (...)
arch/powerpc/kernel/machine_kexec.c +0 -5
@@ -88,11 +88,6 @@ void __init reserve_crashkernel(void) crash_size = crashk_res.end - crashk_res.start +1 ; -if (crashk_res.start !=KDUMP_KERNELBASE ) -printk ("Crash kernel location must be 0x%x\n" , -KDUMP_KERNELBASE ); - - crashk_res.start =KDUMP_KERNELBASE ; crash_size =PAGE_ALIGN (crash_size); crashk_res.end = crashk_res.start + crash_size -1 ;
arch/powerpc/kernel/prom.c +0 -2
@@ -39,7 +39,6 @@#include <asm/processor.h> #include <asm/irq.h> #include <asm/io.h> -#include <asm/kdump.h> #include <asm/smp.h> #include <asm/system.h> #include <asm/mmu.h>
@@ -1195,7 +1194,6 @@ void __init early_init_devtree(void *params)/* If relocatable, reserve first 32k for interrupt vectors etc. */ if (PHYSICAL_START >MEMORY_START )lmb_reserve (MEMORY_START ,0x8000 ); -reserve_kdump_trampoline ();reserve_crashkernel ();early_reserve_mem ();phyp_dump_reserve_mem ();
arch/powerpc/kernel/setup_64.c +0 -3
@@ -36,7 +36,6 @@#include <linux/lockdep.h> #include <linux/lmb.h> #include <asm/io.h> -#include <asm/kdump.h> #include <asm/prom.h> #include <asm/processor.h> #include <asm/pgtable.h>
@@ -209,8 +208,6 @@ void __init early_setup(unsigned long dt_ptr)/* Probe the machine type */ probe_machine (); -setup_kdump_trampoline (); -DBG ("Found, Initializing memory management...\n" );/*
Signature · 7 lines
1.5.5.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/2 Support for relocatable kdump kernel
Support for relocatable kdump kernel
This patch adds relocatable kernel support for kdump. With this one can use the same regular kernel to capture the kdump. A signature (0xfeed1234) is passed in r8 from panic code to the next kernel through kexec_sequence and purgatory code. The signature is used to differentiate between relocatable kdump kernel and non-kdump kernels.
The purgatory code compares the signature and sets the __kdump_flag in head_64.S. During the boot up, kernel code checks __kdump_flag and if it is set, the kernel will behave as relocatable kdump kernel. This kernel will boot at the address where it was loaded by kexec-tools ie at the address reserved through crashkernel boot parameter.
Now for kdump, both CONFIG_RELOCATABLE and CONFIG_CRASH_DUMP should be enabled and the same kernel can be used as production and kdump kernel.
--- Documentation/kdump/kdump.txt | 17 +++++++-- arch/powerpc/include/asm/kexec.h | 6 +++ arch/powerpc/kernel/head_64.S | 60 +++++++++++++++++++++++++++++--- arch/powerpc/kernel/iommu.c | 2 +- arch/powerpc/kernel/machine_kexec_64.c | 12 ++++-- arch/powerpc/kernel/misc_64.S | 10 ++++-- 6 files changed, 90 insertions(+), 17 deletions(-)
Documentation/kdump/kdump.txt +13 -4
@@ -104,12 +104,14 @@ Build the system and dump-capture kernels There are two possible methods of using Kdump. 1) Build a separate custom dump-capture kernel for capturing the - kernel core dump. + kernel core dump. Legacy kdump kernel build support(i.e separate kdump + kernel) for ppc64 is not available. 2) Or use the system kernel binary itself as dump-capture kernel and there is no need to build a separate dump-capture kernel. This is possible only with the architecutres which support a relocatable kernel. As - of today, i386, x86_64 and ia64 architectures support relocatable kernel. + of today, i386, x86_64, ppc64 and ia64 architectures support relocatable + kernel. Building a relocatable kernel is advantageous from the point of view that one does not have to build a second kernel for capturing the dump. But
@@ -207,8 +209,15 @@ Dump-capture kernel config options (Arch Dependent, i386 and x86_64) Dump-capture kernel config options (Arch Dependent, ppc64) ---------------------------------------------------------- -* Make and install the kernel and its modules. DO NOT add this kernel - to the boot loader configuration files. +1) Enable "Build a kdump crash kernel" support under "Kernel" options: + + CONFIG_CRASH_DUMP=y + +2) Enable "Build a relocatable kernel" support + + CONFIG_RELOCATABLE=y + + Make and install the kernel and its modules. Dump-capture kernel config options (Arch Dependent, ia64) ----------------------------------------------------------
arch/powerpc/include/asm/kexec.h +6 -0
@@ -24,6 +24,12 @@#define KEXEC_CONTROL_PAGE_SIZE 4096 +/* +* Used to differentiate between relocatable kdump kernel and other +* kernels +*/ +#define KDUMP_SIGNATURE 0xfeed1234 +/* The native architecture */ #ifdef __powerpc64__#define KEXEC_ARCH KEXEC_ARCH_PPC64
arch/powerpc/kernel/head_64.S +55 -5
93 lines not on this page · raw message
arch/powerpc/kernel/iommu.c +1 -1
@@ -493,7 +493,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)spin_lock_init (&tbl->it_lock);#ifdef CONFIG_CRASH_DUMP -if (ppc_md.tce_get) { +if (ppc_md.tce_get && __kdump_flag) {unsigned long index;unsigned long tceval;unsigned long tcecount =0 ;
arch/powerpc/kernel/machine_kexec_64.c +8 -4
@@ -255,11 +255,13 @@ static union thread_union kexec_stack/* Our assembly helper, in kexec_stub.S */ extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start, void *image, void *control, - void (*clear_all)(void)) ATTRIB_NORET; + void (*clear_all)(void), + unsigned long long kdump_flag) ATTRIB_NORET;/* too late to fail here */ void default_machine_kexec (struct kimage *image) { +unsigned long long kdump_flag =0 ;/* prepare control code if any */ /*
@@ -270,8 +272,10 @@ void default_machine_kexec(struct kimage *image)* using debugger IPI. */ -if (crashing_cpu ==-1 ) -kexec_prepare_cpus (); +if (crashing_cpu ==-1 ) +kexec_prepare_cpus (); +else + kdump_flag =KDUMP_SIGNATURE ;/* switch to a staticly allocated stack. Based on irq stack code. * XXX: the task struct will likely be invalid once we do the copy!
@@ -284,7 +288,7 @@ void default_machine_kexec(struct kimage *image)*/ kexec_sequence (&kexec_stack, image->start, image,page_address (image->control_code_page), - ppc_md.hpte_clear_all); + ppc_md.hpte_clear_all, kdump_flag);/* NOTREACHED */ }
arch/powerpc/kernel/misc_64.S +7 -3
@@ -609,10 +609,13 @@ real_mode: /* assume normal blr return */ /* - * kexec_sequence(newstack, start, image, control, clear_all()) + * kexec_sequence(newstack, start, image, control, clear_all(), kdump_flag) * * does the grungy work with stack switching and real mode switches * also does simple calls to other code + * + * kdump_flag says whether the next kernel should be running at the reserved + * load address as needed for relocatable kdump kernel */ _GLOBAL(kexec_sequence)
@@ -645,7 +648,7 @@ _GLOBAL(kexec_sequence) mr r29,r5 /* image (virt) */ mr r28,r6 /* control, unused */ mr r27,r7 /* clear_all() fn desc */ - mr r26,r8 /* spare */ + mr r26,r8 /* kdump flag */ lhz r25,PACAHWCPUID(r13) /* get our phys cpu from paca */ /* disable interrupts, we are overwriting kernel data next */
@@ -707,5 +710,6 @@ _GLOBAL(kexec_sequence) mr r4,r30 # start, aka phys mem offset mtlr 4 li r5,0 - blr /* image->start(physid, image->start, 0); */ + mr r6,r26 /* kdump_flag */ + blr /* image->start(physid, image->start, 0, kdump_flag); */ #endif /* CONFIG_KEXEC */
Signature · 7 lines
1.5.5.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 10 lines · Mohan Kumar M
Remove legacy kdump kernel build support
This patch removes legacy kdump kernel build support(i.e compiling a kdump kernel at a fixed hardcoded address 32MB). With the relocatable kernel support its now possible to use the regular kernel binary for capturing the dump also. Relocatable kdump kernel does not require trampoline code for exception handlers. It removes
kdump.has most of the macros defined inkdump.hare not used any more. Also the relocatable kdump kernel allows us to load kdump kernel any where as specified by crashkernel parameter instead of hardcoded address 32MB.
Can we leave the legacy support for a while? On PPC32 we don't have the relocatable kernel support, but we have kdump patches floating around[1], and they use the `hard-coded values' approach, so far.
I'm not sure if anybody is currently working on a PPC32 kernel relocation support.. but for sure it will take some time to implement.
Thanks,
[1] http://ozlabs.org/pipermail/linuxppc-dev/2008-August/061161.html
Signature · 8 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 3 lines · Anton Vorontsov
Quoted 2 lines · Mohan Kumar M
Remove legacy kdump kernel build support
Hi,
I have submitted the patch to support relocatable kdump kernel with retaining legacy kdump build support.
Regards,
Mohan.
Quoted 5 lines
Can we leave the legacy support for a while? On PPC32 we don't have the relocatable kernel support, but we have kdump patches floating around[1], and they use the `hard-coded values' approach, so far.
Quoted 7 lines
I'm not sure if anybody is currently working on a PPC32 kernel relocation support.. but for sure it will take some time to implement.
Thanks,
[1] http://ozlabs.org/pipermail/linuxppc-dev/2008-August/061161.html
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec