Ia64 kdump patch
The ia64 kdump patch is in 2 parts.
the kexec-kdump-ia64-2.6.16.patch should apply on top of the previous kexec patch by Khalid in Tony's test tree.
the kexec-tools-kdump-ia64.patch should apply to kexec-tools-1.101 with kexec-tools-1.101-kdump.patch
To test it.
Build first SMP kernel with KEXEC and KDUMP enabled.
Boot it with kernel parameter "crashkernel=XXX@YYY" means reserver XXX from YYY for crashdumping. Build an UP kernel with KEXEC KDUMP VMCORE enabled. load this kernel as a crashdumping kernel kexec -p vmlinux.gz --initrd=initrd --append="...."
trigger a crash,
maybe "echo c > /proc/sysrq-trigger"
after the crash kernel boots,
cp /proc/vmcore core
gdb first_kernel_vmlinux core
please test and review.
arch/ia64/hp/common/sba_iommu.c +22 -0
@@ -1624,6 +1624,28 @@ ioc_iova_init(struct ioc *ioc)READ_REG (ioc->ioc_hpa +IOC_IBASE ); } +#ifdef CONFIG_KEXEC +void +ioc_iova_disable (void ) +{ +struct ioc *ioc; + + ioc = ioc_list; + +while (ioc !=NULL ) { +/* Disable IOVA translation */ +WRITE_REG (ioc->ibase &0xfffffffffffffffe , ioc->ioc_hpa +IOC_IBASE ); +READ_REG (ioc->ioc_hpa +IOC_IBASE ); + +/* Clear I/O TLB of any possible entries */ +WRITE_REG (ioc->ibase | (get_iovp_order (ioc->iov_size) + iovp_shift), ioc->ioc_hpa +IOC_PCOM ); +READ_REG (ioc->ioc_hpa +IOC_PCOM ); + + ioc = ioc->next; + } +} +#endif +static void __init ioc_resource_init (struct ioc *ioc) {
arch/ia64/Kconfig +23 -0
@@ -376,6 +376,29 @@ config IA64_PALINFO config SGI_SN def_bool y if (IA64_SGI_SN2 || IA64_GENERIC) +config KEXEC + bool "kexec system call (EXPERIMENTAL)" + depends on EXPERIMENTAL + help + kexec is a system call that implements the ability to shutdown your + current kernel, and to start another kernel. It is like a reboot + but it is indepedent of the system firmware. And like a reboot + you can start any kernel with it, not just Linux. + + The name comes from the similiarity to the exec system call. + + It is an ongoing process to be certain the hardware in a machine + is properly shutdown, so do not be surprised if this code does not + initially work for you. It may help to enable device hotplugging + support. As of this writing the exact hardware interface is + strongly in flux, so no good recommendation can be made. + +config CRASH_DUMP + bool "kernel crash dumps (EXPERIMENTAL)" + depends on EXPERIMENTAL + help + Generate crash dump after being started by kexec. + source "drivers/firmware/Kconfig" source "fs/Kconfig.binfmt"
arch/ia64/kernel/crash.c +152 -0
152 lines not on this page · raw message
arch/ia64/kernel/efi.c +14 -3
@@ -25,6 +25,7 @@#include <linux/types.h> #include <linux/time.h> #include <linux/efi.h> +#include <linux/kexec.h> #include <asm/io.h> #include <asm/kregs.h>
@@ -40,7 +41,7 @@ extern efi_status_t efi_call_phys (voidstruct efi efi;EXPORT_SYMBOL (efi);static efi_runtime_services_t *runtime; -static unsigned long mem_limit = ~0UL , max_addr = ~0UL ; +static unsigned long mem_limit = ~0UL , max_addr = ~0UL , min_addr =0UL ; #define efi_call_virt(f, args...) (*(f))(args)
@@ -420,6 +421,8 @@ efi_init (void) mem_limit =memparse (cp +4 , &cp); }else if (memcmp (cp,"max_addr=" ,9 ) ==0 ) { max_addr =GRANULEROUNDDOWN (memparse (cp +9 , &cp)); + }else if (memcmp (cp,"min_addr=" ,9 ) ==0 ) { + min_addr =GRANULEROUNDDOWN (memparse (cp +9 , &cp)); }else {while (*cp !=' ' && *cp) ++cp;
@@ -427,6 +430,8 @@ efi_init (void) ++cp; } } +if (min_addr !=0UL ) +printk (KERN_INFO "Ignoring memory below %luMB\n" , min_addr >>20 );if (max_addr != ~0UL )printk (KERN_INFO "Ignoring memory above %luMB\n" , max_addr >>20 );
@@ -839,7 +844,8 @@ find_memmap_space (void) as =max (contig_low, md->phys_addr); ae =min (contig_high,efi_md_end (md)); -/* keep within max_addr= command line arg */ +/* keep within max_addr= and min_addr= command line arg */ + as =max (as, min_addr); ae =min (ae, max_addr);if (ae <= as)continue ;
@@ -949,7 +955,8 @@ efi_memmap_init(unsigned long *s, unsign }else ae =efi_md_end (md); -/* keep within max_addr= command line arg */ +/* keep within max_addr= and min_addr= command line arg */ + as =max (as, min_addr); ae =min (ae, max_addr);if (ae <= as)continue ;
@@ -1061,6 +1068,10 @@ efi_initialize_iomem_resources(struct re*/ insert_resource (res, code_resource);insert_resource (res, data_resource); +#ifdef CONFIG_KEXEC +if (crashk_res.end > crashk_res.start) +insert_resource (res, &crashk_res); +#endif } } }
arch/ia64/kernel/entry.S +1 -1
@@ -1590,7 +1590,7 @@ sys_call_table: data8 sys_mq_timedreceive // 1265 data8 sys_mq_notify data8 sys_mq_getsetattr - data8 sys_ni_syscall // reserved for kexec_load + data8 sys_kexec_load data8 sys_ni_syscall // reserved for vserver data8 sys_waitid // 1270 data8 sys_add_key
arch/ia64/kernel/machine_kexec.c +115 -0
115 lines not on this page · raw message
arch/ia64/kernel/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_IA64_CYCLONE) += cyclone.o obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o +obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o mca_recovery-y += mca_drv.o mca_drv_asm.o
arch/ia64/kernel/relocate_kernel.S +353 -0
353 lines not on this page · raw message
arch/ia64/kernel/setup.c +38 -0
@@ -44,6 +44,8 @@#include <linux/platform.h> #include <linux/pm.h> #include <linux/cpufreq.h> +#include <linux/kexec.h> +#include <linux/crash_dump.h> #include <asm/ia32.h> #include <asm/machvec.h>
@@ -251,6 +253,32 @@ reserve_memory (void) }#endif +#ifdef CONFIG_KEXEC +/* crashkernel=size@addr specifies the location to reserve for +* a crash kernel. By reserving this memory we guarantee +* that linux never set's it up as a DMA target. +* Useful for holding code to do something appropriate +* after a kernel panic. +*/ + { +char *from =strstr (saved_command_line,"crashkernel=" ); +if (from) { +unsigned long size, base; + size =memparse (from +12 , &from); +if (*from =='@' ) { + base =memparse (from +1 , &from); + rsvd_region[n].start = + (unsigned long )__va (base); + rsvd_region[n].end = + (unsigned long )__va (base + size); + crashk_res.start = base; + crashk_res.end = base + size -1 ; + n++; + } + } + } +#endif +efi_memmap_init (&rsvd_region[n].start, &rsvd_region[n].end); n++;
@@ -496,6 +524,16 @@ setup_arch (char **cmdline_p)if (!strstr (saved_command_line,"nomca" ))ia64_mca_init (); +#ifdef CONFIG_CRASH_DUMP + { +char *from =strstr (saved_command_line,"elfcorehdr=" ); + +if (from) + elfcorehdr_addr =memparse (from+11 , &from); + saved_max_pfn = (unsigned long )-1 ; + } +#endif +platform_setup (cmdline_p);paging_init (); }
arch/ia64/kernel/smp.c +29 -0
@@ -30,6 +30,7 @@#include <linux/delay.h> #include <linux/efi.h> #include <linux/bitops.h> +#include <linux/kexec.h> #include <asm/atomic.h> #include <asm/current.h>
@@ -84,6 +85,34 @@ unlock_ipi_calllock(void)spin_unlock_irq (&call_lock); } +#ifdef CONFIG_KEXEC +/* +* Stop the CPU and put it in fake SAL rendezvous. This allows CPU to wake +* up with IPI from boot processor +*/ +void +kexec_stop_this_cpu (void *func) +{ +unsigned long pta, impl_va_bits, pal_base; + +/* +* Remove this CPU by putting it into fake SAL rendezvous +*/ +cpu_clear (smp_processor_id (), cpu_online_map); +max_xtp (); +ia64_eoi (); + +/* Disable VHPT */ + impl_va_bits =ffz (~(local_cpu_data->unimpl_va_mask | (7UL <<61 ))); + pta =POW2 (61 ) -POW2 (vmlpt_bits); +ia64_set_pta (pta | (0 <<8 ) | (vmlpt_bits <<2 ) |0 ); + +local_irq_disable (); + pal_base =__get_cpu_var (ia64_mca_pal_base); +kexec_fake_sal_rendez (func, ap_wakeup_vector, pal_base); +} +#endif +static void stop_this_cpu (void ) {
include/asm-ia64/kexec.h +34 -0
@@ -0,0 +1,34 @@ +#ifndef _ASM_IA64_KEXEC_H +#define _ASM_IA64_KEXEC_H + + +/* Maximum physical address we can use pages from */ +#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) +/* Maximum address we can reach in physical address mode */ +#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) +/* Maximum address we can use for the control code buffer */ +#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE + +#define KEXEC_CONTROL_CODE_SIZE (8192 + 8192 + 4096) + +/* The native architecture */ +#define KEXEC_ARCH KEXEC_ARCH_IA_64 + +#define MAX_NOTE_BYTES 1024 + +#define pte_bits 3 +#define vmlpt_bits (impl_va_bits - PAGE_SHIFT + pte_bits) +#define POW2 (n) (1ULL << (n)) + +DECLARE_PER_CPU (u64, ia64_mca_pal_base); +const extern unsigned int relocate_new_kernel_size; +volatile extern long kexec_rendez; +extern void relocate_new_kernel (unsigned long ,unsigned long , +struct ia64_boot_param *,unsigned long ); +extern void kexec_fake_sal_rendez (void *start,unsigned long wake_up, +unsigned long pal_base); +static inline void +crash_setup_regs (struct pt_regs *newregs,struct pt_regs *oldregs) +{ +} +#endif /* _ASM_IA64_KEXEC_H */
include/asm-ia64/machvec_hpzx1.h +2 -0
@@ -34,4 +34,6 @@ extern ia64_mv_dma_mapping_error sba_dma#define platform_dma_supported sba_dma_supported#define platform_dma_mapping_error sba_dma_mapping_error +extern void ioc_iova_disable (void ); +#endif /* _ASM_IA64_MACHVEC_HPZX1_h */
include/asm-ia64/meminit.h +2 -1
@@ -16,11 +16,12 @@* - initrd (optional) * - command line string * - kernel code & data +* - crash dumping code reserved region * - Kernel memory map built from EFI memory map * * More could be added if necessary */ -#define IA64_MAX_RSVD_REGIONS 6 +#define IA64_MAX_RSVD_REGIONS 7struct rsvd_region {unsigned long start;/* virtual address of beginning of element */
include/asm-ia64/smp.h +3 -0
@@ -129,6 +129,9 @@ extern void smp_send_reschedule (int cpuextern void lock_ipi_calllock (void );extern void unlock_ipi_calllock (void );extern void identify_siblings (struct cpuinfo_ia64 *); +#ifdef CONFIG_KEXEC +extern void kexec_stop_this_cpu (void *); +#endif #else
include/linux/irq.h +1 -0
@@ -94,6 +94,7 @@ irq_descp (int irq)#include <asm/hw_irq.h> /* the arch dependent stuff */ extern int setup_irq (unsigned int irq,struct irqaction * new); +extern void terminate_irqs (void );#ifdef CONFIG_GENERIC_HARDIRQS extern cpumask_t irq_affinity[NR_IRQS ];
kernel/irq/manage.c +19 -0
@@ -377,3 +377,22 @@ int request_irq(unsigned int irq,EXPORT_SYMBOL (request_irq); +/* +* Terminate any outstanding interrupts +*/ +void terminate_irqs (void ) +{ +struct irqaction * action; +irq_desc_t *idesc; +int i; + +for (i=0 ; i <NR_IRQS ; i++) { + idesc =irq_descp (i); + action = idesc->action; +if (!action) +continue ; +if (idesc->handler->end) + idesc->handler->end (i); + } +} +
kexec/arch/ia64/crashdump-ia64.c +351 -0
351 lines not on this page · raw message
kexec/arch/ia64/crashdump-ia64.h +13 -0
@@ -0,0 +1,13 @@ +#ifndef CRASHDUMP_IA64_H +#define CRASHDUMP_IA64_H + +#define PAGE_OFFSET 0xe000000000000000UL +#define __pa (x) ((unsigned long)(x)-PAGE_OFFSET) +extern int load_crashdump_segments (struct kexec_info *info, +struct mem_ehdr *ehdr,unsigned long max_addr, +unsigned long min_base,char **cmdline); + +#define CRASH_MAX_MEMMAP_NR (KEXEC_MAX_SEGMENTS + 1) +#define CRASH_MAX_MEMORY_RANGES (MAX_MEMORY_RANGES + 2) + +#endif
kexec/arch/ia64/kexec-elf-ia64.c +125 -23
208 lines not on this page · raw message
kexec/arch/ia64/kexec-elf-rel-ia64.c +123 -5
158 lines not on this page · raw message
kexec/arch/ia64/kexec-ia64.c +74 -53
169 lines not on this page · raw message
kexec/arch/ia64/kexec-ia64.h +3 -1
@@ -5,5 +5,7 @@ int elf_ia64_probe(const char *buf, off_int elf_ia64_load (int argc,char **argv,const char *buf,off_t len,struct kexec_info *info);void elf_ia64_usage (void ); - +#define MAX_MEMORY_RANGES 1024 +#define EFI_PAGE_SIZE (1UL<<12) +#define ELF_PAGE_SIZE (1UL<<16)#endif /* KEXEC_IA64_H */
kexec/arch/ia64/Makefile +2 -0
@@ -4,3 +4,5 @@ KEXEC_C_SRCS+= kexec/arch/ia64/kexec-ia64.c KEXEC_C_SRCS+= kexec/arch/ia64/kexec-elf-ia64.c KEXEC_C_SRCS+= kexec/arch/ia64/kexec-elf-rel-ia64.c +KEXEC_C_SRCS+= kexec/arch/ia64/crashdump-ia64.c +
kexec/kexec.c +4 -1
@@ -96,6 +96,9 @@ int valid_memory_range(unsigned long sstcontinue ; mstart = memory_range[i].start; mend = memory_range[i].end; +if (i < memory_ranges -1 && mend == memory_range[i+1 ].start) + mend = memory_range[i+1 ].end; +/* Check to see if we are fully contained */ if ((mstart <= sstart) && (mend >= send)) {return 1 ;
@@ -187,7 +190,7 @@ unsigned long locate_hole(struct kexec_i }/* Compute the free memory ranges */ - max_mem_ranges = memory_ranges + (info->nr_segments -1 ); + max_mem_ranges = memory_ranges + (info->nr_segments); mem_range =malloc (max_mem_ranges *sizeof (struct memory_range )); mem_ranges =0 ;
kexec/kexec-syscall.h +1 -1
@@ -68,6 +68,6 @@ static inline long kexec_reboot(void)#define KEXEC_ARCH_PPC64 (21 << 16)#define KEXEC_ARCH_IA_64 (50 << 16) -#define KEXEC_MAX_SEGMENTS 8 +#define KEXEC_MAX_SEGMENTS 16#endif /* KEXEC_SYSCALL_H */
purgatory/arch/ia64/console-ia64.c +43 -1
48 lines not on this page · raw message
purgatory/arch/ia64/entry.S +67 -0
67 lines not on this page · raw message
purgatory/arch/ia64/io.h +94 -0
94 lines not on this page · raw message
purgatory/arch/ia64/Makefile +3 -3
@@ -1,9 +1,9 @@ # # Purgatory ia64 # - -PURGATORY_S_SRCS+= +PCFLAGS += -ffixed-r28 +PURGATORY_S_SRCS+= purgatory/arch/ia64/entry.S PURGATORY_C_SRCS+= purgatory/arch/ia64/purgatory-ia64.c PURGATORY_C_SRCS+= purgatory/arch/ia64/console-ia64.c -PURGATORY_C_SRCS+= +PURGATORY_C_SRCS+= purgatory/arch/ia64/vga.c
purgatory/arch/ia64/purgatory-ia64.c +264 -2
273 lines not on this page · raw message
purgatory/arch/ia64/purgatory-ia64.h +1 -2
@@ -1,6 +1,5 @@#ifndef PURGATORY_IA64_H #define PURGATORY_IA64_H -/* nothing yet */ - +void reset_vga (void );#endif /* PURGATORY_IA64_H */
purgatory/arch/ia64/vga.c +143 -0
143 lines not on this page · raw message