]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
s390/kdump: remove code to create ELF notes in the crashed system
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 14 Oct 2015 13:53:06 +0000 (15:53 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 27 Nov 2015 08:24:12 +0000 (09:24 +0100)
The s390 architecture can store the CPU registers of the crashed system
after the kdump kernel has been started and this is the preferred way.
Remove the remaining code fragments that deal with storing CPU registers
while the crashed system is still active.

Acked-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/elf.h
arch/s390/kernel/crash_dump.c
arch/s390/kernel/machine_kexec.c
arch/s390/kernel/setup.c
arch/s390/kernel/smp.c

index bab6739a1154e1fd9827ff8dfb5c152ef52f3930..7730e5b9e7e2357694939d03489db21837726049 100644 (file)
@@ -229,6 +229,4 @@ struct linux_binprm;
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
 int arch_setup_additional_pages(struct linux_binprm *, int);
 
-void *fill_cpu_elf_notes(void *ptr, struct save_area *sa, __vector128 *vxrs);
-
 #endif
index 171e09bb8ea2a0b0e6ad23d68ff6e6617a83e8bc..07d75b969f5916f7015ba61b99d86c2ea0455dac 100644 (file)
@@ -72,11 +72,6 @@ static int copy_from_realmem(void *dest, void *src, size_t count)
        return 0;
 }
 
-/*
- * Pointer to ELF header in new kernel
- */
-static void *elfcorehdr_newmem;
-
 /*
  * Copy one page from zfcpdump "oldmem"
  *
@@ -390,7 +385,8 @@ static void *nt_s390_vx_low(void *ptr, __vector128 *vx_regs)
 /*
  * Fill ELF notes for one CPU with save area registers
  */
-void *fill_cpu_elf_notes(void *ptr, struct save_area *sa, __vector128 *vx_regs)
+static void *fill_cpu_elf_notes(void *ptr, struct save_area *sa,
+                               __vector128 *vx_regs)
 {
        ptr = nt_prstatus(ptr, sa);
        ptr = nt_fpregset(ptr, sa);
@@ -573,9 +569,6 @@ int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size)
        /* If we are not in kdump or zfcpdump mode return */
        if (!OLDMEM_BASE && ipl_info.type != IPL_TYPE_FCP_DUMP)
                return 0;
-       /* If elfcorehdr= has been passed via cmdline, we use that one */
-       if (elfcorehdr_addr != ELFCORE_ADDR_MAX)
-               return 0;
        /* If we cannot get HSA size for zfcpdump return error */
        if (ipl_info.type == IPL_TYPE_FCP_DUMP && !sclp.hsa_size)
                return -ENODEV;
@@ -606,7 +599,6 @@ int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size)
        hdr_off = PTR_DIFF(ptr, hdr);
        loads_init(phdr_loads, hdr_off);
        *addr = (unsigned long long) hdr;
-       elfcorehdr_newmem = hdr;
        *size = (unsigned long long) hdr_off;
        BUG_ON(elfcorehdr_size > alloc_size);
        return 0;
@@ -617,8 +609,6 @@ int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size)
  */
 void elfcorehdr_free(unsigned long long addr)
 {
-       if (!elfcorehdr_newmem)
-               return;
        kfree((void *)(unsigned long)addr);
 }
 
@@ -629,7 +619,6 @@ ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
 {
        void *src = (void *)(unsigned long)*ppos;
 
-       src = elfcorehdr_newmem ? src : src - OLDMEM_BASE;
        memcpy(buf, src, count);
        *ppos += count;
        return count;
@@ -641,15 +630,8 @@ ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
 ssize_t elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos)
 {
        void *src = (void *)(unsigned long)*ppos;
-       int rc;
 
-       if (elfcorehdr_newmem) {
-               memcpy(buf, src, count);
-       } else {
-               rc = copy_from_oldmem(buf, src, count);
-               if (rc)
-                       return rc;
-       }
+       memcpy(buf, src, count);
        *ppos += count;
        return count;
 }
index fb0901ec4306b833920b4f1b9386afc64c5573d0..991b16819b974c3a8587afb1e0bd0d233a76cb39 100644 (file)
@@ -34,44 +34,38 @@ extern const unsigned long long relocate_kernel_len;
 
 #ifdef CONFIG_CRASH_DUMP
 
-/*
- * Create ELF notes for one CPU
- */
-static void add_elf_notes(int cpu)
-{
-       struct save_area *sa = (void *) 4608 + store_prefix();
-       void *ptr;
-
-       memcpy((void *) (4608UL + sa->pref_reg), sa, sizeof(*sa));
-       ptr = (u64 *) per_cpu_ptr(crash_notes, cpu);
-       ptr = fill_cpu_elf_notes(ptr, sa, NULL);
-       memset(ptr, 0, sizeof(struct elf_note));
-}
-
 /*
  * Initialize CPU ELF notes
  */
 static void setup_regs(void)
 {
-       unsigned long sa = S390_lowcore.prefixreg_save_area + SAVE_AREA_BASE;
-       struct _lowcore *lc;
+       struct save_area *sa, *sa_0;
+       unsigned long prefix;
        int cpu, this_cpu;
 
-       /* Get lowcore pointer from store status of this CPU (absolute zero) */
-       lc = (struct _lowcore *)(unsigned long)S390_lowcore.prefixreg_save_area;
+       /* setup_regs is called with the prefix register = 0 */
+       sa_0 = (struct save_area *) SAVE_AREA_BASE;
+
+       /* Get status of this CPU out of absolute zero */
+       prefix = (unsigned long) S390_lowcore.prefixreg_save_area;
+       sa = (struct save_area *)(prefix + SAVE_AREA_BASE);
+       memcpy(sa, sa_0, sizeof(struct save_area));
+       if (MACHINE_HAS_VX) {
+               struct _lowcore *lc = (struct _lowcore *) prefix;
+               save_vx_regs_safe((void *) lc->vector_save_area_addr);
+       }
+
+       /* Get status of the other CPUs */
        this_cpu = smp_find_processor_id(stap());
-       add_elf_notes(this_cpu);
        for_each_online_cpu(cpu) {
                if (cpu == this_cpu)
                        continue;
                if (smp_store_status(cpu))
                        continue;
-               add_elf_notes(cpu);
+               prefix = (unsigned long) S390_lowcore.prefixreg_save_area;
+               sa = (struct save_area *)(prefix + SAVE_AREA_BASE);
+               memcpy(sa, sa_0, sizeof(struct save_area));
        }
-       if (MACHINE_HAS_VX)
-               save_vx_regs_safe((void *) lc->vector_save_area_addr);
-       /* Copy dump CPU store status info to absolute zero */
-       memcpy((void *) SAVE_AREA_BASE, (void *) sa, sizeof(struct save_area));
 }
 
 /*
index c837bcacf2188460a50754f3a75d1b485c25f671..8f5107d6ebb379dbf707b6993d19978917613822 100644 (file)
@@ -661,15 +661,6 @@ static void __init reserve_kernel(void)
 #endif
 }
 
-static void __init reserve_elfcorehdr(void)
-{
-#ifdef CONFIG_CRASH_DUMP
-       if (is_kdump_kernel())
-               memblock_reserve(elfcorehdr_addr - OLDMEM_BASE,
-                                PAGE_ALIGN(elfcorehdr_size));
-#endif
-}
-
 static void __init setup_memory(void)
 {
        struct memblock_region *reg;
@@ -841,6 +832,11 @@ void __init setup_arch(char **cmdline_p)
        init_mm.brk = (unsigned long) &_end;
 
        parse_early_param();
+#ifdef CONFIG_CRASH_DUMP
+       /* Deactivate elfcorehdr= kernel parameter */
+       elfcorehdr_addr = ELFCORE_ADDR_MAX;
+#endif
+
        os_info_init();
        setup_ipl();
 
@@ -849,7 +845,6 @@ void __init setup_arch(char **cmdline_p)
        reserve_oldmem();
        reserve_kernel();
        reserve_initrd();
-       reserve_elfcorehdr();
        memblock_allow_resize();
 
        /* Get information about *all* installed memory */
index 9062df575afe1cea0b6a15f0ab018d95ecc859b9..7ad070e984f273465177bb3601c66b8bd5b84597 100644 (file)
@@ -608,9 +608,8 @@ int smp_store_status(int cpu)
  *    stored the registers of the boot CPU in the memory of the old system.
  * 4) kdump and the old kernel stored the CPU state
  *    condition: OLDMEM_BASE != NULL && is_kdump_kernel()
- *    The state of all CPUs is stored in ELF sections in the memory of the
- *    old system. The ELF sections are picked up by the crash_dump code
- *    via elfcorehdr_addr.
+ *    This case does not exist for s390 anymore, setup_arch explicitly
+ *    deactivates the elfcorehdr= kernel parameter
  */
 void __init smp_save_dump_cpus(void)
 {
@@ -619,9 +618,6 @@ void __init smp_save_dump_cpus(void)
        struct save_area_ext *sa_ext;
        bool is_boot_cpu;
 
-       if (is_kdump_kernel())
-               /* Previous system stored the CPU states. Nothing to do. */
-               return;
        if (!(OLDMEM_BASE || ipl_info.type == IPL_TYPE_FCP_DUMP))
                /* No previous system present, normal boot. */
                return;