Messages in this thread | | | Subject | Re: [patch v3 3/8] kdump: Add size to elfcorehdr kernel parameter | From | Michael Holzheu <> | Date | Thu, 18 Aug 2011 19:56:46 +0200 |
| |
Hello Vivek,
On Thu, 2011-08-18 at 13:28 -0400, Vivek Goyal wrote: > > The parameter is parsed in common code (kernel/crash_dump.c) in > > early_param("elfcorehdr", setup_elfcorehdr), as it is already currently > > the case. > > > > We use address and size of the ELF core header to reserve the header > > memory in setup.c (see patch #8): > > > > +#ifdef CONFIG_CRASH_DUMP > > + if (is_kdump_kernel()) > > + reserve_bootmem(elfcorehdr_addr - OLDMEM_BASE, > > + PAGE_ALIGN(elfcorehdr_size), BOOTMEM_DEFAULT); > > +#endif > > > > Does that answer your question? > > Yes it does. Thanks. > > It brings up few more questions about rest of the memory mangement. > > So kdump kernel is loaded in reserved area but does not run from there. > It reloads itself into lower memory areas and swaps the contents of > lower memory with reserved memory? If yes, how does it, kernel or > purgatory?
With the v3 patch series purgatory does that (see purgatory-s390.c/post_verification_setup_arch()):
> How does kernel come to know about how much memory is to be swapped
2nd kernel knows crash_base and crash_base because kexec tools told him that. We do it like registering the ramdisk. See kexec-image.c:
+ if (info->kexec_flags & KEXEC_ON_CRASH) { + tmp = krnl_buffer + OLDMEM_BASE_OFFS; + *tmp = crash_base; + + tmp = krnl_buffer + OLDMEM_SIZE_OFFS; + *tmp = crash_end - crash_base + 1; + }
> and how do you bound the memory usage of second kernel so that it > does not try to use other memory which has not been swapped into > reserved area.
See kernel patches setup.c:
+/* + * Make sure that oldmem, where the dump is stored, is protected + */ +static void reserve_oldmem(void) +{ +#ifdef CONFIG_CRASH_DUMP + if (!is_kdump_kernel()) + return; + + reserve_kdump_bootmem(OLDMEM_BASE, OLDMEM_SIZE, CHUNK_OLDMEM); + reserve_kdump_bootmem(OLDMEM_SIZE, memory_end - OLDMEM_SIZE, + CHUNK_OLDMEM); + if (OLDMEM_BASE + OLDMEM_SIZE == real_memory_size) + saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1; + else + saved_max_pfn = PFN_DOWN(real_memory_size) - 1; +#endif +}
Michael
| |